jaswon / osu-dreamer

a diffusion-based ML model for generating osu! maps from raw audio
MIT License
119 stars 10 forks source link
beatmap-creator beatmap-parser machine-learning osu osugame torch

osu!dreamer - an ML model for generating maps from raw audio

image

osu!dreamer is a generative model for osu! beatmaps based on diffusion

Quick start

colab notebook (no installation required)

Installation for development

Required dependencies

Clone this repo, then run:

poetry install

This will install osu-dreamer's dependencies

Generate your own maps locally

$ poetry run python -m osu_dreamer.model predict --help
Usage: python -m osu_dreamer.model predict [OPTIONS]

  generate osu!std maps from raw audio

Options:
  --model_path FILE       trained model (.ckpt)
  --audio_file FILE       audio file to map
  --sample-steps INTEGER  number of diffusion steps to sample
  --num_samples INTEGER   number of maps to generate
  --title TEXT            Song title - required if it cannot be determined
                          from the audio metadata
  --artist TEXT           Song artist - required if it cannot be determined
                          from the audio metadata
  --help                  Show this message and exit.

Model training

Generate dataset

first you must generate a dataset, using eg. your osu!/Songs directory. This step only needs to be done once (unless you delete the generated dataset directory).

$ poetry run python -m osu_dreamer.model generate-data [MAPS_DIR]

where [MAPS_DIR] is the path to eg. your osu!/Songs directory

Training

after the dataset generation completes, you can start training

$ poetry run python -m osu_dreamer.model fit

See osu_dreamer/model/model.yml for all training parameters.

At the end of every epoch, the model parameters will be checkpointed to lightning_logs/version_{NUM}/checkpoints/epoch={EPOCH}-step={STEP}.ckpt. You can resume training from a saved checkpoint by adding --ckpt-path [PATH TO CHECKPOINT] to the fit command.

run tensorboard --logdir=lightning_logs/ in a new window to track training progress in Tensorboard

visual validation

image

The training process will generate one plot at the end of every epoch, using a sample from the validation set

💻 Windows Batch Setup

⚠️ Support for training/evaluating the model locally on Windows is highly experimental and provided as-is

Requirements

Installation

Install the source code directly through github, or with the git clone command:

git clone https://github.com/jaswon/osu-dreamer

Usage

Setup from this point is pretty simple, navigate into the osu-dreamer directory and then into the windows_scripts folder, this is where all the batch scripts are stored.

First, you will need to run ! Install.bat, this will install osu-dreamer and all of its dependencies. Optionally you can install tensorboard and mathplotlib to view training statistics.

Now you're ready to begin training your own model! Here is a list of all the scripts and their functionality