Views
No views yet
pip install soprano-tts1git clone https://github.com/ekwek1/soprano.git
2cd soprano
3pip install -e .[lmdeploy]1git clone https://github.com/ekwek1/soprano.git
2cd soprano
3pip install -e .⚠️ Warning: Windows CUDA users
On Windows with CUDA,pipwill install a CPU-only PyTorch build. To ensure CUDA support works as expected, reinstall PyTorch explicitly with the correct CUDA wheel after installing Soprano:bash1pip uninstall -y torch 2pip install torch==2.8.0 --index-url https://download.pytorch.org/whl/cu128
soprano-webui # hosted on http://127.0.0.1:7860 by defaultTip: You can increase cache size and decoder batch size to increase inference speed at the cost of higher memory usage. For example:soprano-webui --cache-size 1000 --decoder-batch-size 4
soprano "Soprano is an extremely lightweight text to speech model."
optional arguments:
--output, -o Output audio file path (non-streaming only). Defaults to 'output.wav'
--model-path, -m Path to local model directory (optional)
--device, -d Device to use for inference. Supported: auto, cuda, cpu, mps. Defaults to 'auto'
--backend, -b Backend to use for inference. Supported: auto, transformers, lmdeploy. Defaults to 'auto'
--cache-size, -c Cache size in MB (for lmdeploy backend). Defaults to 100
--decoder-batch-size, -bs Decoder batch size. Defaults to 1
--streaming, -s Enable streaming playback to speakersTip: You can increase cache size and decoder batch size to increase inference speed at the cost of higher memory usage.
Note: The CLI will reload the model every time it is called. As a result, inference speed will be slower than other methods.
uvicorn soprano.server:app --host 0.0.0.0 --port 80001curl http://localhost:8000/v1/audio/speech \
2 -H "Content-Type: application/json" \
3 -d '{
4 "input": "Soprano is an extremely lightweight text to speech model."
5 }' \
6 --output speech.wavNote: Currently, this endpoint only supports nonstreaming output.
1from soprano import SopranoTTS
2
3model = SopranoTTS(backend='auto', device='auto', cache_size_mb=100, decoder_batch_size=1)Tip: You can increase cache_size_mb and decoder_batch_size to increase inference speed at the cost of higher memory usage.
1# Basic inference
2out = model.infer("Soprano is an extremely lightweight text to speech model.") # can achieve 2000x real-time with sufficiently long input!
3
4# Save output to a file
5out = model.infer("Soprano is an extremely lightweight text to speech model.", "out.wav")
6
7# Custom sampling parameters
8out = model.infer(
9 "Soprano is an extremely lightweight text to speech model.",
10 temperature=0.3,
11 top_p=0.95,
12 repetition_penalty=1.2,
13)
14
15
16# Batched inference
17out = model.infer_batch(["Soprano is an extremely lightweight text to speech model."] * 10) # can achieve 2000x real-time with sufficiently large input size!
18
19# Save batch outputs to a directory
20out = model.infer_batch(["Soprano is an extremely lightweight text to speech model."] * 10, "/dir")
21
22
23# Streaming inference
24from soprano.utils.streaming import play_stream
25stream = model.infer_stream("Soprano is an extremely lightweight text to speech model.", chunk_size=1)
26play_stream(stream) # plays audio with <15 ms latency!LICENSE for details.