Skip to content

Gemma 3 model conversion fixes - #2037

Merged
jordimas merged 1 commit into
OpenNMT:masterfrom
jordimas:gemma3_fixes
May 8, 2026
Merged

jordimas merged 1 commit into
OpenNMT:masterfrom
jordimas:gemma3_fixes

Conversation

@jordimas

@jordimas jordimas commented May 7, 2026

Copy link
Copy Markdown
Collaborator

Changes

  • transformers 4.57.6 + Python 3.14 crash: Gemma3ForCausalLM receives a Gemma3Config but expects Gemma3TextConfig. Fixed by get_model_kwargs passing config.text_config and get_model_class picking the right class based on base_model_prefix.
  • transformers 5.8.0 + gemma 12b garbage output: Gemma3ForCausalLM.base_model_prefix changed from "language_model" to "model", breaking weight-key mapping — fixed by get_model_class switching to Gemma3ForConditionalGeneration whose structure matches the checkpoint.

@jordimas
jordimas merged commit ac19abd into OpenNMT:master May 8, 2026
21 checks passed
@jordimas
jordimas deleted the gemma3_fixes branch May 8, 2026 18:35
Lanurence666 pushed a commit to Lanurence666/CTranslate2_backport_py38 that referenced this pull request May 23, 2026
Changes:
- transformers 4.57.6 + Python 3.14 crash: Gemma3ForCausalLM receives a Gemma3Config but expects Gemma3TextConfig. Fixed by get_model_kwargs passing config.text_config and get_model_class picking the right class based on base_model_prefix.
- transformers 5.8.0 + gemma 12b garbage output: Gemma3ForCausalLM.base_model_prefix changed from "language_model" to "model", breaking weight-key mapping. Fixed by get_model_class switching to Gemma3ForConditionalGeneration whose structure matches the checkpoint.
veilnetwork pushed a commit to veilnetwork/CTranslate2 that referenced this pull request Aug 27, 2026
Changes:
- transformers 4.57.6 + Python 3.14 crash: Gemma3ForCausalLM receives a Gemma3Config but expects Gemma3TextConfig. Fixed by get_model_kwargs passing config.text_config and get_model_class picking the right class based on base_model_prefix.
- transformers 5.8.0 + gemma 12b garbage output: Gemma3ForCausalLM.base_model_prefix changed from "language_model" to "model", breaking weight-key mapping. Fixed by get_model_class switching to Gemma3ForConditionalGeneration whose structure matches the checkpoint.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant