Torch.save not UTF-8 encoded

I’m using torch.save(model.state_dict(),'model') to save my model.
My jupyter notebook shows the error:

model is not UTF-8 encodes, saving disabled.

Someone knows how to solve this?

Can you link your model code?

Hi, thank you for your reply, I think it’s not about model, I just defined a file named “model”

What happens if you do

torch.save(model.state_dict(),'model.pth')

If that still gives and error, can you report what the model.state_dict() contains, and we might be able to spot something weird in there

That happens due to the format of the saved file with is Zip and cannot be handled by Jupyter. You can unzip it and open in another app (VSCode) and that would work.