Skip to content
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

Accept token in trainer.push_to_hub() #30093

Merged
merged 4 commits into from
Apr 8, 2024

Conversation

mapmeld
Copy link
Contributor

@mapmeld mapmeld commented Apr 7, 2024

What does this PR do?

The trainer's HF token is set to self.args.hub_token when it is initialized.
I use Transformers and trainer.train() in CoLab notebooks. If I start running with no token, a read-only token, or some other issue with Secrets/env vars, I can't correct the mistake later when calling trainer.push_to_hub()

With this change, I could try again with trainer.push_to_hub(token="****")

Alternatives: if overwriting self.args.hub_token is undesirable here, it could be passed to create_repo and update_folder in this file.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Copy link
Collaborator

@amyeroberts amyeroberts left a 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! Seems reasonable to me, especially as token is an arg for other push_to_hub methods.

Just a comment on state modification.

cc @muellerzr for reference

mapmeld and others added 2 commits April 8, 2024 06:53
Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>
Copy link
Collaborator

@amyeroberts amyeroberts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for iterating and adding this capability!

@amyeroberts
Copy link
Collaborator

Merging as the failing tests are unrelated and have been resolved on main

@amyeroberts amyeroberts merged commit 08c8443 into huggingface:main Apr 8, 2024
17 of 20 checks passed
@mapmeld mapmeld deleted the push_to_hub branch May 9, 2024 22:59
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.

3 participants