Generic code template for pytorch project.
Required python >= 3.8
and pip
pip install -r requirements.txt
echo "run_name: tmp" >> settings.yaml
- Remove the
.idea/
directory if you don't use pyCharm IDE. - In
utils/logger.py
at the last line, set the current project name in:logger_name='<project name>'
. - Create your own dataset in
datasets/
or remove the folder if you use a dataset already implemented in pytorch. - Create your own neural network in
networks/
. - Replace the dataset and the network in
main.py
. - Remove / add settings in
utils/settings.py
- Run
run.py
- Update the title / description of this README file, and remove this section.
Run a single training + testing based on the current settings:
python3 run.py
Run a list training + testing based on the current settings and the planner configuration:
python3 runs_planner.py
An extendable list of settings with their default values can be found in the file utils/settings.py
.
Their values can be overridden by:
- the local setting file (
./settings.yaml
) - the environment variables
- the arguments of the command line (
--help
to see the list)
- datasets/: Directory that contains the list of available datasets classes that extend the pytorch Dataset class.
- networks/: Directory that contains the list of available neural network that extend the pytorch Module class.
- out/: Directory where named run output will be saved. A subdirectory will be generated for each new run.
- plots/: Directory that contains all plotting scripts.
- utils/: Directory that contains utility scripts, using them is optional, but they simplify some tasks.
- logger.py: Class wrapper to handle console and file logging.
- metrics.py: Script to compute and save metrics about the network and the run.
- output.py: Script to manage the run output (log file, images, results, ...).
- planner.py: Class to create an iterable list run settings.
- progress_bar.py: Class to handle visual progress bar.
- settings.py: Dataclass to store and load settings values. Create a singleton at the first import.
- timer.py: Class wrapper to handle, print and save timers.
- main.py: Simple script to set up dataset and neural network before to start a run.
- run.py: Full script that contains the run steps logic.
- runs_analyse.py: Script to aggregate and plot result from several runs.
- runs_planner.py: Script to start a list of runs with different settings one by one.
- settings.yaml: Local settings file to override default values. This file shouldn't be committed.
- test.py: Script that contains the network testing logic.
- train.py: Script that contains the network training logic.