This repository stores a simple Python script which trains a Pytorch model (adapted from an example in https://github.com/pytorch/examples/tree/7f7c222b355abd19ba03a7d4ba90f1092973cdbc).
Python 3.
Requires Python libraries torch
and torchvision
. With pip
:
pip install -r requirements.txt
You may using virtualenv
to create a self-contained Python environment for
this project. In your shell, in the root of the repository, with virtualenv
and pip
installed, run:
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
The source
command sets up your shell to use the self-contained environment
until you close it. Every time you want to use it, run source venv/bin/activate
in the directory you created the virtualenv in.
A Nix flake including a devshell is provided for Nix users. nix develop
will
set up requirements to then follow the virtualenv
instructions above. (Your
Nix version needs to support flakes.)
python main.py --save-model
(The default epochs has been retuned from 14 to 3 for faster execution by
default. Change this by adding an --epochs x
option.)