Skip to main content

Fish-Speech-Lib 0.1.1

Fish-Speech-Lib provides a Python interface to the Fish Speech inference pipeline for text-to-speech and voice cloning, without requiring the Fish Speech web UI.

Upstream project: fishaudio/fish-speech

Release notes

0.1.1 - September 30, 2026: Added MultiGPU support through separate instances on cuda:0, cuda:1, etc.; device-aware model caches and sampling; scoped torch.compile; explicit worker cleanup with close() / context managers; compact device setup JSON in the system temp folder.

Requirements

  • Python 3.10 or newer.
  • PyTorch installed separately for the accelerator you intend to use.
  • CUDA is recommended for NVIDIA GPUs; CPU and MPS are supported by the library's device routing, although performance and feature support vary by backend.

Installation

Install PyTorch for your platform first, then install the library:

pip install fish_speech_lib

When running directly from the source tree, add the repository root to PYTHONPATH or sys.path. A .project-root marker is not required.

Basic usage

from fish_speech_lib import FishSpeech
import soundfile as sf

with FishSpeech(device="cuda", compile_model=False) as tts:
    sample_rate, audio = tts(
        text="Hello, world!",
        max_new_tokens=450,
    )

sf.write("output.wav", audio, sample_rate)

Device selection

device accepts normal PyTorch device strings. In a multi-GPU process, pass an explicit CUDA index when placement matters:

tts = FishSpeech(device="cuda:1")

A bare "cuda" selects the first visible CUDA device (cuda:0). Explicit indices such as "cuda:1" are preserved throughout the library's model, cache, sampling, and decoder paths.

MultiGPU usage

Create a separate instance for each GPU and send requests to the instance you want to use. Each GPU holds its own model and caches.

from concurrent.futures import ThreadPoolExecutor
import soundfile as sf
from fish_speech_lib import FishSpeech

with FishSpeech(device="cuda:0") as first, FishSpeech(device="cuda:1") as second:
    with ThreadPoolExecutor(max_workers=2) as pool:
        jobs = [
            pool.submit(first, text="First request."),
            pool.submit(second, text="Second request."),
        ]
        for index, job in enumerate(jobs):
            sample_rate, audio = job.result()
            sf.write(f"output-{index}.wav", audio, sample_rate)

You can enable compile_model=True on each instance. Use close() when you manage instances without a with block.

Voice cloning

from fish_speech_lib import FishSpeech

with FishSpeech(device="cuda:0") as tts:
    sample_rate, audio = tts(
        text="This is an example of voice cloning.",
        reference_audio="path/to/reference.wav",
        reference_audio_text="The text spoken in the reference audio.",
        max_new_tokens=1000,
    )

torch.compile

Set compile_model=True to compile the token decode path with torch.compile. Compilation is lazy, so the first inference can take substantially longer than later calls. CUDA compilation is invoked inside the selected model device context; the library does not remap CUDA_VISIBLE_DEVICES or install process-wide Torch/Inductor monkey patches.

Model downloads

If the default Fish Speech 1.5 checkpoints are missing, the library downloads them from fishaudio/fish-speech-1.5 on Hugging Face.

License

The source code in this repository is distributed under the Apache License 2.0. See LICENSE. Files derived from Fish Speech retain Fish Audio attribution, and files modified by this project carry modification notices.

The Fish Speech 1.5 model weights downloaded from Hugging Face are separate assets and are licensed separately under CC BY-NC-SA 4.0. The repository's Apache-2.0 license does not relicense those model weights.

  • Original Fish Speech code: Copyright 2024-2025 Fish Audio Authors.
  • Fish-Speech-Lib modifications: Copyright 2025-2026 Atm4x.

Metadata

Release files for fish-speech-lib 0.1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fish-speech-lib 0.1.1.1
File Size Uploaded
fish_speech_lib-0.1.1.1.tar.gz 68.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fish-speech-lib 0.1.1.1
File Interpreter ABI Platform
fish_speech_lib-0.1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 149.5 kB

Release files / fish_speech_lib-0.1.1.1.tar.gz

Download URL fish_speech_lib-0.1.1.1.tar.gz
Size 68.8 kB
Tags Source
SHA-256 checksum
How to use checksums
34eeeaa4803250bf19d7c19d4b17de8220d93cf2921300dacb3c8bcaf22789b9
BLAKE2b-256 checksum
How to use checksums
24268f2fba24c2a8e7af21e02c2b09129d09f16a5891997e62dd305001f6a5ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / fish_speech_lib-0.1.1.1-py3-none-any.whl

Download URL fish_speech_lib-0.1.1.1-py3-none-any.whl
Size 80.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04b95524b3169d952296081056a3b10371a3313c7524fe3b2926e6adad66842b
BLAKE2b-256 checksum
How to use checksums
09c7b3684ceafa8ae310a8686da174c032b0c9d78540609c0dc7e977a3988f8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.1.1.1 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page