Skip to content

Resolve the auto class for omni checkpoints, and guard embedding lookups - #11467

Merged
danielhanchen merged 15 commits into
mainfrom
omni-auto-class-resolution
Sep 22, 2026
Merged

danielhanchen merged 15 commits into
mainfrom
omni-auto-class-resolution

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Problem

Qwen/Qwen3-Omni-30B-A3B-Instruct cannot be loaded at all:

ValueError: Unrecognized configuration class
<class 'transformers.models.qwen3_omni_moe.configuration_qwen3_omni_moe.Qwen3OmniMoeConfig'>
for this kind of AutoModel: AutoModelForImageTextToText.

The checkpoint names Qwen3OmniMoeForConditionalGeneration, so it reads as a
VLM and FastModel picks AutoModelForVision2Seq. transformers registers
qwen3_omni_moe only under AutoModelForTextToWaveform, and asking an auto
class that has no mapping is a hard failure before the weights are touched,
not a fallback.

Two further assumptions break on the same class of model:

  • is_vlm was decided by membership in the two image-text auto classes, so an
    omni checkpoint registered elsewhere was treated as text-only and given a
    tokenizer where it needs a processor.
  • for_training and for_inference guard their embedding lookups with
    hasattr(model, "get_input_embeddings"). That is not the question on
    transformers 5, which defines the method on every PreTrainedModel with a
    base implementation that raises NotImplementedError. A composite
    checkpoint passes the hasattr check and then raises. The rest of the file
    already asks by calling and catching; these two callers did not.

Fix

  • _resolve_omni_auto_model tries the auto classes an omni checkpoint may be
    registered under, most specific first, and returns None when none of them
    maps the config, so the caller keeps its own choice and the existing error
    surfaces unchanged. Falling back to the concrete class the checkpoint names
    was tried and removed: a concrete class is in no auto mapping, so it took the
    model out of the processor set and downgraded it to an AutoTokenizer. It is
    consulted only when the class already chosen has no mapping for the
    config, so every checkpoint that resolves today keeps the exact class it
    resolves to now.
  • _multimodal_auto_classes() builds the is_vlm membership test at call
    time from the names that exist in the installed transformers, so the audio
    and speech auto classes count as multimodal without naming anything that is
    absent on 4.x.
  • _embeddings_or_none replaces the two hasattr guards, asking by calling.
  • _patched_enable_input_require_grads skips a module whose
    get_input_embeddings raises. Besides the NotImplementedError above,
    remote code can declare a signature that cannot be called with no arguments:
    stepfun-ai/Step-3.7-Flash defines get_input_embeddings(self, input_ids),
    which raised TypeError straight out of prepare_model_for_training.
  • _resolve_offload_embedding now declines the offload when the model's
    embeddings cannot be inspected, instead of honouring an explicit
    offload_embedding = True through the failure. Its caller goes straight on
    to call get_input_embeddings() unguarded, so honouring the request turned a
    VRAM optimisation that cannot be applied into a failed load, which is the
    outcome this function exists to avoid. Qwen3-Omni reaches this line only now
    that it loads at all.

Scope

This moves Qwen3-Omni from failing inside from_pretrained to loading. It
does not make it trainable: the top-level Qwen3OmniMoeForConditionalGeneration
defines no forward of its own (the trainable text model is the thinker), so
a training step still fails, and plain Transformers plus PEFT fails the same
way on the same checkpoint. The remaining work is a separate matter from
picking the right auto class.

Platform coverage

Run on three runners, each installing torch, torchvision, transformers, numpy, accelerate,
peft, trl, datasets and unsloth_zoo first, plus triton-windows on Windows, so import unsloth
completes and the tests really execute rather than skipping for want of a dependency. Counts are
the executed totals, not the colour of the badge:

runner tests/test_omni_auto_class_resolution.py + the two suites this PR moved
ubuntu-latest (x64 Linux) 44 passed
windows-latest (x64 Windows) 44 passed
macos-15 (Apple Silicon) 44 passed

The red check was inherited from main, and main has since fixed it

Repo tests (CPU, studio) was red at 3696f9781 with 13 failures, all in
tests/studio/test_desktop_reliability_frontend_contract.py,
tests/studio/test_ui_font_scale_contract.py and
tests/studio/test_update_release_notes.py. This branch changes no file under studio/.

A pull_request run tests a merge built when the run was created, so the run kept failing against
a main that had already moved. Checking main out on its own at 1fd6b42d0 leaves 1 of the 13:
test_no_raw_pixel_text_utilities, on studio/frontend/src/features/settings/components/cache-storage-rows.tsx
using text-[11px] where the contract wants a text-ui-* token, which arrived with #10528. #11520
then fixed that line on main as well.

So all 13 are main's, and main now carries every fix. Merging current main into this branch
rebuilds the merge ref, and those three suites are 244 passed locally at the merged head.

Earlier runs of this branch were also red on all three Core zoo legs, from two unsloth_zoo
security tests at the pinned revision that failed identically on #11468 with a
disjoint diff. Those are green again now.

What this still does not prove

Qwen3-Omni trains. It does not, and the Scope section above says why: the top-level class has no
forward of its own. Plain Transformers plus PEFT fails the same way on the same checkpoint, so
this is not a regression introduced or hidden by the change.

danielhanchen and others added 3 commits September 21, 2026 15:55
Two load failures on Qwen/Qwen3-Omni-30B-A3B-Instruct, transformers 5.17.0.

First, the architecture is named Qwen3OmniMoeForConditionalGeneration so it
reads as a VLM, but transformers registers qwen3_omni_moe only under
AutoModelForTextToWaveform. AutoModelForVision2Seq then raises
'Unrecognized configuration class' before any weight is touched. The existing
auto_map fallback does not help, because this is a native transformers
architecture with no auto_map at all. Consult the other auto classes only when
the chosen one genuinely has no mapping for the config, and fall back to the
concrete class the checkpoint names. Anything that resolves today is unchanged.

vision.py keys is_vlm off the selected class to decide between AutoProcessor
and AutoTokenizer, so the same membership test now covers the omni auto
classes; a model registered under AutoModelForTextToWaveform still needs a
processor.

Second, for_training and for_inference guarded their embedding lookups with
hasattr(model, 'get_input_embeddings'). That is not the question: transformers
5 defines the method on every PreTrainedModel and has the base implementation
raise NotImplementedError, so a composite checkpoint with no single embedding
passes the hasattr check and then raises. Every other caller in this file
already asks by calling and catching, including the existing
patch_enable_input_require_grads; these two were the exceptions.

Verified on 8xB200, torch 2.13.0+cu130, transformers 5.17.0, 10 step LoRA runs
at seq 512. unsloth/gemma-3-27b-it and meta-models/Muse-Glimmer-30B produce
losses identical to main to every digit, and Qwen/Qwen3.6-35B-A3B matches
within its own run to run MoE noise. Qwen3-Omni now loads, quantizes and
attaches LoRA where it previously failed at from_pretrained.
_patched_enable_input_require_grads caught NotImplementedError, which covers
the transformers 5 base implementation, but not the other way a model declines
to answer: remote code can declare a non-standard signature. stepfun-ai/Step-3.7-Flash
defines get_input_embeddings(self, input_ids), so calling it with no arguments
raises TypeError and the run dies inside prepare_model_for_training.

Neither case is a model to guess about, so treat them the same and skip.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-22T13:08:34.119966Z 296359d New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Widening is_vlm to the omni auto classes also armed the image-processor
repair path in vision.py, so loading a speech-seq2seq checkpoint called
_construct_vlm_processor_fallback("openai/whisper-tiny", "whisper") --
an image processor build for an audio model, measured as 1 invocation on
this branch against 0 on main.

is_vlm goes back to exactly the image-text classes it names on main, and
processor selection moves to its own predicate. AutoModelForSpeechSeq2Seq
is dropped from both lists: Whisper already reaches AutoProcessor through
is_whisper, so it never needed to be there.

Adds tests/test_omni_auto_class_resolution.py, which pins the omni
resolution, that ordinary VLMs are never rerouted, and that Whisper stays
out of the set.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 257f9ded38

ℹ️ 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".

Comment thread unsloth/models/loader.py Outdated
Comment on lines +264 to +267
for architecture in architectures or []:
model_class = getattr(transformers, str(architecture), None)
if model_class is not None:
return model_class

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Resolve remote waveform registrations from auto_map

When a trust_remote_code omni checkpoint registers only AutoModelForTextToWaveform in config.auto_map, the preceding loader branch ignores that key and resolve_model_class cannot discover the dynamic registration. Falling back to getattr(transformers, architecture) also cannot find a class defined only in the checkpoint's remote module, so this path returns None and the original unsupported image-text auto class still fails. Inspect the waveform entry in auto_map when selecting the auto class rather than assuming the concrete remote class is exported by transformers.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not taking this one. It describes a checkpoint shape nobody has named: Qwen3-Omni, the model this PR exists for, is native to transformers and carries no auto_map. For the hypothetical remote-code omni checkpoint, the outcome is that the resolver returns None, the caller keeps the class it already chose, and the existing error surfaces unchanged, which is exactly main's behaviour. So there is no regression to fix, only an unhandled case, and 5706656 deliberately narrowed this helper further in the same direction. Reading auto_map for a waveform entry can be added when a real checkpoint needs it and can be tested against.

danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 22, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 22, 2026
The resolver could return AutoModelForCausalLM, AutoModel, or the concrete
class the checkpoint names. None of those is in the processor set, so for a
config the loader had already identified as multimodal, head picked an
AutoTokenizer where main picked an AutoProcessor.

The candidate list is now exactly the two multimodal auto classes, and the
concrete-architecture fallback is gone. Nothing matching returns None, which
leaves the caller's own choice alone and so reproduces main exactly. A test
asserts every name the resolver can return is in the processor set, so the
two lists cannot drift apart again.
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 22, 2026
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 22, 2026
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 22, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

_resolve_offload_embedding caught the exception but handed an explicit
offload_embedding=True straight back, and the caller then calls
model.get_input_embeddings() unguarded, so the load failed on exactly the
models the function exists to keep loading. Its own docstring says the
offload is a VRAM optimisation and should be turned off where it cannot
help rather than failing the load.

Qwen3-Omni only reaches that line now that it gets past auto-class
resolution, so this PR is what makes it reachable. Declining also prints
the reason for an explicit request and stays silent for the default,
which is what _decline already does everywhere else here.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Qwen3OmniMoeConfig keeps its vision config under thinker_config, so the
hasattr term is False, and with is_vlm correctly narrowed to the
image-text classes is_vlm_config was False too. That skipped the
fast_inference guard and called load_vllm, get_vllm_state_dict and
convert_vllm_to_huggingface with is_vision_model=False for a model
qwen3_omni_moe is not listed in VLLM_SUPPORTED_VLM for.

is_vlm_config now also takes needs_processor, which is the same
multimodal intent without arming the image-processor repair path that
is_vlm gates. The guard's existing message is the result instead of a
failure further inside vLLM.

Re-ran the earlier evidence after the change: Whisper still makes zero
calls to _construct_vlm_processor_fallback, and the real Qwen3-Omni
checkpoint still resolves to AutoModelForTextToWaveform and reaches
weight loading.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 4a0c4718ac

ℹ️ 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".

shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Sep 22, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 94b9856256

ℹ️ 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".

shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Sep 22, 2026
shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Sep 22, 2026
shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Sep 22, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 3696f97814

ℹ️ 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".

chatgpt-codex-connector[bot]

This comment was marked as resolved.

…d up

The comment said AutoModelForImageTextToText is bound only on transformers 5
and that naming it directly would NameError on 4.x. The declared floor,
4.51.3, ships that class, so the try branch of the import above succeeds
across the whole supported range and the fallback branch is dead; 5.5.0 is the
version that drops AutoModelForVision2Seq. The lookup is still the right call,
for the opposite reason to the one given.
shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Sep 22, 2026
shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Sep 22, 2026
shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Sep 22, 2026
Catching TypeError around the call could not tell a getter that declines to
take zero arguments from one that takes zero arguments and fails inside. The
second is a real bug in the model, and swallowing it silently cost that module
its input-gradient hook: under PEFT with gradient checkpointing the frozen
embedding output then carries no gradient, so backward fails or the adapter
trains on nothing.

Bind the signature before calling. Only a genuine argument mismatch skips;
a TypeError raised inside a working getter propagates as it did before this
branch. An uninspectable getter falls through to the call, since undecidable
is not a reason to skip.
@danielhanchen

Copy link
Copy Markdown
Member Author

pre-commit.ci run

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: dfd1601a1b

ℹ️ 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".

shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Sep 22, 2026
Delete-first pass over what this branch introduced, not the files around it.
Multi-line rationales collapse to one line each, the measured asides and
restatements go, and the facts that cannot be recovered from the code stay:
why the concrete-class fallback is wrong, why Whisper must stay out of the
multimodal set, why an uninspectable embedding declines an explicit request.

Comment lines added by the branch: 52 to 33. Comments, docstrings and
whitespace only; comment_tools.py check reports 4/4 code unchanged.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 22, 2026
@unslothai unslothai deleted a comment from danielhanchen Sep 22, 2026
@unslothai unslothai deleted a comment from danielhanchen Sep 22, 2026
@unslothai unslothai deleted a comment from danielhanchen Sep 22, 2026
@danielhanchen
danielhanchen merged commit 3945bde into main Sep 22, 2026
31 of 35 checks passed
@danielhanchen
danielhanchen deleted the omni-auto-class-resolution branch September 22, 2026 13:17
danielhanchen added a commit that referenced this pull request Sep 22, 2026
#11450 landed on main as one squashed commit, so GitHub retargeted this PR to
main and the merge no longer recognised the base commits this branch already
carried. Three conflicts, all of the same shape: this branch adds a block where
main has none, so HEAD wins in each. The rest of import_fixes.py auto merged,
which matters because main moved on separately, and the resolution keeps that
work: nothing in main's copy of any of the three files is missing here.

The part the merge got wrong on its own: main carries the quant_state check at
_gpu_init.py:110 with its `del` at 123, and this branch moved the call below
the repair with its own `del`. Auto merge kept both, which is not merely the
duplicate warning #11452 already fixed once, it is a NameError on `import
unsloth`, since the second `del` deletes a name the first already removed.
`test_the_check_is_called_once_and_after_the_repair` catches the duplicate call
that causes it. Resolved to one call, after the repair, and one `del`.

Verified after resolving: no duplicate top-level definitions, 106 passed and 4
skipped across the three suites, and 24 passed with 1 skipped in a venv holding
only pytest and packaging.

test_formatter_fixed_point reports studio/backend/tests/test_diffusion_xpu_training.py
and tests/test_omni_auto_class_resolution.py as not fixed points. Both arrived
from main today, in #9534 and #11467, and the same test fails on main itself at
b7aca55, so they are pre-existing and not touched here.
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…ups (unslothai#11467)

* Resolve the auto class for omni checkpoints, and guard embedding lookups

Two load failures on Qwen/Qwen3-Omni-30B-A3B-Instruct, transformers 5.17.0.

First, the architecture is named Qwen3OmniMoeForConditionalGeneration so it
reads as a VLM, but transformers registers qwen3_omni_moe only under
AutoModelForTextToWaveform. AutoModelForVision2Seq then raises
'Unrecognized configuration class' before any weight is touched. The existing
auto_map fallback does not help, because this is a native transformers
architecture with no auto_map at all. Consult the other auto classes only when
the chosen one genuinely has no mapping for the config, and fall back to the
concrete class the checkpoint names. Anything that resolves today is unchanged.

vision.py keys is_vlm off the selected class to decide between AutoProcessor
and AutoTokenizer, so the same membership test now covers the omni auto
classes; a model registered under AutoModelForTextToWaveform still needs a
processor.

Second, for_training and for_inference guarded their embedding lookups with
hasattr(model, 'get_input_embeddings'). That is not the question: transformers
5 defines the method on every PreTrainedModel and has the base implementation
raise NotImplementedError, so a composite checkpoint with no single embedding
passes the hasattr check and then raises. Every other caller in this file
already asks by calling and catching, including the existing
patch_enable_input_require_grads; these two were the exceptions.

Verified on 8xB200, torch 2.13.0+cu130, transformers 5.17.0, 10 step LoRA runs
at seq 512. unsloth/gemma-3-27b-it and meta-models/Muse-Glimmer-30B produce
losses identical to main to every digit, and Qwen/Qwen3.6-35B-A3B matches
within its own run to run MoE noise. Qwen3-Omni now loads, quantizes and
attaches LoRA where it previously failed at from_pretrained.

* Also skip models whose get_input_embeddings cannot be called at all

_patched_enable_input_require_grads caught NotImplementedError, which covers
the transformers 5 base implementation, but not the other way a model declines
to answer: remote code can declare a non-standard signature. stepfun-ai/Step-3.7-Flash
defines get_input_embeddings(self, input_ids), so calling it with no arguments
raises TypeError and the run dies inside prepare_model_for_training.

Neither case is a model to guess about, so treat them the same and skip.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Keep Whisper out of the vision-model membership test

Widening is_vlm to the omni auto classes also armed the image-processor
repair path in vision.py, so loading a speech-seq2seq checkpoint called
_construct_vlm_processor_fallback("openai/whisper-tiny", "whisper") --
an image processor build for an audio model, measured as 1 invocation on
this branch against 0 on main.

is_vlm goes back to exactly the image-text classes it names on main, and
processor selection moves to its own predicate. AutoModelForSpeechSeq2Seq
is dropped from both lists: Whisper already reaches AutoProcessor through
is_whisper, so it never needed to be there.

Adds tests/test_omni_auto_class_resolution.py, which pins the omni
resolution, that ordinary VLMs are never rerouted, and that Whisper stays
out of the set.

* Only ever resolve to a class that takes a processor

The resolver could return AutoModelForCausalLM, AutoModel, or the concrete
class the checkpoint names. None of those is in the processor set, so for a
config the loader had already identified as multimodal, head picked an
AutoTokenizer where main picked an AutoProcessor.

The candidate list is now exactly the two multimodal auto classes, and the
concrete-architecture fallback is gone. Nothing matching returns None, which
leaves the caller's own choice alone and so reproduces main exactly. A test
asserts every name the resolver can return is in the processor set, so the
two lists cannot drift apart again.

* Decline an embedding offload we cannot inspect, explicit or not

_resolve_offload_embedding caught the exception but handed an explicit
offload_embedding=True straight back, and the caller then calls
model.get_input_embeddings() unguarded, so the load failed on exactly the
models the function exists to keep loading. Its own docstring says the
offload is a VRAM optimisation and should be turned off where it cannot
help rather than failing the load.

Qwen3-Omni only reaches that line now that it gets past auto-class
resolution, so this PR is what makes it reachable. Declining also prints
the reason for an explicit request and stays silent for the default,
which is what _decline already does everywhere else here.

* Carry the multimodal intent into the vLLM guard

Qwen3OmniMoeConfig keeps its vision config under thinker_config, so the
hasattr term is False, and with is_vlm correctly narrowed to the
image-text classes is_vlm_config was False too. That skipped the
fast_inference guard and called load_vllm, get_vllm_state_dict and
convert_vllm_to_huggingface with is_vision_model=False for a model
qwen3_omni_moe is not listed in VLLM_SUPPORTED_VLM for.

is_vlm_config now also takes needs_processor, which is the same
multimodal intent without arming the image-processor repair path that
is_vlm gates. The guard's existing message is the result instead of a
failure further inside vLLM.

Re-ran the earlier evidence after the change: Whisper still makes zero
calls to _construct_vlm_processor_fallback, and the real Qwen3-Omni
checkpoint still resolves to AutoModelForTextToWaveform and reaches
weight loading.

* Update the two tests the offload and embedding changes moved

* Correct the version note on why the multimodal auto classes are looked up

The comment said AutoModelForImageTextToText is bound only on transformers 5
and that naming it directly would NameError on 4.x. The declared floor,
4.51.3, ships that class, so the try branch of the import above succeeds
across the whole supported range and the fallback branch is dead; 5.5.0 is the
version that drops AutoModelForVision2Seq. The lookup is still the right call,
for the opposite reason to the one given.

* Ask the embedding getter's signature instead of catching its TypeError

Catching TypeError around the call could not tell a getter that declines to
take zero arguments from one that takes zero arguments and fails inside. The
second is a real bug in the model, and swallowing it silently cost that module
its input-gradient hook: under PEFT with gradient checkpointing the frozen
embedding output then carries no gradient, so backward fails or the adapter
trains on nothing.

Bind the signature before calling. Only a genuine argument mismatch skips;
a TypeError raised inside a working getter propagates as it did before this
branch. An uninspectable getter falls through to the call, since undecidable
is not a reason to skip.

* Trim the comments added by this branch

Delete-first pass over what this branch introduced, not the files around it.
Multi-line rationales collapse to one line each, the measured asides and
restatements go, and the facts that cannot be recovered from the code stay:
why the concrete-class fallback is wrong, why Whisper must stay out of the
multimodal set, why an uninspectable embedding declines an explicit request.

Comment lines added by the branch: 52 to 33. Comments, docstrings and
whitespace only; comment_tools.py check reports 4/4 code unchanged.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant