## FP32 ```python # !pip install git+https://github.com/huggingface/diffusers.git from diffusers import DiffusionPipeline import scipy model_id = "harmonai/maestro-150k" pipeline = DiffusionPipeline.from_pretrained(model_id) pipeline = pipeline.to("cuda") audios = pipeline(audio_length_in_s=4.0).audios # To save locally for audio in audios: scipy.io.wavfile.write("maestro_test.wav", pipe.unet.sample_rate, audio.transpose()) # To dislay in google colab import IPython.display as ipd for audio in audios: display(ipd.Audio(audio, rate=pipe.unet.sample_rate)) ``` ## FP16 Faster at a small loss of quality ```python # !pip install git+https://github.com/huggingface/diffusers.git from diffusers import DiffusionPipeline import scipy import torch model_id = "harmonai/maestro-150k" pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16) pipeline = pipeline.to("cuda") audios = pipeline(audio_length_in_s=4.0).audios # To save locally for audio in audios: scipy.io.wavfile.write("maestro_test.wav", pipe.unet.sample_rate, audio.transpose()) # To dislay in google colab import IPython.display as ipd for audio in audios: display(ipd.Audio(audio, rate=pipe.unet.sample_rate)) ```