Closed wz940216 closed 2 years ago
That piece of code comes from https://github.com/marco-rudolph/differnet I haven't modified it yet. Maybe you can find a solution there. Which device did you use?
I encountered the same problem when saving the model, the error code is as follows :
AttributeError: Can't pickle local object 'AllInOneBlock.__init__.<locals>.<lambda>
Hi @QQR1, @wz940216, I modified the code in train.py from
save_model(model), c.modelname)
to
save_model(model.state_dict(), c.modelname)
I tested it and it should work. Let me know. I found the solution at this link https://github.com/pytorch/pytorch/issues/7545 Best, Alessio
Error in saving model AttributeError: Can't pickle local object '_BaseCouplingBlock.init..'
in code train.py if c.save_model: model.to('cpu') save_model(model, c.modelname) save_weights(model, c.modelname)