Dasheng-AudioGen / README.md
jiahaomei's picture
feat: run Dasheng AudioGen inference locally
8f0cc43
|
Raw
History Blame Contribute Delete
2.52 kB
---
title: Dasheng Mix Audiogen
emoji: ๐Ÿƒ
colorFrom: green
colorTo: indigo
sdk: gradio
sdk_version: 6.5.1
app_file: app.py
pinned: false
license: apache-2.0
short_description: Generate mix audio contains audio,speech and music.
python_version: "3.10.13"
models:
- mispeech/Dasheng-AudioGen
preload_from_hub:
- mispeech/Dasheng-AudioGen
- mispeech/dashengtokenizer
- google/flan-t5-large config.json,model.safetensors,spiece.model,tokenizer.json,tokenizer_config.json,special_tokens_map.json
---
# Dasheng AudioGen Space
This Gradio Space loads
[`mispeech/Dasheng-AudioGen`](https://huggingface.co/mispeech/Dasheng-AudioGen)
and performs audio generation on the Space GPU. It does not call an external
audio-generation API.
## Hugging Face deployment
1. Select **ZeroGPU** or a dedicated CUDA GPU in the Space hardware settings.
ZeroGPU requires a Hugging Face PRO account for personal Spaces.
2. Push this repository to the Space. The model, audio tokenizer, and Flan-T5
text encoder are preloaded during the build.
3. Configure Prompt Refiner secrets if Auto Mode is required:
- Default XI mode: `XI_API_KEY`; optionally `XI_MODEL_NAME`.
- OpenAI-compatible mode: `PROMPT_REFINER_MODE=openai`, `API_KEY`,
`MODEL_NAME`, and `LLM_BASE_URL`.
- CLAW mode: `PROMPT_REFINER_MODE=claw` and `CLAW_API_URL`.
Manual Mode does not require a Prompt Refiner secret.
## Local test
The model has been tested in the `dsag` Conda environment:
```bash
conda activate dsag
pip install "gradio==6.5.1" "openai>=1,<3"
python app.py
```
On the current AArch64 test host, preload scikit-learn's bundled OpenMP library
if Python reports `cannot allocate memory in static TLS block`:
```bash
export LD_PRELOAD="$CONDA_PREFIX/lib/python3.11/site-packages/scikit_learn.libs/libgomp-a49a47f9.so.1.0.0"
python app.py
```
The local model runtime can be adjusted with these optional variables:
| Variable | Default | Description |
|---|---:|---|
| `AUDIOGEN_MODEL_ID` | `mispeech/Dasheng-AudioGen` | Hub model ID or local snapshot path |
| `AUDIOGEN_DEVICE` | `cuda` | PyTorch inference device |
| `AUDIOGEN_DTYPE` | `float32` | `float32`, `float16`, or `bfloat16` |
| `AUDIOGEN_NUM_STEPS` | `25` | Denoising steps |
| `AUDIOGEN_GUIDANCE_SCALE` | `5.0` | Classifier-free guidance scale |
| `AUDIOGEN_SWAY_SAMPLING_COEF` | `-1.0` | Sway sampling coefficient |
| `AUDIOGEN_LOCAL_FILES_ONLY` | `0` | Set to `1` for offline cache-only loading |
| `AUDIOGEN_OUTPUT_DIR` | `outputs` | Generated WAV directory |