| --- |
| 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 |