A library based on Ignite to help you train and evaluate PyTorch neural networks more easily.
Project description
flame
Flame is a library that helps develop neural networks fast and flexibly. It is built on PyTorch Ignite, a high-level library in PyTorch Ecosystem.
Contents
Why flame?
When developing neural networks people train and evaluate models a lot and repeat these works on many problems. Flame is created for solving two needs:
- Templates for doing experiments: flame provides templates for neural network development with common utilities like saving checkpoints periodically, resume training, logging, evaluating, etc.
- The way to add functionalities flexibly: depending on different problems developers have different requirements for the training and testing. They might want to stop the training progress if there is no improvement, plotting the results after each epoch or they just want a vanilla training loop. Now with flame, you can use any on-the-shelf metrics and handlers from Ignite or your own just by editing the configuration file.
Concepts
TBD
Installation
Create your new environment with Python 3 and install flame by pip
:
pip install pytorch-flame
Get started
Usage
Flame provides two commands:
- Initialize a new project
usage: flame init [-h] [-f] [directory] positional arguments: directory Directory in which the new project is initialized. If not specified, it will be initialized in the current directory. optional arguments: -h, --help show this help message and exit -f, --full Whether to create a full template project or not.
- Run the training or testing
usage: flame run [-h] file positional arguments: file Config file optional arguments: -h, --help show this help message and exit
Run your first experiment
Let's get started with a simple experiment: classification on the MNIST dataset.
- Flame runs experiments with configs so you need to create configs first. Run commands
mkdir mnist-classifcation && cd mnist-classification flame init
or you can run just commandflame init mnist-classification
flame will create the folder and initialize in it. The folder created will have the structure:
You can addmnist-classification/ └── configs ├── test.yml └── train.yml
-f
or--full
toinit
command for creating an extra filerun.py
in case you prefer runningpython run.py
rather thanflame run
for some reason. Then the structure will be:mnist-classification/ ├── configs │ ├── test.yml │ └── train.yml └── run.py
- MNIST dataset and the model will be got from
torchvision
, so we need to install it.pip install torchvision
- Now, you have all for the training.
cd
tomnist-classification
and run it byflame run configs/train.yml
To see how the training is going on, start Tensorboardtensorboard --logdir logs/
- Checkpoints will be saved in
checkpoints
folder. Say the training is done and you want to evaluate the modelcheckpoints/best_model.pt
, for example, change valuecheckpoint.loader.kwargs.path
inconfigs/test.yml
tocheckpoints/best_model.pt
.checkpoint: loader: module: flame.handlers name: CheckpointLoader kwargs: path: "'checkpoints/best_model.pt'"
Run the following command to start evaluating the model:flame run configs/test.yml
That's it! You have just completed training and evaluating with flame.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytorch-flame-0.1.0.tar.gz
.
File metadata
- Download URL: pytorch-flame-0.1.0.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 299bb21cb795db4b6a5e7c4fa96b7cb2560366e01b3b037bb735dee92414c09c |
|
MD5 | 5fa4e67c7e14f386b25b46249d581b6d |
|
BLAKE2b-256 | bc7a715e545459d9b241c7034775fe70af3806c3c9798f0a61ddf71f882cd862 |
File details
Details for the file pytorch_flame-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: pytorch_flame-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fe24be5000fb046f0375fa5afad6ffc37bdb4201d59f7f54ee2299f81910823 |
|
MD5 | 9866d2c0fc0fda1343e5698a205653e8 |
|
BLAKE2b-256 | 156c2fc70edfaf38fb1dcae23bdf44c5555abc929e88e63ad029b974dcd9c97c |