A custom deep learning project template based on PyTorch and PyTorch-Lightning.
- torch >= 1.8.0
- pytorch-lightning
- Rename the
my_package
directory and replace the package namemy_package
inmain.py
correspondingly. - Inherit
BaseDataset
inmy_package/datasets/base.py
and implement your Dataset class. - Inherit
BaseMetrics
inmy_package/metrics/base_metrics.py
and implement your custom Metrics class. - Implement your model and put all the components in
my_package/models
- Use registry to organize all the above parts.
- Follow the example configure file
configs/example_cfg.py
to make your custom configure file. - Train your model by the following command:
python main.py ./configs/example_cfg.py --train
- Test your model by the following command:
python main.py ./configs/example_cfg.py --test
- Unit tests are really important.
- Always make your code clean and readable-friendly.