File size: 3,613 Bytes
2be7bd4
 
 
 
 
 
 
 
69defd6
 
2be7bd4
 
 
 
69defd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
---
license: apache-2.0
tags:
- music
task_categories:
- audio-to-audio
---

## What is this
A dataset of 50 instrumental music tracks generated with the DiffRhythm model, using 10 CC0-licensed instrument samples from OEPN Game Art.

Paper: https://huggingface.co/papers/2503.01183
Project page: https://nzqian.github.io/DiffRhythm/

## Models
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.
The exact architecture (base or VAE) of the DiffRhythm model used is not explicitly specified in the original source.

## Input Audios
All input audio are licensed under CC0
you can find  audio infos from 
https://opengameart.org/

## Generated Audios
generated default setting without lyrics

## License
DiffRhythm is under Apache2.0.
This audio and scripts is under same license.

## Scripts
*From command line*
```
import os
import shutil
import time

from dotenv import load_dotenv
from smolagents import Tool

load_dotenv()
token = os.getenv("HF_TOKEN")
music_generation_tool = Tool.from_space(
    "{Your Duplicated Space}/DiffRhythm",
    name="DiffRhythm",
    description="generate music",
    token=token,
    api_name="/infer_music",  # usually start with /
)


def generate_music(prompt, output):
    result = music_generation_tool("", prompt)
    print(result, output)
    copy_file(result, output)


def copy_file(source, destination):
    try:
        shutil.copy2(source, destination)
        print(f"File '{source}' copied to '{destination}' successfully.")
    except FileNotFoundError:
        print(f"Error: Source file '{source}' not found.")
    except PermissionError:
        print(f"Error: Permission denied while copying to '{destination}'.")
    except Exception as e:
        print(f"An unexpected error occurred: {e}")


def get_not_exist_filename(filename, always_add_number=False):
    base, ext = os.path.splitext(filename)

    if not always_add_number:
        if not os.path.exists(filename):
            return filename

    counter = 1
    while True:
        new_filename = f"{base}_{counter}{ext}"
        if not os.path.exists(new_filename):
            return new_filename
        counter += 1


ouput_dir = "musics"
max_iteration = 5
os.makedirs(ouput_dir, exist_ok=True)
print("start")

input_audios = [
    "funkydiscobeatstoboogieslashwoogieto.wav",
]

for input in input_audios:
    try:
        for i in range(max_iteration):
            generate_music(
                input,
                get_not_exist_filename(
                    os.path.join(ouput_dir, input.replace(".mp3", ".wav")), True
                ),
            )

    except Exception as e:
        print(f"sleep {e}")
        time.sleep(3)

```

*Groq version space code changed*
```
def R1_infer1(theme, tags_gen, language):
    try:
        client = OpenAI(api_key=os.getenv('GROQ_API_KEY'), base_url = "https://api.groq.com/openai/v1")

        response = client.chat.completions.create(
            model="llama-3.3-70b-versatile",

def R1_infer2(tags_lyrics, lyrics_input):
    client = OpenAI(api_key=os.getenv('GROQ_API_KEY'), base_url = "https://api.groq.com/openai/v1")

    response = client.chat.completions.create(
        model="llama-3.3-70b-versatile",
```
## References

[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