Repository navigation
Fix Hugging Face push with transformers 5 - #1129
Open
stanleys12 wants to merge 1 commit into
Open
stanleys12 wants to merge 1 commit into
stanleys12 wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Drops the
safe_serializationoption from the Hugging Face export.Motivation
Transformers 5 doesn't accept
safe_serializationinpush_to_hubanymore and always saves safetensors. So every export fails with a TypeError.Changes
safe_serializationinpublish_model_to_hugging_face-sflag frompublish_to_hugging_face.pyand update the docspush_to_hublacks the kwargTesting
hugging_face_utils.pyreverted to main,.venv/bin/python -m pytest tests/app_utils/test_hugging_face_utils.pyfails with a TypeError onsafe_serialization.ruff format --check,ruff checkandmypypass on the touched Python files.make testormake stylelocally (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
make testpasses (only the targeted test file was run locally, CI will run the rest).make stylepasses (ran ruff and mypy on touched files, CI will run the full check).Related issues
Fixes #1120