Repository navigation
fix(audio): do not read an unreadable tokenizer_config.json as "not an audio model" - #8625
Conversation
…dio model" detect_audio_type returns None for both "definitely not an audio model" and "the repo could not be read", and its docstring already says callers gating a user action want detect_audio_type_checked instead. The trainer used the ambiguous one to pick a preprocessing path. So a TTS run whose tokenizer_config.json was unreadable -- gated repo, offline, or a cache holding the weights but not the tokenizer files -- came back None, the model was treated as text, the snac/csm/bicodec/dac branches were skipped, and the run failed further along with "Could not auto-detect format mapping". That names a column-mapping problem on a dataset whose columns were fine, and says nothing about the read that actually failed. Both probe sites now take the checked variant and keep the definitive flag beside the type, so a reassignment cannot leave the flag describing the previous probe. When the probe was inconclusive and the dataset has an audio column, the run stops and names the file it could not read. Deliberately narrow: a definitive "not audio" is unchanged, and an inconclusive probe on a dataset with no audio column still trains on the text path, so a text run against a gated repo keeps working. The guard reads its two inputs through getattr because this method is also driven against lightweight stand-ins, and a probe that never ran is not an inconclusive one.
…ction-not-definitive
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
is_dataset_audio reaches the trainer from the client, which fills it from the format check's is_audio. That flag is set by a column-NAME keyword match (audio|speech|wav|waveform|sound) that never inspects the value, so a text dataset with a column called audio holding filenames arrives here flagged as audio. Combined with an inconclusive probe, the new guard refused a run that previously took the text path and worked. The loaded dataset's own features answer this exactly, so the refusal now stands down when the schema positively shows no Audio column. Unknown schemas (a DatasetDict, an iterable dataset) still refuse: not being able to tell is not evidence of absence, and an unreadable model probe remains the likelier explanation. Adds three cases: a text dataset with an audio-named column is no longer refused, a real Audio column still is, and a dataset that cannot report a schema still is.
|
Reviewed this together with #8436 and validated both end to end. The fix works, but it cannot be demonstrated against its own merge baseMeasured on this host: at So the honest pair is #8436's head versus #8436 + this PR:
Induced with a complete That variant is also the only workable one. One fix pushed: a false positive that took away working behaviour
The blast radius is narrower than it first looks — The loaded dataset's own What I checked beyond that
Both PRs merge cleanly with each other. Suites: 88 in the audio/preflight modules on this branch, plus 282 source-level and 26 end-to-end checks across the merge base, each PR, and both combined. |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…usal Three cases where the inconclusive-probe guard answered wrongly. An audio dataset loaded from JSON or CSV carries its audio as a Value(string) of paths until the preprocessor casts it, which _preprocess_snac_dataset does, so checking the schema alone called a real audio dataset textual and handed it to the text path the guard exists to prevent. The helper now looks at the values when the schema has no Audio feature, which is safe there precisely because nothing decodes. raw and CPT runs read the text column and ignore any audio one by design, so they are not the unsafe audio-to-text fallback being guarded, and refusing them removed a valid way to pretrain on transcripts. They are exempt. The probe and the tokenizer load are two reads of the same repo, so a timeout or 5xx could leave the probe inconclusive while the download right after it succeeded, and the run was then refused claiming tokenizer_config.json was unreadable when it had just been read. It is asked again once the tokenizer is in, and only a definitive answer replaces the first. Four tests, each failing without its own change.
…, and sniff more than one row
Two follow-ups on the previous commit.
The loader is chosen from the audio type, so the retry probe that runs after the
tokenizer is loaded could flip the type to whisper (or spark) with an AutoTokenizer
already stored on self.tokenizer. _preprocess_whisper_dataset reads .feature_extractor
and .tokenizer off the processor, so every sample would be skipped and the run would
end with "No valid examples after Whisper preprocessing". The tokenizer load is now a
local function that the retry calls again when, and only when, the answer changed.
The value fallback used to read a single row, so a dataset whose first audio value is
null or empty was reported textual and the guard reopened the unsafe text path. It now
sniffs up to 16 rows and answers None ("unknown", keep refusing) when it never saw a
usable value at all.
… judge only audio-named columns Two follow-ups on the previous commit. The retry sat after a successful tokenizer load, so it could not help the one layout that needs it most. An inconclusive probe leaves the audio type None, the Spark-TTS subfolder kwarg is chosen from that type, and the repo root holds no tokenizer, so the read raises before the retry runs. The retry is now a local function called from the failure path as well: re-probe, and if the answer changed, load again for it. A load that fails with an already definitive type still propagates untouched. The row sniff took any populated field as evidence that a dataset is textual, but a path-backed audio dataset has a transcript in every row, so a run of null audio values inside the sniff window answered False on the strength of the text. Only a column whose name matches the keywords that set the flag can answer False now; audio-like values still count wherever they appear, and no evidence either way stays unknown.
|
@codex review |
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b1e9a372b0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| self._audio_type, | ||
| self.is_audio, | ||
| ) | ||
| return self._audio_type != previous_type |
There was a problem hiding this comment.
Preserve audio-VLM detection when deciding to retry
When the initial probe is inconclusive and the first tokenizer load fails, a successful retry that detects audio_vlm sets _audio_type back to None before this comparison. Since previous_type was also None, the function returns False, and the exception handler at line 458 re-raises the original load error instead of retrying. This specifically prevents recovery from a transient tokenizer-load failure for Gemma audio-VLM models; compare the detected retried_type before normalizing audio_vlm, or return a separate state-changed flag.
Useful? React with 👍 / 👎.
The bug
An Orpheus LoRA run failed with:
The dataset was
GianDiego/orpheus-tts-spanish-female, whose columns areaudio,text,file_id._resolve_audio_columnsacceptsaudio/speechandtext/sentence/transcript/transcription, so that dataset needs no mapping at all and never reaches the code that complained.Root cause
detect_audio_typereturnsNonefor two different answers: "definitely not an audio model" and "the repo could not be read". Its own docstring says so, and points callers gating a user action atdetect_audio_type_checked, which returns(type, definitive).routes/models.pyuses the checked variant and surfaces the flag asaudio_type_known. The trainer used the ambiguous one.On this host
tokenizer_config.jsonwas not readable, so:_audio_typebecameNone,is_audiobecameFalse, the snac branch was skipped, and the run fell through to the text chat-template path, which cannot map an audio dataset. The error a user sees is a column-mapping complaint about a dataset with correct columns, seven steps from the read that failed.Any cause of an unreadable
tokenizer_config.jsonproduces this: a gated repo without a token, offline mode, or a cache holding a model's weights but not its tokenizer files.The fix
Both probe sites take
detect_audio_type_checkedand keep the definitive flag next to the type, so a reassignment cannot leave the flag describing the previous probe. When the probe was inconclusive and the dataset has an audio column, the run stops and names the file it could not read:Deliberately narrow
A text run against a gated repo keeps working. Only the case that was already broken changes.
The guard reads its two inputs through
getattr.load_and_format_datasetis also driven against lightweight stand-ins that set only the attributes they exercise, and a probe that never ran is not an inconclusive one, so both defaults leave the guard closed. I found this the direct way: without it, seventest_training_preflighttests failed on'types.SimpleNamespace' object has no attribute '_audio_type_known'.Tests
Five, three of which fail without the change. The behavioral ones drive the real
load_and_format_datasetthrough the existing preflight stub pattern and assert on what reaches_update_progress: the refusal namestokenizer_config.jsonand does not say "Could not auto-detect format mapping". The other two cases assert the unaffected paths still return a dataset and report nothing.One pre-existing failure,
test_the_soundfile_decoder_resamples_to_the_cast_rate, reproduces on a cleanmaincheckout and is untouched here.Related
Does not overlap #8436, which installs the audio decode shim before the worker reads a row. That one fixed the decode failure this run hit first; this one fixes the misdiagnosis that followed it. Both were visible in the same session, in that order.
Not addressed
Why the tokenizer files were missing from the active cache in the first place. That traces to Studio resolving models against one HF cache root while the model picker scans several, which needs its own report.