Skip to content

Generation

Cade Stocker edited this page Nov 30, 2025 · 16 revisions

dataset of midi files (1)

Example

python generate.py --model_path <path to model checkpoint> --model_type <type> --dataset <path to preprocessed data dir>

Refer to this wiki page for model types.

Arguments

  • --model_path: path to trained model checkpoint (required)
  • --model_type: architecture of the model (gru, lstm, etc.) (strongly suggested)
  • --data_dir: path to the directory holding the preprocessed data (required)
  • --seq_length: input sequence length (must match training)
  • --generate_length: how many tokens to generate
  • --temperature: sampling temperature
  • --k: top k value for top k sampling
  • --p: top p value for top p sampling
  • --strategy: sampling strategy (greedy, top_k, top_p, random)

Discriminator Guidance (Optional)

**Please visit this wiki page to see a high-level description of the discriminator's role in generation.

  • --discriminator_path: path to trained discriminator model
  • --discriminator_type: type of architecture of the discriminator being used
  • --guidance_strength: strength of guidance from the discriminator during generation (default 0.5)
  • --context_measures: number of measures used as context for the discriminator

Seed Selection (optional)

View this for more information.

Seed File (1)

  • --seed_file: path to the MIDI file you want to use as a seed (the file must be in the preprocessed data)
    • if I have time, I will change this where you can import any MIDI file you want and use it as a seed
  • --seed_midi_file: THIS IS THE PATH TO THE FILE YOU WANT TO USE AS A SEED!! USE THIS FOR MIDI FILES THAT WEREN'T IN THE DATASET!!
  • --seed_style: pick whether to use random seed, or smart seed selection (random, smart)
    • pick a seed by different qualities, which is different than using a seed_file!!!!!
  • --pitch_preference: desired pitch range (low, medium, high)
  • --complexity: number of unique pitches (simple, medium, complex)
  • --seed_length: length of seed (short, medium, long)
  • --seed_midi_file: path to the midi file you want to use as a seed (uses data_dir to tokenize the seed midi)

Description

Generate MIDI files using your chosen model and generation methods. MIDI files are automatically evaluated and logged after being created so that you can easily collect and maintain data about model output.

Clone this wiki locally