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

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
File Size Uploaded
fish_speech_lib-0.1.1.tar.gz 68.7 kB Details

Built distribution (wheel)

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

Total release size: 149.3 kB

Release files / fish_speech_lib-0.1.1.tar.gz

Download URL fish_speech_lib-0.1.1.tar.gz
Size 68.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ef24998d371294bb330149d90a26ed175ee6e61db15cebe4cd0cd97065ff2682
BLAKE2b-256 checksum
How to use checksums
128d8321dbf5b0bb41e49df1284ada5c8ec703940ba0f9c374683a53fe4f6b14
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-py3-none-any.whl

Download URL fish_speech_lib-0.1.1-py3-none-any.whl
Size 80.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad239de463b95bc8346d2fef4a837494f6fa35c7900ef9f216b7c0f3121c2c56
BLAKE2b-256 checksum
How to use checksums
e39ae6f561ddcd53c2e2c5c7be387269bb5fef45c54fa0887f999d19289c1cf2
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 This release

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