Open sahilwalke17 opened 4 years ago
you gotta edit a line in train.py. In the PyTorch scripts, apparently the block that calls torch.save
only gets executed when you enable the eval_every flag.
you can add this line torch.save
at the end of the training so that it saves one final time before it finishes training
# Final eval at end of training. and save model?
run_eval(model, valid_loader, device, chrono, logger, step='end')
torch.save({
"step": step,
"model": model.state_dict(),
"optim" : optim.state_dict(),
}, savename)
thx. this saved as a tar file, which contains a set of files. should it be a simple pt file?
I did as skcerin said. But failed to load to train, it says "expected cpu but got cuda:0"
you gotta edit a line in train.py. In the PyTorch scripts, apparently the block that calls
torch.save
only gets executed when you enable the eval_every flag.you can add this line
torch.save
at the end of the training so that it saves one final time before it finishes training# Final eval at end of training. and save model? run_eval(model, valid_loader, device, chrono, logger, step='end') torch.save({ "step": step, "model": model.state_dict(), "optim" : optim.state_dict(), }, savename)
how can use it? for test
How do I save the model after fine-tuning using command line on dataset(CIFAR100) ?