Skip to content

Nota-NetsPresso/netspresso-trainer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Start training models (including ViTs) with NetsPresso Trainer, compress and deploy your model with NetsPresso!

Table of contents

Installation (Stable)

Prerequisites

  • Python 3.8 | 3.9 | 3.10
  • PyTorch 1.13.0 (recommended) (compatible with: 1.11.x - 1.13.x)

Install with pypi

pip install netspresso_trainer

Install with GitHub

pip install git+https://github.com/Nota-NetsPresso/netspresso-trainer.git@master

To install with editable mode,

git clone -b master https://github.com/Nota-NetsPresso/netspresso-trainer.git
pip install -e netspresso-trainer

Set-up with docker

Please clone this repository and refer to Dockerfile and docker-compose-example.yml.
For docker users, we provide more detailed guide in our Docs.

Getting started

Write your training script in train.py like:

from netspresso_trainer import train_cli

if __name__ == '__main__':
    logging_dir = train_cli()
    print(f"Training results are saved at: {logging_dir}")

Then, train your model with your own configuraiton:

python train.py\
  --data config/data/huggingface/beans.yaml\
  --augmentation config/augmentation/classification.yaml\
  --model config/model/resnet/resnet50-classification.yaml\
  --training config/training.yaml\
  --logging config/logging.yaml\
  --environment config/environment.yaml

Or you can start NetsPresso Trainer by just executing console script which has same feature.

netspresso-train\
  --data config/data/huggingface/beans.yaml\
  --augmentation config/augmentation/classification.yaml\
  --model config/model/resnet/resnet50-classification.yaml\
  --training config/training.yaml\
  --logging config/logging.yaml\
  --environment config/environment.yaml

Please refer to scripts/example_train.sh.

NetsPresso Trainer is compatible with NetsPresso service. We provide NetsPresso Trainer tutorial that contains whole procedure from model train to model compression and benchmark. Please refer to our colab tutorial.

Dataset preparation (Local)

NetsPresso Trainer is designed to accommodate a variety of tasks, each requiring different dataset formats. You can find the specific dataset formats for each task in our documentation.

If you are interested in utilizing open datasets, you can use them by following the instructions.

Image classification

Semantic segmentation

Object detection

Pose estimation

Dataset preparation (Huggingface)

NetsPresso Trainer is also compatible with huggingface dataset. To use datasets of huggingface, please check instructions in our documentations. This enables to utilize a wide range of pre-built datasets which are beneficial for various training scenarios.

Pretrained weights

Please refer to our official documentation for pretrained weights supported by NetsPresso Trainer.

Tensorboard

We provide basic tensorboard to track your training status. Run the tensorboard with the following command:

tensorboard --logdir ./outputs --port 50001 --bind_all

where PORT for tensorboard is 50001.
Note that the default directory of saving result will be ./outputs directory.