Run this model with HF Jobs
Run google/music-spectrogram-diffusion on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/google/music-spectrogram-diffusion. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/google/music-spectrogram-diffusion on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use google/music-spectrogram-diffusion with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use google/music-spectrogram-diffusion with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("google/music-spectrogram-diffusion", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Update README.md
#1
by kashif HF Staff - opened
15 unmodified lines16171819202122232425262728293015 unmodified lines<img src="https://storage.googleapis.com/music-synthesis-with-spectrogram-diffusion/architecture.png" alt="Architecture diagram">## Example usage```pythonfrom diffusers import SpectrogramDiffusionPipelinepipe = SpectrogramDiffusionPipeline.from_pretrained("kashif/music-spectrogram-diffusion")pipe = pipe.to("cuda")output = pipe("beethoven_hammerklavier_2.mid")audio = output.audios[0]```15 unmodified lines16171819202122232425262728293031323334353615 unmodified lines<img src="https://storage.googleapis.com/music-synthesis-with-spectrogram-diffusion/architecture.png" alt="Architecture diagram">## ModelAs depicted above the model takes as input a MIDI file and tokenizes it into a sequence of 5 second intervals. Each tokenized interval then together with positional encodings is passed through the Note Encoder and its representation is concatenated with the previous window's generated spectrogram representation obtained via the Context Encoder. For the initial 5 second window this is set to zero. The resulting context is then used as conditioning to sample the denoised Spectrogram from the MIDI window and we concatenate this spectrogram to the final output as well as use it for the context of the next MIDI window. The process repeats till we have gone over all the MIDI inputs. Finally a MelGAN decoder converts the potentially long spectrogram to audio which is the final result of this pipeline.## Example usage```pythonfrom diffusers import SpectrogramDiffusionPipeline, MidiProcessorpipe = SpectrogramDiffusionPipeline.from_pretrained("google/music-spectrogram-diffusion")pipe = pipe.to("cuda")processor = MidiProcessor()# Download MIDI from: wget http://www.piano-midi.de/midis/beethoven/beethoven_hammerklavier_2.midoutput = pipe(processor("beethoven_hammerklavier_2.mid"))audio = output.audios[0]```
README.md+9-3