numb3r3 / rosetta_stone

RosettaStone is a library makes pytorch model development simply and friendly!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rosetta Stone

🏄 Introducton

make your deep learning life easier

Rosetta Stone is a lightweight framework that aims to make your deep learning life easier. It enables users to performe end-to-end experiment quickly and efficiently. In comparison with the other open source libraries, Rosetta is an alternate low-code toolkit that can be used to perform deep learning tasks with only few lines of code. It easy to use and make you focus on designing your models!

🦆 Version 1.1.15 out now!

*Note: master branch is the developing branch.

Features

  • yaml-styled model for elegantly configuring complex applications
  • best practice
  • Unified design for various applications
  • Pre-trained models
  • State-of-the-art performance

🚀 Installation

Requirements

- Python >= 3.6
- Pytorch >= 1.4.0

Setup

Install the latest version from source

# clone the project repository, and install via pip
$ git clone https://git.huya.com/wangfeng2/rosetta_stone.git \
    && cd rosetta_stone \
    && pip install -e .

or released stable version via pip:

$ pip install --upgrade rosetta-stone

For ease-of-use, you can also use rosetta with Docker:

# build docker image
$ docker build --tag huya_ai:rosetta .

# run the docker container
$ docker run --rm -it -v $(PWD):/rosetta --name rosetta huya_ai:rosetta bash

📖 Usage

In rosetta you don’t need to specify a training loop, just define the dataLoaders and the models. For ResNet example,

  • Step 1: Create YAML Configuration

create a yaml file (usually named as app.yaml) within your repo as the example below.

```yaml
resnet56: &resnet56
  model_module: examples.vision.resnet_model:ResNet
  dataio_module: examples.vision.cifar10:CIFAR10

  batch_size: 256
  num_classes: 10

  n_size: 9
```
  • Step 2: Define Dataloader

  • Step 3: Define Model

  • Step 4: Start to train

    • training from scratch

      $ rosetta train resnet56 --yaml-path app.yaml
    • overrides parameters defined in yaml file

      # the cli paramer `--yaml-path` has default value `app.yaml`
      $ rosetta train resnet56 --batch_size=125
    • training using automatic mixture precision (amp)

      $ rosetta train resnet56 --yaml-path app.yaml --use-amp
    • distributed training using torch.distributed.launch (recommended)

      $ python -m torch.distributed.launch --module --nproc_per_node={GPU_NUM} rosetta.main train resnet56
    • distributed training using horovod (not recommended)

      $ rosetta train resnet56 --use-horovod

👋 Contribution Guide

You can contribute to this project by sending a merge request. After approval, the merge request will be merged by the reviewer.

Before making a contribution, please confirm that:

  • Code quality stays consistent across the script, module or package.
  • Code is covered by unit tests.
  • API is maintainable.

👍 References

About

RosettaStone is a library makes pytorch model development simply and friendly!


Languages

Language:Python 96.1%Language:HTML 1.9%Language:Shell 1.7%Language:Dockerfile 0.2%Language:Makefile 0.1%