Repository overview:
nn
— all.py
project sourcesconfig
— configuration files for models (mounted)data
— folder with train/inference data (mounted)tensorboard
— training logs information (mounted)checkpoints
— model training checkpoints (mounted)pyproject.toml
andpoetry.lock
— Poetry dependency filestrain_example.sh
— training example scriptinference_example.sh
— inference example script
This application can be built locally or in Docker
To build locally:
- Install Python 3.10 via any package manager
- Install Poetry
- Run
poetry install
in project root
To build Docker container:
- Run
docker-compose build
Currently GPU computations are only available on amd64
platform with cuda
support.
Of course, as every neural network, this one needs some data to work.
You can find it on your own and place in data
folder or download original dataset with download.sh
script in data
folder.
NOTE: wget
is required for script to work, so you will probably need to install it. You can also download data from browser using link provided in script.
To start container just run
docker-compose up
To train model run train.py
script in nn
folder with following arguments:
-
--model_type
— one of defined inmodels.py
models. -
--model_config
— path to config for this modelPredefined configs are available in
config
folder. -
--data_config
— path to config forDataset
object.This works only if model has constructor based on
pydantic
configuration file. -
--learning_rate
— modellearning_rate
-
--epochs
— number of epochs -
--batch_size
— batch size -
--attempt_name
— name of current attempt -
--loss
— loss functionBased on this argument checkpoints and will be saved in
checkpoints/<attempt_name>.pt
andlogs/<attempt_name>.csv
. -
--device
— computation device [Optional]Default: GPU if available else CPU
-
--restore_state
— path to.pt
file with checkpoint [Optional]
Default: `None`
-
--level
— logging level [Optional]Default:
INFO
Example is available in entrypoint.sh
file.
To inference use inference.py
script in model
folder with following arguments:
-
--model_type
— one of defined inmodels.py
models -
--model_config
— path to config for this modelPredefined configs are available in
config
folder. -
--checkpoint
— path to pre-trained checkpoint usingtrain.py
script or any other checkpoint with same JSON structure -
--output_path
— path where should script save output of a model -
--device
— computation device [Optional]Default: GPU if available else CPU
-
--batch_size
— batch size [Optional]Default: 65536
-
--duration
— how much time of input file should be inferred (in seconds) [Optional]Default: audio duration
-
--sr
— sample rateDefault: 44100