codekansas / keras-language-modeling

:book: Some language modeling tools for Keras
https://codekansas.github.io/language
MIT License
658 stars 171 forks source link

_pickle.UnpicklingError: the STRING opcode argument must be quoted #23

Open PengTedShen opened 7 years ago

PengTedShen commented 7 years ago

Thank you for your great works and support. Continue to do testing on "insurance_qa_eval.py", encountered error below:

Using Theano backend. WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.

C:\Users\Desktop\Deep_QA_System\data\insurance_qa_python\answers (None, 1) Traceback (most recent call last): C:\Users\Desktop\Deep_QA_System\data\insurance_qa_python\train File "C:/Users/PycharmProjects/insurance_qa_eval/insurance_qa_eval.py", line 272, in best_loss = evaluator.train(model) File "C:/Users/PycharmProjects/insurance_qa_eval/insurance_qa_eval.py", line 98, in train training_set = self.load('train') File "C:/Users/PycharmProjects/insurance_qa_eval/insurance_qa_eval.py", line 40, in load return pickle.load(open(os.path.join(self.path, name), 'rb')) _pickle.UnpicklingError: the STRING opcode argument must be quoted Process finished with exit code 1

I suspect the error happened in load function Line 36: def load(self, name): return pickle.load(open(os.path.join(self.path, name), 'rb'))

So I added print function to find the cause. It looks like for 'answers' it works and the data from answers can be printed out, but for 'train' , it failed.

For result on output of "(None, 1)", I do not know where it came from.

P.S. on your code line 245 : 'initial_embed_weights': np.load('models/word2vec_100_dim.h5'), word2vec_100_dim.h5, do you mean "word2vec_100_dim.embeddings" which on github ?

PengTedShen commented 7 years ago

I suspect the issue is because of file 'train' after testing file of answers and train import six.moves.cPickle as pickle import pprint with open('C:\Users\Desktop\Deep_QA_System\data\insurance_qa_python\answers', 'rb') as f: data1 = pickle.load(f) pprint.pprint(data1)

There are all the data of 'answers' can be printed out , but if changed to 'train', still got error

Traceback (most recent call last): File "C:/Users/PycharmProjects/insurance_qa_eval/pickle_testing.py", line 4, in data1 = pickle.load(f) _pickle.UnpicklingError: the STRING opcode argument must be quoted