Code for Theme Transformer


  • using python version 3.6.8
  • install python dependencies:

    pip install -r requirements.txt

To train the model with GPU:

python --cuda

To generate music from theme

python --cuda --theme <theme midi file> --out_midi <output midi file>

Details of the files in this repo

├── ckpts                   For saving checkpoints while training
├── data_pkl                Stores train and val data
│   ├── train_seg2_512.pkl
│   └── val_seg2_512.pkl
├──            For generating music. (Detailed usage are written in the file)
├──               For logging
├──              The overal Theme Transformer Architecture
├──        Our transformer revision code 
├──            Some arguments for training
├── preprocess              For data preprocessing  
│   ├──       Theme Transformer pytorch dataset definition
│   └──            Our vocabulary for transformer
├──           For fixing random seed
├── readme.txt              Readme
├── tempo_dict.json         The original tempo information from POP909 (used in inference time)
├── theme_files/            The themes from our testing set.
├── trained_model           The model we trained.
│   └──
└──                Code for training Theme Transformer


Go to the Demo Page