ryotomatsuba / ObjectDetection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PyTorch-Project-Template

Installation

$ git clone git@github.com:tomoino/PyTorch-Project-Template.git

Usage

Setup

$ cd PyTorch-Project-Template
$ sh docker/build.sh
$ sh docker/run.sh
$ sh docker/exec.sh

Start a new project

  1. Add yaml file to "./configs/project"
    $ vi ./configs/project/new_project.yaml
  2. Run train.py with project option
    $ python train.py project=new_project

Training

$ python train.py

Grid Search

You can run train.py with multiple different configurations.

$ python train.py -m \
    project.train.batch_size=16,32 \
    project.train.optimizer.lr=0.01,0.001

Evaluation

$ python train.py eval=True project.model.initial_ckpt=best_ckpt.pth

Check the results

You can use MLflow to check the results of your experiment. Access http://localhost:8888/ from your browser. If necessary, you can edit env.sh to change the port.

How to customize

Structure

$ tree -I "datasets|mlruns|__pycache__|outputs|multirun"
.
├── README.md
├── configs
│   ├── config.yaml
│   ├── hydra
│   │   └── job_logging
│   │       └── custom.yaml
│   ├── project
│   │   └── default.yaml
│   └── supported_info.py
├── data
│   ├── __init__.py
│   ├── dataloader.py
│   ├── dataset
│   │   ├── cifar10.py
│   │   └── omniglot.py
│   ├── helper.py
│   └── sampler
│       └── balanced_batch_sampler.py
├── docker
│   ├── Dockerfile
│   ├── build.sh
│   ├── env.sh
│   ├── exec.sh
│   ├── init.sh
│   ├── requirements.txt
│   └── run.sh
├── metrics
│   ├── __init__.py
│   └── classification_metric.py
├── models
│   ├── __init__.py
│   ├── base_model.py
│   ├── helper.py
│   └── networks
│       ├── resnet18.py
│       └── simple_cnn.py
├── train.py
└── trainers
    ├── __init__.py
    ├── base_trainer.py
    └── default_trainer.py

TODO

  • nohup
  • optuna
  • scheduler
  • flake8
  • error handling
  • clear cache command
  • basic metrics
  • assertion
  • notification
  • FP16 (apex)
  • classmethod, staticmethod
  • value error
  • usage as template
  • multi-gpu
  • refactoring on cfg to make the modules easy to reuse.
  • utils.paths
  • docker-compose
  • pytorch-lightning
  • trainer
  • evaluation mode
  • logger
  • metrics
  • mlflow
  • hydra tab completion
  • projects
  • hydra

About


Languages

Language:Python 90.3%Language:Dockerfile 6.6%Language:Shell 3.0%