-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load existing model #17
Comments
Hi! I encountered the same problem. Do you have any solution now? Thanks. @saurabhbh21 |
@saurabhbh21 @woshiyyya Hey! Have any of you figured how to load a trained model? Thanks a lot. |
Please look into below piece of code, it may help you to figure out way to load & store model import os import cPickle as pickle from sift.corpora import wikipedia from nel.model import data from nel.doc import Doc from nel.harness.format import from_sift from nel.process.pipeline import Pipeline from nel.learn import ranking from nel.harness.format import inject_markdown_links from nel.process import tag, coref wikipedia_base_path = 'latest/' wikipedia_corpus = wikipedia.WikipediaCorpus()(sc, wikipedia_base_path) docs = sc.parallelize(docs.take(3)) wikipedia_pfx = 'en.wikipedia.org/wiki/' ec_model = links enc_model = links print(ec_model.collect()) os.environ['NEL_DATASTORE_URI'] = 'file:///home/botminds/Desktop/nel' // Saves the model with name wikipedia having pipeline for ecounts followed by necount data.ObjectStore //Load the model candidate_generation = [ // Training train = [training_pipeline(doc) for doc in training_docs] t = training_docs[0] ranker = ranking.TrainLinearRanker(name='ranker', features=[f.id for f in feature_extraction])(train) // with open(file_ranker, 'wb') as f: // Loading the model for ranker with open(file_ranker, 'rb') as f: classifier_feature = meta.ClassifierScore(ranker)
] linking_pipeline = Pipeline(candidate_generation + feature_extraction + linking) for doc in sample: |
I trained a model with Wikipedia dump. I was trying to load the model in another code snippet for classification but unable to find the model load code. Any help will be very much helpful.
The text was updated successfully, but these errors were encountered: