-
Notifications
You must be signed in to change notification settings - Fork 613
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 utility to get repo name #364
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.
LGTM!
def whoami(self, token: Optional[str] = None) -> Dict: | ||
""" | ||
Call HF API to know "whoami". | ||
|
||
Args: | ||
token (``str``): Hugging Face token. | ||
token (``str``, `optional`): | ||
Hugging Face token. Will default to the locally saved token if not provided. | ||
""" | ||
if token is None: | ||
token = HfFolder.get_token() | ||
|
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.
WDYT @osanseviero? I think this is a great improvement in terms of user experience and should also be used to reopen conversations about:
- having the
HfApi.login
saving the token - having the token default to the locally saved token when not passed through the
HfApi
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.
self, | ||
model_id: str, | ||
organization: Optional[str] = None, | ||
token: Optional[str] = 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.
In a similar fashion to what is done here
This PR adds a small utility function to get the full repo name from a model ID which:
This function is used in all examples of Transformers.