Skip to content
This repository has been archived by the owner on Aug 15, 2020. It is now read-only.

Commit

Permalink
Merge pull request #7 from erayon/master
Browse files Browse the repository at this point in the history
encode_pickle_error
  • Loading branch information
wboag authored Feb 18, 2018
2 parents 3407bfe + 196654c commit 72f2dbc
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions code/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def predict(files, model_path, output_dir, format, use_lstm=True):
# Load model
#if use_lstm==False:
with open(model_path, 'rb') as f:
model = pickle.load(f)
model = pickle.load(f,encoding = 'latin1')


if model._use_lstm:
import helper_dataset as hd
Expand All @@ -114,7 +115,7 @@ def predict(files, model_path, output_dir, format, use_lstm=True):
note=Document(txt)
tokenized_sents = note.getTokenizedSentences()
updating_notes+=tokenized_sents
#print (updating_notes)
print (updating_notes)
fictional_labels= copy.deepcopy(tokenized_sents)
Expand All @@ -135,18 +136,19 @@ def predict(files, model_path, output_dir, format, use_lstm=True):
parameters['Feature_vector_length']=dataset.feature_vector_size
parameters['use_features_before_final_lstm']=False
dataset.update_dataset("", ['deploy'],Datasets_tokens,Datasets_labels)
'''
# model._pretrained_dataset=dataset
# model_LSTM=entity_model.EntityLSTM(dataset,parameters)
# model._current_model=model_LSTM
#._current_model
model._pretrained_dataset=dataset
model_LSTM=entity_model.EntityLSTM(dataset,parameters)
model._current_model=model_LSTM
._current_model
'''

print ("END TEST")
#exit()
# model.parameters=None
#model.parameters=None

# Tell user if not predicting
if not files:
Expand Down

0 comments on commit 72f2dbc

Please sign in to comment.