Skip to content

Revert "updated models template mappers. added lfm2.5vl450m to transformers 5…" - #4945

Merged
danielhanchen merged 1 commit into
mainfrom
revert-4939-feature/update-models-template-mapping
Apr 10, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
revert-4939-feature/update-models-template-mapping

Conversation

@rolandtannous

Copy link
Copy Markdown
Contributor

Reverts #4939

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@danielhanchen
danielhanchen merged commit 33503ea into main Apr 10, 2026
4 of 5 checks passed
@danielhanchen
danielhanchen deleted the revert-4939-feature/update-models-template-mapping branch April 10, 2026 06:14

@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: 805ccfb40f

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

"unsloth/gemma-4-31B-it-unsloth-bnb-4bit",
"google/gemma-4-31B-it",
),
"qwen2.5": (

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Re-add Gemma 4 entries to studio template mappings

Removing the gemma-4 / gemma-4-thinking blocks here drops all Gemma 4 IDs from MODEL_TO_TEMPLATE_MAPPER, even though those models are still first-class in studio/backend/utils/models/model_config.py. That causes core/training/trainer.py to take the No template mapping found branch for Gemma 4 (disabling train_on_completions) and pushes chat formatting to generic fallbacks, so Gemma 4 runs can be trained/inferred with the wrong instruction/response markers.

Useful? React with 👍 / 👎.

@@ -52,7 +52,6 @@
"qwen3.5", # Qwen3.5 family (35B-A3B, etc.)
"qwen3-next", # Qwen3-Next and variants
"tiny_qwen3_moe", # imdatta0/tiny_qwen3_moe_2.8B_0.7B

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 Keep LFM2.5-VL in static transformers-5 detection

Deleting this substring makes get_transformers_tier() rely on the slower tokenizer-config fetch path for LFM2.5-VL-450M, but _check_tokenizer_config_needs_v5() fail-opens to False on network/parse errors. In offline or firewalled environments that means this model now falls back to transformers 4.57.x instead of 5.3.0, which can break model/tokenizer loading that previously worked deterministically.

Useful? React with 👍 / 👎.

"gemma4": (
"unsloth/gemma-4-E2B-it",
"unsloth/gemma-4-E2B-it-unsloth-bnb-4bit",
"unsloth/gemma-4-E2B",

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 Keep Gemma4 4bit aliases in Ollama template mapper

Replacing the Gemma 4 ...-it-unsloth-bnb-4bit entries with base-model IDs removes exact-key coverage for quantized Gemma 4 checkpoints. create_ollama_modelfile() does an exact MODEL_TO_OLLAMA_TEMPLATE_MAPPER.get(base_model_name) lookup, so Gemma 4 fine-tunes whose base name remains quantized now hit the “No Ollama template mapping found” path and skip Modelfile generation.

Useful? React with 👍 / 👎.

danielhanchen added a commit that referenced this pull request Apr 15, 2026
* Reapply "updated models template mappers. added lfm2.5vl450m to transformers 5…" (#4945)

This reverts commit 33503ea.

* Add missing gemma-4-31B-it bnb-4bit mapper entry and LFM2.5 upstream namespace for PR #4950

- Add unsloth/gemma-4-31B-it-unsloth-bnb-4bit to __INT_TO_FLOAT_MAPPER so
  the int-to-float resolution works for this model (already listed in
  TEMPLATE_TO_MODEL_MAPPER but had no mapper entry).
- Add LiquidAI/LFM2.5-1.2B-Instruct to lfm-2.5 TEMPLATE_TO_MODEL_MAPPER
  entry so the canonical upstream namespace is mapped consistently with lfm-2.

* Add missing gemma-4-31B-it bnb-4bit Ollama mapping and lfm-2.5 chat template alias

- Add unsloth/gemma-4-31B-it-unsloth-bnb-4bit to OLLAMA_TEMPLATE_TO_MODEL_MAPPER
  so Ollama export works for this model (E2B-it and E4B-it bnb-4bit variants were
  already present, 31B-it was inconsistently omitted)
- Register CHAT_TEMPLATES["lfm-2.5"] as alias of the lfm-2 template to prevent
  KeyError when Studio resolves LFM2.5 models through MODEL_TO_TEMPLATE_MAPPER

* Add missing LFM2 bnb-4bit INT_TO_FLOAT_MAPPER entry

unsloth/LFM2-1.2B-unsloth-bnb-4bit is referenced in model_mappings.py
but had no mapper.py entry, so model resolution would fail when users
load that variant with load_in_4bit=False or when the float name is
used with load_in_4bit=True.

* Fix review findings for PR #16

1. ollama_template_mappers.py: Restore dropped Gemma-4 base model IDs
   (E2B, E4B, 31B, 26B-A4B) and add missing google/ upstream IDs to
   the gemma4 Ollama mapper for consistency with other gemma entries.

2. mapper.py: Remove self-mapping non-bnb-4bit entries from
   __INT_TO_FLOAT_MAPPER that were polluting FLOAT_TO_INT_MAPPER with
   lowercase 16-bit names, causing load_in_4bit=True to return bad
   model names. Add direct MAP_TO_UNSLOTH_16bit entries to preserve
   the google->unsloth 16-bit redirects.

3. mapper.py: Add LFM2.5 MAP_TO_UNSLOTH_16bit redirect so
   LiquidAI/LFM2.5-1.2B-Instruct resolves to its unsloth mirror.

* Add review tests for PR #4950

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

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

* Remove top-level test files

These test_*.py files were added at the repo root rather than under tests/.
Removing them from this PR; the production mapper changes remain.

* Add gemma-4-26B-A4B-it mapping

Adds unsloth/gemma-4-26B-A4B-it to __INT_TO_FLOAT_MAPPER as a 2-tuple so
google/gemma-4-26B-A4B-it routes to unsloth/gemma-4-26B-A4B-it across
INT_TO_FLOAT_MAPPER, FLOAT_TO_INT_MAPPER, and MAP_TO_UNSLOTH_16bit.

The 26B-A4B (MoE) model has no bnb-4bit variant, so the key uses the
plain unsloth name rather than the -unsloth-bnb-4bit suffix.

Removes the now-redundant standalone _add_with_lower call for the -it
variant; the 16bit mapping is registered via the dict loop.

* Add unsloth-bnb-4bit mappings for gemma-4 base (non-it) models

Adds E2B, E4B, 31B base unsloth-bnb-4bit entries to __INT_TO_FLOAT_MAPPER.
The 26B-A4B (MoE) base has no bnb-4bit variant on HF, so it stays on the
standalone _add_with_lower line for the 16bit-only routing.

Removes the redundant _add_with_lower lines for E2B, E4B, 31B base since
the dict loop now registers the same google->unsloth route through the
2-tuple entries, plus full FLOAT_TO_INT and INT_TO_FLOAT coverage.

---------

Co-authored-by: Daniel Han <[email protected]>
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants