salmon-fish
Built with Fish Audio
A small, inspectable Python API for Fish Audio S2-Pro text-to-speech with real weights. It reuses the official model layers, KV cache, sampler and DAC codec, with no SGLang or server. It is meant for teaching: you can watch every step from reference audio to tokens, prompt, Dual-AR generation and back to audio.
Install
pip install salmon-fish # Python 3.11–3.13, torch/torchaudio 2.11.0
To pick a CUDA build, install torch/torchaudio first, following PyTorch's instructions. Model weights (about 11 GB) are downloaded from Hugging Face on first use, at a pinned revision.
Quick start
from salmon_fish import S2Pro
tts = S2Pro.from_pretrained() # downloads fishaudio/s2-pro, then reuses the cache
tts.infer("こんにちは、音声合成のテストです。", "hello.wav")
Voice cloning (in-context learning). Give a reference recording plus its exact transcript:
reference = tts.encode_reference("reference.wav", transcript="The exact words spoken in reference.wav.")
tts.infer("A new sentence in the same voice.", "new.wav", reference=reference)
Tone instructions. Put a [tag] in the text, for example "[whispering]本当ですか。".
Inspect the internals. Pass a callback to see each stage of every frame: fusion, slow logits, semantic/RAS sampling, and each fast-AR codebook:
def inspect(event):
if event.frame_index == 0:
print(event.stage, event.codebook_index, {k: tuple(v.shape) for k, v in event.tensors.items()})
tts.infer("こんにちは。", "out.wav", on_event=inspect)
CLI
salmon-fish download --local-dir checkpoints/s2-pro
salmon-fish infer "こんにちは。" --output hello.wav --model checkpoints/s2-pro
salmon-fish infer "新しい文章です。" --output new.wav \
--reference-audio ref.wav --reference-text "参照音声の正確な文字起こし。"
Run salmon-fish infer --help to see the sampling, device, cache and offline options.
Learn more
- tutorials/: four experiments that show how S2-Pro works, using Japanese ICL (Traditional Chinese)
- docs/teaching.md: Dual-AR step by step
- docs/architecture.md: prompt layout, components and GPU checks
- src/salmon_fish/ar.py: the single-frame decoder, the core of the teaching code
Development
uv sync --locked
uv run ruff check src tests examples scripts
uv run python -m unittest discover -s tests
uv run python tests/smoke_checkpoint.py --model checkpoints/s2-pro # optional: GPU + weights
License
The integration code is MIT. The vendored Fish Speech code and the adapted decoder in
ar.py are under the Fish Audio Community License.
S2-Pro weights are under the
Fish Audio Research License.
Metadata
Release files for salmon-fish 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| salmon_fish-0.1.1.tar.gz | 245.2 kB | Without provenance | Details for salmon_fish-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| salmon_fish-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for salmon_fish-0.1.1-py3-none-any.whl |
Total release size: 349.0 kB
Release files / salmon_fish-0.1.1.tar.gz
| Download URL | salmon_fish-0.1.1.tar.gz |
|---|---|
| Size | 245.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20c6b116999d5f5d98db087b7023a125ce83e1ced4f7d0aa3eb05b7c9b2ef7a9
|
|
BLAKE2b-256 checksum How to use checksums |
2ecfdc75f7bb89586365cc347ef0d05f452d1dc83b235dd96e61415909bf360d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.3
|
Release files / salmon_fish-0.1.1-py3-none-any.whl
| Download URL | salmon_fish-0.1.1-py3-none-any.whl |
|---|---|
| Size | 103.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
250de31fa6fc9c08a5d190f6ab7d136e608ff2a81104afac6d171b86aff2b39d
|
|
BLAKE2b-256 checksum How to use checksums |
96ebf8fb5da4d9458b4a194dff47270ec73f6e4e6a83155e80ad47eb34df0ccb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.3
|
Security for salmon-fish 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.