-
Notifications
You must be signed in to change notification settings - Fork 60
ENH add implementation for init and push #12
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
Conversation
@merveenoyan this should be ready for a review :) |
examples/plot_hf_hub.py
Outdated
HfApi().create_repo(repo_id=repo_name, token=token, repo_type="model") | ||
|
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.
Do we want to include this inside Hub functionalities in later versions?
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.
What do you mean? I'm not sure what "Hub functionality" refers to here. What would the users' code look like with what you're thinking?
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'd expect the pushing function to create the repository if it doesn't exist.
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. 84c8903 adds a create_remote
parameter to allow the user to do that.
create_remote: bool, optional | ||
Whether to create the remote repository if it doesn't exist. If the | ||
remote repository doesn't exist and this parameter is ``False``, it | ||
raises an error. Otherwise it checks if the remote repository exists, | ||
and would create it if it doesn't. |
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.
If this exists, why do we create_repo in examples and tests? Wouldn't it cause confusion?
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've removed it from the example, but the test needs to test different scenarios, and the user might create the repo before calling this method, so the test makes sure that case is tested as well.
path_in_repo=".", | ||
folder_path=source, | ||
commit_message=commit_message, | ||
commit_description=None, |
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.
Why is this needed? 😅
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.
For now I'm not exposing this to the end user, but passing it here. Passing it explicitly means if huggingface_hub
decides to change the default value of this parameter, our users wouldn't notice anything cause we're already explicitly setting it anyway.
commit_message=commit_message, | ||
commit_description=None, | ||
token=token, | ||
repo_type=None, |
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.
This is by default None and None refers to model BTW
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.
Yes, same as above, I'm just explicitly setting it in case in the future the default value changes.
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.
ah gotcha!
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 didn't catch anything else other than above comments, LGTM
Add implementation for
init
andpush
.