Skip to content

Pin Gemma-4 transformers requirement to 5.5.0 stable#4784

Merged
danielhanchen merged 1 commit into
mainfrom
fix/transformers-5.5.0-version-pin
Apr 2, 2026
Merged

Pin Gemma-4 transformers requirement to 5.5.0 stable#4784
danielhanchen merged 1 commit into
mainfrom
fix/transformers-5.5.0-version-pin

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

  • Update Gemma-4 transformers version pin from 5.5.0.dev0 to 5.5.0 in unsloth/models/loader.py, studio/backend/utils/transformers_version.py, and install_gemma4_mlx.sh
  • Fix install_gemma4_mlx.sh which referenced a non-existent v5.5-release branch -- pin to commit 91b1ab1fdfa81a552644a92fbe3e8d88de40e167 instead

Context

Gemma-4 support has landed in transformers main (huggingface/transformers#45192). The dev0 pre-release pin is no longer needed now that 5.5.0 stable is available.

Files changed

  • unsloth/models/loader.py -- SUPPORTS_GEMMA4 version check
  • studio/backend/utils/transformers_version.py -- TRANSFORMERS_5_VERSION constant
  • install_gemma4_mlx.sh -- wheel filename and git install URL

Gemma-4 support landed in transformers main
(huggingface/transformers#45192). Update the version pin from
5.5.0.dev0 to 5.5.0 across loader, Studio version switcher,
and the MLX installer. Also fix install_gemma4_mlx.sh which
referenced a non-existent v5.5-release branch -- pin it to
the correct commit (91b1ab1) instead.
@danielhanchen danielhanchen merged commit f1c3b9c into main Apr 2, 2026
5 checks passed
@danielhanchen danielhanchen deleted the fix/transformers-5.5.0-version-pin branch April 2, 2026 15:59

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Transformers library version from 5.5.0.dev0 to 5.5.0 across the installation script, version utilities, and model loader. Feedback includes a suggestion to document the specific commit hash used in the installation script for better traceability and a recommendation to replace the magic version string in the model loader with a named constant to improve maintainability.

Comment thread install_gemma4_mlx.sh
Comment on lines +135 to +136
TRANSFORMERS_WHL="transformers-5.5.0-py3-none-any.whl"
TRANSFORMERS_GH="git+https://github.com/huggingface/transformers.git@91b1ab1fdfa81a552644a92fbe3e8d88de40e167"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Hardcoding a specific commit hash for the transformers repository is a good practice for reproducibility, but it can make it difficult to track which version of the library is being used. Consider adding a comment explaining why this specific commit was chosen, or if possible, use a tagged release if one becomes available that includes the necessary Gemma-4 support.

Comment thread unsloth/models/loader.py
SUPPORTS_GEMMA3N = transformers_version >= Version("4.53.0")
SUPPORTS_GPTOSS = transformers_version >= Version("4.55.0")
SUPPORTS_GEMMA4 = transformers_version >= Version("5.5.0.dev0")
SUPPORTS_GEMMA4 = transformers_version >= Version("5.5.0")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The version check transformers_version >= Version("5.5.0") uses a magic number. Please define a constant for the minimum supported version to ensure consistency across the codebase.

shibizhao pushed a commit to shibizhao/unsloth-npu that referenced this pull request Apr 7, 2026
Gemma-4 support landed in transformers main
(huggingface/transformers#45192). Update the version pin from
5.5.0.dev0 to 5.5.0 across loader, Studio version switcher,
and the MLX installer. Also fix install_gemma4_mlx.sh which
referenced a non-existent v5.5-release branch -- pin it to
the correct commit (91b1ab1) instead.
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