Akjava commited on
Commit
69defd6
·
verified ·
1 Parent(s): b585533

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +118 -1
README.md CHANGED
@@ -1,3 +1,120 @@
1
  ---
2
- license: artistic-2.0
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: apache-2.0
3
+ tags:
4
+ - music
5
  ---
6
+ ## What is this
7
+ A dataset of 50 instrumental music tracks generated with the DiffRhythm model, using 10 CC0-licensed instrument samples from OEPN Game Art.
8
+ ## Models
9
+ This dataset was created by running the DiffRhythm model on 2025 Mar 05 using a copy of the space available at https://huggingface.co/spaces/ASLP-lab/DiffRhythm.
10
+ The exact architecture (base or VAE) of the DiffRhythm model used is not explicitly specified in the original source.
11
+
12
+ ## Input Audios
13
+ All input audio are licensed under CC0
14
+ you can find audio infos from
15
+ https://opengameart.org/
16
+
17
+ ## Generated Audios
18
+ generated default setting without lyrics
19
+
20
+ ## License
21
+ DiffRhythm is under Apache2.0.
22
+ This audio and scripts is under same license.
23
+
24
+ ## Scripts
25
+ *From command line*
26
+ ```
27
+ import os
28
+ import shutil
29
+ import time
30
+
31
+ from dotenv import load_dotenv
32
+ from smolagents import Tool
33
+
34
+ load_dotenv()
35
+ token = os.getenv("HF_TOKEN")
36
+ music_generation_tool = Tool.from_space(
37
+ "{Your Duplicated Space}/DiffRhythm",
38
+ name="DiffRhythm",
39
+ description="generate music",
40
+ token=token,
41
+ api_name="/infer_music", # usually start with /
42
+ )
43
+
44
+
45
+ def generate_music(prompt, output):
46
+ result = music_generation_tool("", prompt)
47
+ print(result, output)
48
+ copy_file(result, output)
49
+
50
+
51
+ def copy_file(source, destination):
52
+ try:
53
+ shutil.copy2(source, destination)
54
+ print(f"File '{source}' copied to '{destination}' successfully.")
55
+ except FileNotFoundError:
56
+ print(f"Error: Source file '{source}' not found.")
57
+ except PermissionError:
58
+ print(f"Error: Permission denied while copying to '{destination}'.")
59
+ except Exception as e:
60
+ print(f"An unexpected error occurred: {e}")
61
+
62
+
63
+ def get_not_exist_filename(filename, always_add_number=False):
64
+ base, ext = os.path.splitext(filename)
65
+
66
+ if not always_add_number:
67
+ if not os.path.exists(filename):
68
+ return filename
69
+
70
+ counter = 1
71
+ while True:
72
+ new_filename = f"{base}_{counter}{ext}"
73
+ if not os.path.exists(new_filename):
74
+ return new_filename
75
+ counter += 1
76
+
77
+
78
+ ouput_dir = "musics"
79
+ max_iteration = 5
80
+ os.makedirs(ouput_dir, exist_ok=True)
81
+ print("start")
82
+
83
+ input_audios = [
84
+ "funkydiscobeatstoboogieslashwoogieto.wav",
85
+ ]
86
+
87
+ for input in input_audios:
88
+ try:
89
+ for i in range(max_iteration):
90
+ generate_music(
91
+ input,
92
+ get_not_exist_filename(
93
+ os.path.join(ouput_dir, input.replace(".mp3", ".wav")), True
94
+ ),
95
+ )
96
+
97
+ except Exception as e:
98
+ print(f"sleep {e}")
99
+ time.sleep(3)
100
+
101
+ ```
102
+
103
+ *Groq version space code changed*
104
+ ```
105
+ def R1_infer1(theme, tags_gen, language):
106
+ try:
107
+ client = OpenAI(api_key=os.getenv('GROQ_API_KEY'), base_url = "https://api.groq.com/openai/v1")
108
+
109
+ response = client.chat.completions.create(
110
+ model="llama-3.3-70b-versatile",
111
+
112
+ def R1_infer2(tags_lyrics, lyrics_input):
113
+ client = OpenAI(api_key=os.getenv('GROQ_API_KEY'), base_url = "https://api.groq.com/openai/v1")
114
+
115
+ response = client.chat.completions.create(
116
+ model="llama-3.3-70b-versatile",
117
+ ```
118
+ ## References
119
+
120
+ [1] Ziqian Ning, Huakang Chen, Yuepeng Jiang, Chunbo Hao, Guobin Ma, Shuai Wang, Jixun Yao, Lei Xie. DiffRhythm: Blazingly Fast and Embarrassingly Simple End-to-End Full-Length Song Generation with Latent Diffusion. arXiv preprint arXiv:2503.01183 (2025). Available from: https://arxiv.org/abs/2503.01183