Skip to content

feat(asr): run the WhisperS2T presets offline from --artifacts-path - #4898

Merged
PeterStaar-IBM merged 2 commits into
docling-project:mainfrom
BBC-Esq:feat/asr-s2t-offline
Oct 25, 2026
Merged

PeterStaar-IBM merged 2 commits into
docling-project:mainfrom
BBC-Esq:feat/asr-s2t-offline

Conversation

@BBC-Esq

@BBC-Esq BBC-Esq commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

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:

docling-tools models download whisper_small_en_s2t --output-dir /models
docling --asr-model whisper_small_en_s2t --artifacts-path /models audio.wav

Prefetch. docling-tools models download now accepts the 14 WhisperS2T presets under their --asr-model names. Each one downloads its CTranslate2 model in float16 (for CUDA) and float32 (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 --all and --all --asr still exclude WhisperS2T models, because 14 presets at two precisions add about 40 GB.

Run. When artifacts_path is set, _WhisperS2TModel passes cache_dir=artifacts_path and local_files_only=True to whisper_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 a FileNotFoundError, for example:

artifacts_path (/models) does not contain the float32 WhisperS2T files required by ASR model 'large-v3-turbo'. Prefetch them with: docling-tools models download whisper_large_v3_turbo_s2t --output-dir "/models"

Library. This uses the API that whisper-s2t-reborn 1.8.0 added for this purpose: download_model() with force_download, default_word_aligner(), and cache_dir and local_files_only in the loader, which reach both the model and its word aligner. The floor therefore rises to >=1.8.0,<2.0.0. The uv.lock change is only that version bump.

Precision. whisper-s2t-reborn publishes float32, float16 and bfloat16 models and runs every other precision as float32, and CTranslate2 needs float32 on 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_types became test_whisper_s2t_cpu_runs_other_compute_types_as_float32: int8 and int8_float32 already ran as float32.

I tested it end to end. I prefetched whisper_base_en_s2t into an empty folder (645 MB: base.en and its tiny.en aligner, each in float16 and float32). Then, with HF_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 the tiny.en aligner 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-path and docling-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.

Related 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 change uv.lock, so if #4771 merges first, I will merge main into this branch and re-run uv lock.

Checklist:

  • Documentation has been updated, if necessary.
  • Examples have been added, if necessary.
  • Tests have been added, if necessary.

`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>
@github-actions

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

Thanks @BBC-Esq, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@github-actions github-actions Bot added ai:ci-needs-care AI triage: check CI-safety findings before you approve CI asr Issues related to ASR (Automatic Speech Recognition) CLI issues related to the command line interface (CLI) enhancement New feature or request labels Oct 19, 2026
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

AI triage (advisory)

Checked commit 290a217241. The analysis read the diff only. It did not run code from this pull request.

The PR lets docling-tools models download fetch the 14 WhisperS2T presets (float16 and float32 models plus the word aligner). It makes _WhisperS2TModel load them offline from artifacts_path with local_files_only=True. If files are missing, it raises a FileNotFoundError that tells the user which prefetch command to run.

CI safety: needs maintainer care before you approve CI.

  • pyproject.toml: changes build, dependency, or tool configuration
  • uv.lock: changes locked dependencies
2 related pull request(s) in the same code
PR State Signal Assessment
#4825 merged referenced as #4825 related: The merged PR adds the same prefetch and offline flow for the native Distil-Whisper presets. This PR adds it for the WhisperS2T presets. It reuses the same CLI and downloader structure but changes different models.
#4760 merged referenced as #4760 related: The merged PR adds prefetch and offline run for native Whisper. This PR does the same for WhisperS2T, in the same CLI and downloader code, and it removes the doc note that WhisperS2T is not prefetched.

The ai:* labels are advisory. They do not approve CI and they do not add tests:full. A new push runs this check again.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread docling/pipeline/asr_transcriber.py
@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.65517% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
docling/utils/model_downloader.py 78.26% 3 Missing and 2 partials ⚠️
docling/pipeline/asr_transcriber.py 91.66% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@geoHeil geoHeil left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@github-actions github-actions Bot added ai:ci-needs-care AI triage: check CI-safety findings before you approve CI and removed ai:ci-needs-care AI triage: check CI-safety findings before you approve CI ai:review-lgtm AI first review found no blocker or major issue (advisory) labels Oct 24, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions Bot added the ai:review-lgtm AI first review found no blocker or major issue (advisory) label Oct 24, 2026
@BBC-Esq
BBC-Esq requested a review from geoHeil October 24, 2026 12:40

@geoHeil geoHeil left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@PeterStaar-IBM PeterStaar-IBM left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@PeterStaar-IBM
PeterStaar-IBM merged commit 0dbf500 into docling-project:main Oct 25, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:ci-needs-care AI triage: check CI-safety findings before you approve CI ai:review-lgtm AI first review found no blocker or major issue (advisory) asr Issues related to ASR (Automatic Speech Recognition) CLI issues related to the command line interface (CLI) enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants