Fix/gemma4 install script (#4815)

* transformer 5.5.0 has now been released

* fallback for python < 3.10
:
This commit is contained in:
Manan Shah 2026-04-03 00:03:35 -05:00 committed by GitHub
commit a7e6964117
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -132,29 +132,17 @@ step "install" "installing mlx, mlx-lm..."
uv pip install --python "$_VENV_PY" -q mlx mlx-lm 2>/dev/null
substep "done"
TRANSFORMERS_WHL="transformers-5.5.0-py3-none-any.whl"
TRANSFORMERS_GH="git+https://github.com/huggingface/transformers.git@v5.5-release"
step "install" "installing transformers>=5.5.0..."
if uv pip install --python "$_VENV_PY" -q "$TRANSFORMERS_GH" 2>/dev/null; then
substep "installed from huggingface/transformers v5.5-release"
elif uv pip install --python "$_VENV_PY" -q "transformers>=5.5.0" 2>/dev/null; then
if uv pip install --python "$_VENV_PY" -q "transformers>=5.5.0" 2>/dev/null; then
substep "installed from PyPI"
else
substep "not on PyPI, trying unsloth branch..."
_whl_tmp=$(mktemp -d)/"${TRANSFORMERS_WHL}"
if curl -fsSL "${REPO_URL}/${TRANSFORMERS_WHL}" -o "$_whl_tmp" 2>/dev/null && \
uv pip install --python "$_VENV_PY" -q "$_whl_tmp" 2>/dev/null; then
substep "installed from branch ${BRANCH}"
elif [ -f "./${TRANSFORMERS_WHL}" ]; then
substep "using local ./${TRANSFORMERS_WHL}"
uv pip install --python "$_VENV_PY" -q "./${TRANSFORMERS_WHL}"
substep "PyPI install failed (Python <3.10?), trying GitHub..."
if uv pip install --python "$_VENV_PY" -q "git+https://github.com/huggingface/transformers.git@v5.5-release" 2>/dev/null; then
substep "installed from huggingface/transformers v5.5-release"
else
rm -f "$_whl_tmp" 2>/dev/null
step "install" "skipping transformers — could not find >=5.5.0" "$C_WARN"
substep "tried: huggingface/transformers v5.5-release, PyPI, branch ${BRANCH}, local ./${TRANSFORMERS_WHL}"
step "warning" "could not install transformers>=5.5.0" "$C_WARN"
substep "tried: PyPI, huggingface/transformers v5.5-release"
fi
rm -f "$_whl_tmp" 2>/dev/null
fi
# ── Find mlx-lm models directory ─────────────────────────────