Add revision to trainer push_to_hub#33482
Conversation
|
Thank you for the suggestions! Just made a new commit |
|
perfect, the failing tests are unrelated to this PR. |
SunMarc
left a comment
There was a problem hiding this comment.
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_revisionCurrently 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 |
| 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.
Isn't it the branch to commit to - rather than the commit to commit from?
There was a problem hiding this comment.
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.
|
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.