Skip to content

Instantly share code, notes, and snippets.

@ben0it8
Last active July 25, 2019 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ben0it8/23b417c86a52adc088b469764fb6a0a2 to your computer and use it in GitHub Desktop.
Save ben0it8/23b417c86a52adc088b469764fb6a0a2 to your computer and use it in GitHub Desktop.
fine-tune and evaluate model
# fit the model on `train_dl`"
trainer.run(train_dl, max_epochs=finetuning_config.n_epochs)
# save model weights
torch.save(model.state_dict(), os.path.join(finetuning_config.log_dir, "model_weights.pth"))
# evaluate the model on `test_dl`"
evaluator.run(test_dl)
print(f"Test accuracy: {100*evaluator.state.metrics['accuracy']:.3f}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment