Skip to content

fix(insane): bump transformers to 4.55.4 for Whisper timestamp fixes - #83

Merged
zackees merged 1 commit into
mainfrom
fix/transformers-pin-whisper-timestamps
May 30, 2026
Merged

zackees merged 1 commit into
mainfrom
fix/transformers-pin-whisper-timestamps

Conversation

@zackees

@zackees zackees commented May 30, 2026

Copy link
Copy Markdown
Owner

Summary

Bumps the transformers pin in the --device insane venv from 4.46.3 (Oct 2024) to 4.55.4 to pick up the upstream Whisper-timestamp fixes that landed between then and now.

Why

The HF transformers Whisper pipeline (which --device insane ultimately invokes via insanely-fast-whisper) had a chunked-decoding offset bug: WhisperTokenizer.decode would offset timestamps incorrectly across chunks, and long-form sequential decoding would reset every 30 s. Three upstream PRs land the fixes:

Upstream PR First released What it fixes
#34537 v4.47.0 WhisperTokenizer chunk-offset decode
#35295 v4.48.0 Mac MPS float64 regression (this is why our pin was frozen at 4.46.3)
#35750 v4.53.0 Long-form 30-s timestamp rollover

A single bump to 4.55.4 clears all three.

What else this required

While the new pin invalidates the on-disk venv content hash, iso-env rebuilds — and that rebuild surfaced a latent issue: openai-whisper==20240930 fails to build under setuptools>=82 (which removed pkg_resources). whisper.py already had a build-constraint-dependencies = [\"setuptools<82\"] guard; this PR adds the matching guard to insanley_fast_whisper_reqs.py.

Tests (TDD red → green)

  1. tests/test_transformers_version_floor.py (pure-unit, hermetic, 3 cases):

    • Pin must use == style (file convention)
    • _get_reqs_generic(has_nvidia=True) returns transformers >= (4, 53, 0)
    • Same for has_nvidia=False
    • Red on main (4.46.3 < 4.53.0), green after the bump.
  2. tests/test_insane_vs_cuda_longform_timestamps.py (NVIDIA-gated, e2e):

    • Loops bundled sample.mp3 four times via ffmpeg -stream_loop 3 into a ~40 s wav (so it spans the 30 s chunk boundary that triggered the upstream bug).
    • Runs both backends via the public transcribe() API with --model tiny.
    • Asserts last-segment end timestamps agree within 1 s and bracket the wav's true duration.
    • Verified locally on RTX 3060: cuda last and insane last both land within 1 s of wav_duration ≈ 40 s, with the test completing in ~30 s on warm venvs.

Test plan

  • pytest tests/test_transformers_version_floor.py (3 pass)
  • pytest tests/test_insane_vs_cuda_longform_timestamps.py (1 pass on this NVIDIA host)
  • Full pure-unit suite still passes (93 passed, 2 mac-only skipped)
  • Mac MPS smoke check (out-of-band): anyone on a Mac runs transcribe-anything <any.wav> --device mlx against a short clip to confirm the MPS path works under transformers 4.55.4 (PR #35295 should make this work again). Not gating merge.

Future work tracked separately

🤖 Generated with Claude Code

… fixes

The HF transformers Whisper pipeline (used by --device insane) had a
chunked-decoding timestamp-offset bug where the WhisperTokenizer would
report incorrect offsets across chunks and long-form sequential decoding
would roll over timestamps every 30 seconds. Three upstream PRs land
the fixes:

- huggingface/transformers#34537 (in v4.47.0) -- WhisperTokenizer chunk-offset
- huggingface/transformers#35295 (in v4.48.0) -- Mac MPS float64 regression
  (this fix is why our pin was previously frozen at 4.46.3)
- huggingface/transformers#35750 (in v4.53.0) -- long-form sequential decoding
  30-second timestamp rollover

A single bump to 4.55.4 clears all three. insanely-fast-whisper==0.0.15
has no transformers pin so it accepts the bump unconstrained.

While rebuilding the insane venv with the new pin, openai-whisper's
build failed under setuptools>=82 (which removed pkg_resources). The
whisper.py venv already had a build-constraint-dependencies pin for
this; this commit adds the matching guard to insanely_fast_whisper_reqs.

Tests:

- tests/test_transformers_version_floor.py: pure-unit floor guard.
  Asserts (a) the transformers pin uses == style, matching the file's
  existing convention, and (b) the version tuple is >= (4, 53, 0).
  Red before the bump, green after. Locks the floor against future
  silent regressions.

- tests/test_insane_vs_cuda_longform_timestamps.py: NVIDIA-gated
  end-to-end test. Loops the bundled sample.mp3 four times into a
  ~40 second wav (so it spans the 30-s chunk boundary that triggers
  the upstream bug), runs both --device cuda and --device insane via
  the public transcribe() API with --model tiny, and asserts the
  last-segment end timestamps agree within 1 s and bracket the wav's
  true duration. Passes on the RTX 3060 host in ~30 s with warm venvs.

Verified on this host: cuda last and insane last both land within
1 s of wav_duration (~40 s) -- direct end-to-end proof that the
upstream chunked-decoding fix is doing its job for our users on
long-form audio.

Mac MPS smoke check pending an out-of-band run on a Mac (the bump
makes MPS compatible again per PR #35295, but I can't verify here).

Future work tracked separately:
- #81 migrate --device insane backend from HF pipeline to WhisperX
- #82 expose --diarization-via-whisperx opt-in

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@zackees
zackees merged commit f150321 into main May 30, 2026
1 check passed
@zackees
zackees deleted the fix/transformers-pin-whisper-timestamps branch May 30, 2026 22:06
@zackees zackees mentioned this pull request May 30, 2026
2 of 3 tasks
zackees added a commit that referenced this pull request May 30, 2026
Whisper timestamp + insane-backend rebuild reliability:

- Bumps transformers pin 4.46.3 -> 4.55.4 in the --device insane venv.
  Picks up huggingface/transformers PRs #34537 (WhisperTokenizer
  chunk-offset decode), #35295 (Mac MPS float64 regression), and #35750
  (long-form 30-s timestamp rollover).
- Adds setuptools<82 build constraint to the insane venv so
  openai-whisper==20240930 keeps building (it imports pkg_resources,
  removed in setuptools 82).
- Adds NVIDIA-gated end-to-end test verifying both --device cuda and
  --device insane agree on last-segment timestamps to within 1 s on a
  40 s clip.
- Adds pure-unit floor test pinning transformers >= 4.53.0.

See PR #83. Future-work issues #81 (WhisperX migration) and #82
(--diarization-via-whisperx opt-in) tracked separately.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant