Dears,
I could load the model041.pt, but I couldn’t build the model and then save it. Here is the code :
old_model = “model041.pt”
new_model = “model222.pt”
checkpoint = torch.load(old_model, map_location=‘cpu’)
fields = dict(checkpoint[‘vocab’])
opt = checkpoint[‘opt’]
model = onmt.model_builder.build_model(opt, False, fields, checkpoint)
torch.save({‘model’: model.state_dict(),
‘vocab’: fields,
‘opt’: opt}, new_model)
Could you please give me a hint to be able to proceed.
Thank you