patrickvonplaten commited on
Commit
1b691c7
1 Parent(s): 59b7c37

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +38 -16
README.md CHANGED
@@ -1,17 +1,32 @@
 
 
 
 
 
 
 
 
1
  ## FP32
2
 
3
  ```python
4
- # !pip install git+https://github.com/huggingface/diffusers.git
5
  from diffusers import DiffusionPipeline
6
- import scipy
7
 
8
  model_id = "harmonai/jmann-large-580k"
9
- pipeline = DiffusionPipeline.from_pretrained(model_id)
10
- pipeline = pipeline.to("cuda")
11
-
12
- audio = pipeline(audio_length_in_s=4.0).audios
13
-
14
- scipy.io.wavfile.write("maestro_test.wav", pipe.unet.sample_rate, audios)
 
 
 
 
 
 
 
15
  ```
16
 
17
  ## FP16
@@ -19,16 +34,23 @@ scipy.io.wavfile.write("maestro_test.wav", pipe.unet.sample_rate, audios)
19
  Faster at a small loss of quality
20
 
21
  ```python
22
- # !pip install git+https://github.com/huggingface/diffusers.git
23
  from diffusers import DiffusionPipeline
24
- import scipy
25
  import torch
26
 
27
  model_id = "harmonai/jmann-large-580k"
28
- pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
29
- pipeline = pipeline.to("cuda")
30
-
31
- audio = pipeline(audio_length_in_s=4.0).audios
32
-
33
- scipy.io.wavfile.write("maestro_test.wav", pipe.unet.sample_rate, audios)
 
 
 
 
 
 
 
34
  ```
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - audio-generation
5
+ ---
6
+
7
+ [Dance Diffusion](https://github.com/Harmonai-org/sample-generator) is now available in 🧨 Diffusers.
8
+
9
  ## FP32
10
 
11
  ```python
12
+ # !pip install diffusers[torch] accelerate scipy
13
  from diffusers import DiffusionPipeline
14
+ from scipy.io.wavfile import write
15
 
16
  model_id = "harmonai/jmann-large-580k"
17
+ pipe = DiffusionPipeline.from_pretrained(model_id)
18
+ pipe = pipe.to("cuda")
19
+
20
+ audios = pipe(audio_length_in_s=4.0).audios
21
+
22
+ # To save locally
23
+ for i, audio in enumerate(audios):
24
+ write(f"test_{i}.wav", pipe.unet.sample_rate, audio.transpose())
25
+
26
+ # To dislay in google colab
27
+ import IPython.display as ipd
28
+ for audio in audios:
29
+ display(ipd.Audio(audio, rate=pipe.unet.sample_rate))
30
  ```
31
 
32
  ## FP16
 
34
  Faster at a small loss of quality
35
 
36
  ```python
37
+ # !pip install diffusers[torch] accelerate scipy
38
  from diffusers import DiffusionPipeline
39
+ from scipy.io.wavfile import write
40
  import torch
41
 
42
  model_id = "harmonai/jmann-large-580k"
43
+ pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
44
+ pipe = pipe.to("cuda")
45
+
46
+ audios = pipeline(audio_length_in_s=4.0).audios
47
+
48
+ # To save locally
49
+ for i, audio in enumerate(audios):
50
+ write(f"{i}.wav", pipe.unet.sample_rate, audio.transpose())
51
+
52
+ # To dislay in google colab
53
+ import IPython.display as ipd
54
+ for audio in audios:
55
+ display(ipd.Audio(audio, rate=pipe.unet.sample_rate))
56
  ```