Skip to content

[Bug] IndexTTS2 /v1/audio/speech returns 500 at WAV save: libtorchcodec cannot load in v2.12.0 Docker #5201

Description

@kvenLin

System Info / 系统信息

  • Host: Windows + Docker Desktop
  • Container OS: Ubuntu 22.04.5 LTS
  • GPU: NVIDIA GeForce RTX 5070 Ti, 16 GB
  • NVIDIA driver: 591.86
  • Image: xprobe/xinference:v2.12.0
  • Python: 3.12
  • PyTorch: 2.11.0+cu130
  • TorchAudio: 2.11.0+cu130
  • TorchCodec: 0.10.0
  • FFmpeg CLI: 6.1.2
  • SoundFile: 0.14.0

The IndexTTS2 model reaches READY and inference itself completes. The failure happens only when saving the generated waveform.

Running Xinference with Docker? / 是否使用 Docker 运行 Xinference?

  • docker / docker
  • pip install / 通过 pip install 安装
  • installation from source / 从源码安装

Version info / 版本信息

v2.12.0

The command used to start Xinference / 用以启动 Xinference 的命令

services:
  xinference:
    image: xprobe/xinference:v2.12.0
    gpus: all
    shm_size: "8gb"
    ports:
      - "127.0.0.1:9997:9997"
    environment:
      XINFERENCE_HOME: /data
      XINFERENCE_ENABLE_VIRTUAL_ENV: "1"
    command: ["xinference-local", "-H", "0.0.0.0"]

Reproduction / 复现过程

  1. Start the v2.12.0 Docker image.
  2. Launch IndexTTS2 and wait until the replica is READY.
  3. Open its launch UI, provide a valid WAV speaker prompt and text such as 你好测试一下.
  4. Generate speech, or call POST /v1/audio/speech.
  5. IndexTTS2 runs inference, reaches the final "saving audio..." stage, then the endpoint returns HTTP 500.

Relevant call path:

xinference/model/audio/indextts2.py::speech
  -> thirdparty/indextts/infer_v2.py::infer
  -> torchaudio.save(output_path, wav.type(torch.int16), sampling_rate)
  -> torchaudio.save_with_torchcodec
  -> import torchcodec.encoders.AudioEncoder
  -> Could not load libtorchcodec

The main error is:

RuntimeError: Could not load libtorchcodec

FFmpeg version 6:
OSError: libavutil.so.58: cannot open shared object file: No such file or directory

FFmpeg version 4:
OSError: libtorchcodec_core4.so: undefined symbol:
_ZN3c1013MessageLoggerC1EPKciib

ldd /usr/local/lib/python3.12/dist-packages/torchcodec/libtorchcodec_core6.so reports:

libtorch.so => not found
libc10.so => not found
libavutil.so.58 => not found
libavcodec.so.60 => not found
libavformat.so.60 => not found
libtorch_cpu.so => not found

The container's ffmpeg -version command works, but TorchCodec cannot resolve the corresponding shared libraries. There also appears to be a TorchCodec/PyTorch ABI mismatch for the fallback core library.

Full request ends with:

POST /v1/audio/speech HTTP/1.1" 500

Expected behavior / 期待表现

IndexTTS2 should return the generated WAV/audio response successfully after inference.

Analysis / 建议

The generated waveform already exists before the failure. This issue is specific to the output serialization path. A narrowly scoped fix would be to avoid TorchCodec for this IndexTTS2 WAV write and use soundfile.write (already installed in the image), or ensure the image ships a TorchCodec build and FFmpeg shared-library paths compatible with torch==2.11.0+cu130.

For example, replacing the final torchaudio.save call with an int16 SoundFile write avoids changing the inference path and avoids impacting other models that may depend on TorchCodec.

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggpustale

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions