Skip to content

[ernie-image] use concrete Mistral3Model / Ministral3ForCausalLM types#13687

Open
akshan-main wants to merge 1 commit intohuggingface:mainfrom
akshan-main:ernie-image-concrete-types
Open

[ernie-image] use concrete Mistral3Model / Ministral3ForCausalLM types#13687
akshan-main wants to merge 1 commit intohuggingface:mainfrom
akshan-main:ernie-image-concrete-types

Conversation

@akshan-main
Copy link
Copy Markdown
Contributor

What does this PR do?

Follow-up to #13663 (per @asomoza's review there): replace the AutoModel / AutoModelForCausalLM references for text_encoder and pe with the concrete Mistral3Model / Ministral3ForCausalLM so the loaded checkpoint matches the declared types.

To avoid breaking installs with older transformers (Ministral3ForCausalLM is only in 5.0+, Mistral3Model is in 4.50+):

  • Standard: TYPE_CHECKING + string annotations on __init__ so the imports never run at module load. _get_signature_types uses get_type_hints and falls back gracefully when a name can't be resolved.
  • Modular encoders.py: try/except import that aliases the concrete class when available and falls back to AutoModel / AutoModelForCausalLM otherwise. The ComponentSpec then references the alias.

So users on recent transformers get the silenced warning; users on older transformers keep working as before.

Before submitting

Who can review?

@yiyixuxu @asomoza

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant