Repository navigation
feat(asr): run the WhisperS2T presets offline from --artifacts-path - #4898
Conversation
`docling-tools models download` now prefetches the 14 WhisperS2T presets under their `--asr-model` names, for example `whisper_small_en_s2t`. Each one downloads the preset's CTranslate2 model in float16 for CUDA and float32 for CPU, plus the word aligner that word timestamps use if the preset needs one, into the output directory in the Hugging Face cache layout. Plain `--all` and `--all --asr` still exclude them. With `artifacts_path` set, the WhisperS2T backend now loads the model and its word aligner from that folder with `local_files_only=True` and never downloads. If the files are missing, it raises a FileNotFoundError that names the precision, the folder, and the `docling-tools` command that fetches them. This uses the `cache_dir`, `local_files_only`, `download_model()` and `default_word_aligner()` API of whisper-s2t-reborn 1.8.0, so the floor rises to `>=1.8.0,<2.0.0`. Docling now also maps the configured precision the way the library loads it: CPU runs float32, and any precision other than float32, float16 and bfloat16 runs as float32. The prefetch and the error message therefore name the files that are actually loaded. Signed-off-by: BBC, Esquire <bbc@chintellalaw.com>
|
✅ DCO Check Passed Thanks @BBC-Esq, all your commits are properly signed off. 🎉 |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
AI triage (advisory)Checked commit The PR lets CI safety: needs maintainer care before you approve CI.
2 related pull request(s) in the same code
The |
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the full diff at 539b3181c5. It read the code and did not run it.
The offline prefetch and load path looks consistent. One risk is that the PR changes how torch_dtype is mapped to compute_type for all WhisperS2T users, including users who do not use --artifacts-path. The reviewer must decide if dropping int8 and int8_float32 support is intended.
A maintainer makes the merge decision. This review never approves the pull request.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
geoHeil
left a comment
There was a problem hiding this comment.
Reviewed 539b3181c5d520cb460da8ee3fefb91f58a02793. No code blocker found. The author reply about int8 is correct: WhisperS2T 1.7.1 already maps it to float32. The 1.8.0 API forwards the cache directory and offline flag to the model and its word aligner.
Local validation: 56 tests pass, with two dependency skips. The real hub boundary checks also pass. Linux CI now passes both new offline tests with WhisperS2T 1.8.0. Current CI is green. Codecov patch coverage is 89.65517%. Full CPU/CUDA transcription was not repeated locally.
Local make check stops on file-length violations that already exist on base. The other read-only checks pass. I made no source or reference-data changes.
Signed-off-by: BBC, Esquire <bbc@chintellalaw.com>
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the changes since 539b3181c5 at 290a217241. It read the code and did not run it.
The incremental diff only brings in changes from the base branch. It does not touch any WhisperS2T file in this PR, so there is nothing new to report. The earlier compute-type question is answered, but its main claim is not confirmed here. whisper-s2t-reborn is not installed in the workspace, so the maintainer should read _normalize_compute_type in the 1.7.1 release to confirm it.
Earlier findings
- answered (question): Compute types other than float32/float16/bfloat16 are now silently changed to float32, on CPU and CUDA
A maintainer makes the merge decision. This review never approves the pull request.
geoHeil
left a comment
There was a problem hiding this comment.
Reviewed head 290a2172415bbebd274d3c160d158dfb61644110.
No blocker found. The CLI model names map to all 14 WhisperS2T presets, --all still excludes them, and named prefetch downloads the model plus the required word aligner in both CPU (float32) and CUDA (float16) variants. With whisper-s2t-reborn 1.8.0, an empty --artifacts-path raises LocalEntryNotFoundError, which this change converts to the documented actionable FileNotFoundError; the local-only flags reach both model and aligner loads.
Validation: hosted CI is green, including Python 3.10–3.14 core tests, ASR tests, package tests, lint, type, Tach, docs, and Codecov. I also checked the 1.8.0 loader/download contracts directly and reproduced the empty-cache exception. Full CPU/CUDA transcription was not repeated locally.
Note
Description of this pull request
This PR lets the WhisperS2T presets run offline, the same way #4760 did for native Whisper and #4825 did for the native Distil-Whisper presets:
Prefetch.
docling-tools models downloadnow accepts the 14 WhisperS2T presets under their--asr-modelnames. Each one downloads its CTranslate2 model infloat16(for CUDA) andfloat32(for CPU), plus the word aligner that word timestamps use if the preset needs one. The files go into the output directory in the Hugging Face cache layout, the same layout that #4825 uses for the Distil checkpoints. Plain--alland--all --asrstill exclude WhisperS2T models, because 14 presets at two precisions add about 40 GB.Run. When
artifacts_pathis set,_WhisperS2TModelpassescache_dir=artifacts_pathandlocal_files_only=Truetowhisper_s2t.load_model(), so the library loads the model and its word aligner from that folder and never downloads. If files are missing, Docling raises aFileNotFoundError, for example:Library. This uses the API that whisper-s2t-reborn 1.8.0 added for this purpose:
download_model()withforce_download,default_word_aligner(), andcache_dirandlocal_files_onlyin the loader, which reach both the model and its word aligner. The floor therefore rises to>=1.8.0,<2.0.0. Theuv.lockchange is only that version bump.Precision. whisper-s2t-reborn publishes
float32,float16andbfloat16models and runs every other precision asfloat32, and CTranslate2 needsfloat32on CPU. A small helper applies both rules, so the prefetch, the run and the error message all name the files that the library actually loads. For this reason,test_whisper_s2t_cpu_preserves_cpu_compatible_compute_typesbecametest_whisper_s2t_cpu_runs_other_compute_types_as_float32:int8andint8_float32already ran asfloat32.I tested it end to end. I prefetched
whisper_base_en_s2tinto an empty folder (645 MB:base.enand itstiny.enaligner, each infloat16andfloat32). Then, withHF_HUB_OFFLINE=1, I ran it from the CLI on CPU and on CUDA, and from Python with word timestamps on both devices. The Python runs loaded thetiny.enaligner from the folder at the matching precision. An empty folder fails at once with the message above and stays empty.Important
Related pull requests: step 4 of 4
These four pull requests add offline support (
--artifacts-pathanddocling-tools models download) for the ASR presets I contributed in #2938 and #3741, the same way that Peter Staar did in #4760 for native Whisper. A checked box means that step is merged.n_melsoverride in the WhisperS2T backend.docling-tools models download.--artifacts-path, with prefetch throughdocling-tools models download. ⬅️ this PRRelated work for another backend: #4771 aims at the same goal for a new Transformers ASR backend (with MLX presets): its presets run Transformers-format checkpoints offline from
--artifacts-path(#4684). This PR does not change the same lines. Both PRs changeuv.lock, so if #4771 merges first, I will mergemaininto this branch and re-runuv lock.Checklist: