Views
No views yet
pip install torch torchaudio "transformers<5" einopsTested with Python 3.10, torch 2.8.0+cu128, transformers 4.57. Not compatible with transformers 5.x.
<|caption|> tag, which provides the overall scene description. Other tags are optional and can be included as needed.| Tag | Description | Required |
|---|---|---|
<|caption|> | Overall audio scene description | Yes |
<|speech|> | Speaker identity and speaking style | No |
<|asr|> | Spoken transcript / dialogue | No |
<|sfx|> | Sound effects | No |
<|music|> | Background music | No |
<|env|> | Environmental ambience | No |
<|caption|> — prompts without it will be rejected.<|music|> if there is no music).Multilingual note: When using the multilingual model, all descriptive tags (caption,speech,sfx,music,env) should be in English. Only the<|asr|>field (the actual speech content to synthesize) uses the target language.
caption field is required; all other fields are optional.1import torchaudio
2from transformers import AutoModel
3
4model = AutoModel.from_pretrained("mispeech/Dasheng-AudioGen", trust_remote_code=True).cuda()
5
6prompt = model.compose_prompt(
7 caption="A gritty detective narrating over the sound of heavy rain and a melancholic solo jazz saxophone.",
8 speech="gritty deep male voice",
9 music="melancholic solo saxophone",
10 env="distant urban ambience",
11 sfx="heavy rain hitting pavement",
12 asr="The city never sleeps, but it sure knows how to cry.",
13)
14audio = model.generate(prompt)
15torchaudio.save("output.wav", audio.cpu(), 16000)prompt parameter. The string must start with <|caption|>.1import torchaudio
2from transformers import AutoModel
3
4model = AutoModel.from_pretrained("mispeech/Dasheng-AudioGen", trust_remote_code=True).cuda()
5
6prompt = model.compose_prompt(
7 prompt="<|caption|> A gritty detective narrating over the sound of heavy rain and a melancholic solo jazz saxophone. <|speech|> gritty deep male voice <|asr|> The city never sleeps, but it sure knows how to cry. <|sfx|> heavy rain hitting pavement <|music|> melancholic solo saxophone <|env|> distant urban ambience"
8)
9audio = model.generate(prompt)
10torchaudio.save("output.wav", audio.cpu(), 16000)1import torchaudio
2from transformers import AutoModel
3
4model = AutoModel.from_pretrained("mispeech/Dasheng-AudioGen", trust_remote_code=True).cuda()
5
6prompts = [
7 model.compose_prompt(caption="A cat meowing softly.", sfx="Soft cat meow."),
8 model.compose_prompt(caption="Thunder rolling in the distance.", env="Stormy night ambience."),
9 model.compose_prompt(caption="A piano playing a gentle melody.", music="Soft piano ballad."),
10]
11audios = model.generate(prompts)
12
13for i, audio in enumerate(audios):
14 torchaudio.save(f"output_{i}.wav", audio.unsqueeze(0).cpu(), 16000)1import torchaudio
2from transformers import AutoModel
3
4model = AutoModel.from_pretrained("mispeech/Dasheng-AudioGen", trust_remote_code=True).cuda()
5
6prompt = model.compose_prompt(caption="A dog barking in a park")
7audio = model.generate(
8 prompts=prompt,
9 num_steps=25, # number of denoising steps (default: 25)
10 guidance_scale=5.0, # classifier-free guidance scale (default: 5.0)
11 sway_sampling_coef=-1.0, # sway sampling coefficient (default: -1.0, 0 for linear)
12)
13torchaudio.save("output.wav", audio.cpu(), 16000)1@article{mei2026dashengaudiogen,
2 title = {Dasheng AudioGen: A Unified Model for Generating Coherent Audio Scenes from Text},
3 author = {Jiahao Mei and Heinrich Dinkel and Yadong Niu and Xingwei Sun and Gang Li and Yifan Liao and Jiahao Zhou and Junbo Zhang and Jian Luan and Mengyue Wu},
4 journal = {arXiv preprint arXiv:2605.27838},
5 year = {2026}
6}