-
pdoc: Automatically create an API documentation for your project
-
pre-commit plugins: Automate code reviewing formatting
.
├── config
│ ├── main.yaml # Main configuration file
│ ├── model # Configurations for training model
│ │ ├── model1.yaml # First variation of parameters to train model
│ │ └── model2.yaml # Second variation of parameters to train model
│ └── process # Configurations for processing data
│ ├── process1.yaml # First variation of parameters to process data
│ └── process2.yaml # Second variation of parameters to process data
├── data
│ ├── final # data after training the model
│ ├── processed # data after processing
│ └── raw # raw data
├── docs # documentation for your project
├── .gitignore # ignore files that cannot commit to Git
├── Makefile # store useful commands to set up the environment
├── models # store models
├── notebooks # store notebooks
├── .pre-commit-config.yaml # configurations for pre-commit
├── pyproject.toml # dependencies for poetry
├── README.md # describe your project
├── src # store source code
│ ├── __init__.py # make src a Python module
│ ├── process.py # process data before training model
│ └── train_model.py # train model
└── tests # store tests
├── __init__.py # make tests a Python module
├── test_process.py # test functions for process.py
└── test_train_model.py # test functions for train_model.py
- Install dependencies and download data:
bash vast_ai_setup.sh
- Login to wandb:
wandb login
- Test the environment:
python tests/test_env.py
- Install Poetry
- Activate the virtual environment:
poetry shell
- Install dependencies:
- To install all dependencies from pyproject.toml, run:
pip install --upgrade pip setuptools wheel
poetry install
- To install only production dependencies, run:
poetry install --only main
- To install a new package, run:
poetry add <package-name>
After creating an account on wandb, creating a project, and setting up the variables in the config/main.yaml, then run in the terminal:
wandb login
After these commands paste:
python tests/test_env.py
If it won't work try with installing following dependencies through pip:
pip install torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu118
pip install causal_conv1d==1.2.*
pip install mamba-ssm==1.2.0.post1
In case the above does not work, please make sure you have cuda devel toolkit installed.
To make shure that your code fulfill all necessary from yapf and pylint paste whi before all commits and correct them
./yapf-fix.sh
./pylint.sh
- Download data:
python src/download_data.py
- Train model:
python src/train_model.py > "logs/output_$(date +'%Y-%m-%d_%H-%M-%S').log" 2>&1
- Clean up wandb cache (local and in the cloud):
python src/wandb_clenaup.py
TODO: cleanup functions should be run automatically as a callback every few epochs. However, it should be tested, because wandb seem to be logging all of the models in the cloud.
To view the configurations associated with a Pythons script, run the following command:
python src/process.py --help
Output:
process is powered by Hydra.
== Configuration groups ==
Compose your configuration from those groups (group=option)
model: model1, model2
process: process1, process2
== Config ==
Override anything in the config (foo.bar=value)
process:
use_columns:
- col1
- col2
model:
name: model1
data:
raw: data/raw/sample.csv
processed: data/processed/processed.csv
final: data/final/final.csv
To alter the configurations associated with a Python script from the command line, run the following:
python src/process.py data.raw=sample2.csv
To auto-generate API document for your project, run:
make docs
After training, you can fined models in models/
directory.
- Choose a model from
models/
directory. - Make sure the config in
config/mamba_model.yaml
is the same as the model you want to use. - Run the inference:
python src/run_generate.py > "logs/generate_output_$(date +'%Y-%m-%d_%H-%M-%S').log" 2>&1
Symbolic music generation using Mamba architecture
Przez ostatnie lata wiele wysiłku zostało włożone w to, aby uczynić Transformery coraz bardziej wydajnymi. Jednak od stosunkowo niedawna odczuwają one coraz większą konkurencję ze strony modeli oparytch o architekturę SSM (State Space Models), które dorównją, a nawet pokonują je w wielu zadaniach. Najnowszym i jak dotąd najlepszym modelem SSM jest Mamba. Nie znaleźliśmy żadnych badań dotyczących wykorzystania tej architektury do generowania muzyki w formacie symbolicznym. W związku z tym chcielibyśmy sami sprawdzić jak Mamba sprawdza się w tym zadaniu. Perspektywy wydają się bardzo obiecujące ze względu na specyfikację tej architektury, której przewaga nad klasycznymi transformerami uwypukla sie w przypadku coraz to dłuższych sekwencji. Dlatego muzyka wydaje się idealnym polem do zbadania działania Mamby.
Projekt ma na celu zbadanie możliwości generowania muzyki symbolicznej przy użyciu architektury Mamba. Docelowo planujemy generować muzykę w formacie MIDI, lecz jest możliwe że ostatecznie skupimy się na formacie ABC lub MusicXML.
UWAGA: Harmonogram będzie zmieniany dynamicznie wraz z postępem prac.
Tydzień | TODO |
---|---|
19 Feb - 25 Feb | ==początek semestru== |
26 Feb - 03 Mar | wybór tematu |
04 Mar - 10 Mar | konsultacja tematu |
11 Mar - 17 Mar | design proposal |
18 Mar - 24 Mar | przygotowanie repo, MLOps |
25 Mar - 31 Mar | ==święta== |
01 Apr - 07 Apr | zaznajomienie się z architekturą i rozplanowanie implementacji |
08 Apr - 14 Apr | rozpoczęcie implementacji |
15 Apr - 21 Apr | wybranie formatu danych, datasetu i sposobu tokenizacji |
22 Apr - 28 Apr | trenowanie, ewaluacja i modyfikacja 1 |
29 Apr - 05 May | ==majówka== |
06 May - 12 May | trenowanie, ewaluacja i modyfikacja 2 |
13 May - 19 May | trenowanie, ewaluacja i modyfikacja 3 |
20 May - 26 May | analiza wyników i przygotowanie artykułu |
27 May - 02 Jun | zgłosznie artykułu (deadline) |
03 Jun - 09 Jun | tydzień na ewentualne dokończenie prac |
10 Jun - 16 Jun | ==koniec semestru== |
- Trenowanie architektury Mamba do generowania muzyki w formacie symbolicznym (MIDI, ABC albo MusicXML).
- Ewaluacja wyników (głównie poprzez ankietyzacje z testem statystycznym).
- Porównanie muzyki wygenerowanej do prawdziwej oraz wygenerowanej przez inne modele.
- Przeprowadzenie analizy Mean Opinion Score (MOS).
- Metryki.
- (Opcjonalne) Porównanie z transformerem.
- (Opcjonalnie) Dodanie warunkowania tekstem.
- Opisanie następnych kroków i możliwych opcji rozwoju.
- Python 3
- autoformatter: black
- linter: ruff
- Środowisko wirtualne: Pipenv lub Pip + venv
- struktura projektu: cookiecutter
- PyTorch
- Tensorboard / MLFlow / wandb
- PyTorch Lightning
- MidiTok
- MusPy
- pretty_midi
- Git
- GitHub
- Huggingface
- GU, Albert; DAO, Tri. Mamba: Linear-time sequence modeling with selective state spaces. arXiv preprint arXiv:2312.00752, 2023.
- GU, Albert, et al. Combining recurrent, convolutional, and continuous-time models with linear state space layers. Advances in neural information processing systems, 2021, 34: 572-585.
- GU, Albert; GOEL, Karan; RÉ, Christopher. Efficiently modeling long sequences with structured state spaces. arXiv preprint arXiv:2111.00396, 2021.
- SMITH, Jimmy TH; WARRINGTON, Andrew; LINDERMAN, Scott W. Simplified state space layers for sequence modeling. arXiv preprint arXiv:2208.04933, 2022.
- VINAY, Ashvala; LERCH, Alexander. Evaluating generative audio systems and their metrics. arXiv preprint arXiv:2209.00130, 2022.
- YANG, Li-Chia; LERCH, Alexander. On the evaluation of generative models in music. Neural Computing and Applications, 2020, 32.9: 4773-4784.
- FRADET, Nathan, et al. MidiTok: A python package for MIDI file tokenization. arXiv preprint arXiv:2310.17202, 2023.
- Peiling Lu, Xin Xu, Chenfei Kang, Botao Yu, Chengyi Xing, Xu Tan, Jiang Bian, MuseCoco: Generating Symbolic Music from Text, arXiv preprint arXiv:2306.00110.pdf, 2023