How do I load a model in Python 3 that was trained and saved using Python 2?

while loading a model trained using python 2 in python 3, i get the error about encoding :

is there any workaround to this ?

it looks like you are saving a string as part of your model. See for example.

Either dont save strings on your model, or instead of saving and loading the whole model, you can:, model.state_dict())

model = Model() # construct a new model

See for an example.


this worked thank you.

I made a very rough script to try and do the Python 2 -> Python 3 conversion here: