I have an object that I'm trying to load using pickle (Iv'e tried JSON also and still not working, it says that it is not JSON serializable) and getting the following error:
Can't get attribute 'TextToSequence' on Code/voc-git/system/classifier_tools.py'>
Saving the object was really easy and worked perfectly, the issue rises just when I'm trying to load it.
Iv'e used the following code for the saving process:
with open(seq_obj_file, 'wb') as f:
pickle.dump(seq, f, pickle.HIGHEST_PROTOCOL)
while seq is the object I'm saving to the file seq_obj_file
For loading Iv'e used the following code:
with open(seq_obj, 'rb') as pkl:
self.input_vectorizer = pickle.load(pkl)
While self.input_vectorizer is an empty variable.
The object I'm trying to save belongs to the class TextToSequence.
I came across the solution proposed here, in my case I need to save the object inside a different class and can't export it to an outside main function.