As the vocoder model has been changed, you need more VRAM than before, 12GB is recommended for fluently inference.
We support command line, HTTP API and WebUI for inference, you can choose any method you like.
First you need to download the model weights:
huggingface-cli download fishaudio/openaudio-s1-mini --local-dir checkpoints/openaudio-s1-mini
!!! note
If you plan to let the model randomly choose a voice timbre, you can skip this step.
python fish_speech/models/dac/inference.py \
-i "ref_audio_name.wav" \
--checkpoint-path "checkpoints/openaudio-s1-mini/codec.pth"
You should get a fake.npy and a fake.wav.
python fish_speech/models/text2semantic/inference.py \
--text "The text you want to convert" \
--prompt-text "Your reference text" \
--prompt-tokens "fake.npy" \
--compile
This command will create a codes_N file in the working directory, where N is an integer starting from 0.
!!! note
You may want to use `--compile` to fuse CUDA kernels for faster inference (~30 tokens/second -> ~500 tokens/second).
Correspondingly, if you do not plan to use acceleration, you can comment out the `--compile` parameter.
!!! info
For GPUs that do not support bf16, you may need to use the `--half` parameter.
!!! warning "Future Warning"
We have kept the interface accessible from the original path (tools/vqgan/inference.py), but this interface may be removed in subsequent releases, so please change your code as soon as possible.
python fish_speech/models/dac/inference.py \
-i "codes_0.npy" \
We provide a HTTP API for inference. You can use the following command to start the server:
python -m tools.api_server \
--listen 0.0.0.0:8080 \
--llama-checkpoint-path "checkpoints/openaudio-s1-mini" \
--decoder-checkpoint-path "checkpoints/openaudio-s1-mini/codec.pth" \
--decoder-config-name modded_dac_vq
If you want to speed up inference, you can add the
--compileparameter.
After that, you can view and test the API at http://127.0.0.1:8080/.
You can start the WebUI using the following command:
python -m tools.run_webui \
--llama-checkpoint-path "checkpoints/openaudio-s1-mini" \
--decoder-checkpoint-path "checkpoints/openaudio-s1-mini/codec.pth" \
--decoder-config-name modded_dac_vq
Or simply
python -m tools.run_webui
If you want to speed up inference, you can add the
--compileparameter.
!!! note
You can save the label file and reference audio file in advance to the `references` folder in the main directory (which you need to create yourself), so that you can directly call them in the WebUI.
!!! note
You can use Gradio environment variables, such as `GRADIO_SHARE`, `GRADIO_SERVER_PORT`, `GRADIO_SERVER_NAME` to configure WebUI.
Enjoy!