-
Notifications
You must be signed in to change notification settings - Fork 28.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add revision to trainer push_to_hub #33482
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this
Thank you for the suggestions! Just made a new commit |
perfect, the failing tests are unrelated to this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this @teamclouday ! Did you test the PR ?
I just added test code! Can run it with: export HUGGINGFACE_CO_STAGING=1; python -m unittest -v tests.trainer.test_trainer.TrainerIntegrationWithHubTester.test_push_to_hub_with_revision Currently with revision, the code is assuming that branch already exists. Wonder if it's necessary to automatically create new branch if not found. |
Don't forget to format your files with |
Thanks for reminder! Just applied the format |
the |
Just fixed the imports! Should be good now. Sorry about the back and forth |
@@ -4474,6 +4475,8 @@ def push_to_hub( | |||
Whether the function should return only when the `git push` has finished. | |||
token (`str`, *optional*, defaults to `None`): | |||
Token with write permission to overwrite Trainer's original args. | |||
revision (`str`, *optional*): | |||
The git revision to commit from. Defaults to the head of the "main" branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it the branch to commit to - rather than the commit to commit from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this description comes from the hub upload_folder api. I was only going to use it for branches and tested with that, so not sure if it works for other commit hashes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding!
Can you rebase on main to make the CI green @teamclouday ? |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
I just rebased to main and CI is green now! Thank you all! |
* add revision to trainer push_to_hub * apply suggestions * add test for revision * apply ruff format * reorganize imports * change test trainer path
What does this PR do?
Add revision to trainer's push_to_hub method. See #33481
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.