Skip to content

fix(faster-whisper): cast segment timestamps to int after multiplication#9674

Merged
mudler merged 1 commit into
mudler:masterfrom
arteven:fix/faster-whisper-segment-int-conversion
May 5, 2026
Merged

fix(faster-whisper): cast segment timestamps to int after multiplication#9674
mudler merged 1 commit into
mudler:masterfrom
arteven:fix/faster-whisper-segment-int-conversion

Conversation

@arteven
Copy link
Copy Markdown
Contributor

@arteven arteven commented May 5, 2026

Summary

Every audio transcription request through the faster-whisper backend currently fails with:

TypeError: 'float' object cannot be interpreted as an integer

Root cause

In backend/python/faster-whisper/backend.py:

backend_pb2.TranscriptSegment(id=id, start=int(segment.start)*1e9, end=int(segment.end)*1e9, ...)

int(x) * 1e9 produces a float because 1e9 is a float literal in Python. The protobuf TranscriptSegment.start / .end fields are integers, so the gRPC call raises a TypeError and the whole request fails.

Fix

Multiply first, then cast to int — int(x * 1e9). One-character-positions changed.

Test plan

  • Reproduced the bug locally with Systran/faster-whisper-tiny on v4.1.3 — every request returns 'float' object cannot be interpreted as an integer.
  • Verified the patched backend transcribes audio successfully end-to-end via /v1/audio/transcriptions.
  • CI passes.

`int(x) * 1e9` returns a float because `1e9` is a float literal, but
TranscriptSegment.start/end are integer protobuf fields. This caused
every transcription request to fail with:

  TypeError: 'float' object cannot be interpreted as an integer

Multiply first, then cast — `int(x * 1e9)` — to get an int as required.
@mudler mudler merged commit 503904d into mudler:master May 5, 2026
51 of 52 checks passed
@arteven arteven deleted the fix/faster-whisper-segment-int-conversion branch May 5, 2026 21:48
@localai-bot localai-bot added the bug Something isn't working label May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants