Skip to content

Fix Hugging Face push with transformers 5 - #1129

Open
stanleys12 wants to merge 1 commit into
h2oai:mainfrom
stanleys12:osc/fix-hugging-face-push-failing-with-unexp-fd5e
Open

stanleys12 wants to merge 1 commit into
h2oai:mainfrom
stanleys12:osc/fix-hugging-face-push-failing-with-unexp-fd5e

Conversation

@stanleys12

Copy link
Copy Markdown

Summary

Drops the safe_serialization option from the Hugging Face export.

Motivation

Transformers 5 doesn't accept safe_serialization in push_to_hub anymore and always saves safetensors. So every export fails with a TypeError.

Changes

  • Stop passing safe_serialization in publish_model_to_hugging_face
  • Remove the toggle from the push dialog and the config default
  • Remove the -s flag from publish_to_hugging_face.py and update the docs
  • Add a unit test with a backbone whose push_to_hub lacks the kwarg

Testing

  • With hugging_face_utils.py reverted to main, .venv/bin/python -m pytest tests/app_utils/test_hugging_face_utils.py fails with a TypeError on safe_serialization.
  • With the fix, the same command passes (1 passed).
  • ruff format --check, ruff check and mypy pass on the touched Python files.
  • I didn't run the full make test or make style locally (I'm on macOS and the project only resolves on Linux x86_64), so I'm counting on CI for those.

AI assistance

I used an AI coding assistant (Claude Code) to draft this. I checked it by running the tests and linters listed above.

Checklist

  • The title gives a clear summary.
  • The related issue is linked below.
  • The PR is not a work in progress.
  • make test passes (only the targeted test file was run locally, CI will run the rest).
  • make style passes (ran ruff and mypy on touched files, CI will run the full check).

Related issues

Fixes #1120

Transformers 5 removed the safe_serialization argument from
push_to_hub and always saves safetensors, so passing it raised a
TypeError and every export to Hugging Face failed. Drop the option
from the publish function, the push dialog and the CLI script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

[BUG] Push a model from LLM Studio to hugging face is failing

1 participant