-
Notifications
You must be signed in to change notification settings - Fork 880
Include "model" in repo_type to keep consistency #620
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
Changes from all commits
2084aec
a1c961d
1563da8
8a90ce3
8c5b826
6ac9fb2
5e9ecb3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -611,7 +611,7 @@ def list_repo_files( | |
| """ | ||
| Get the list of files in a given repo. | ||
| """ | ||
| if repo_type is None: | ||
| if repo_type is None or repo_type == "model": | ||
| info = self.model_info( | ||
| repo_id, revision=revision, token=token, timeout=timeout | ||
| ) | ||
|
|
@@ -708,7 +708,7 @@ def create_repo( | |
| Params: | ||
| private: Whether the model repo should be private (requires a paid huggingface.co account) | ||
|
|
||
| repo_type: Set to "dataset" or "space" if creating a dataset or space, default is model | ||
| repo_type: Set to :obj:`"dataset"` or :obj:`"space"` if uploading to a dataset or space, :obj:`None` or :obj:`"model"` if uploading to a model. Default is :obj:`None`. | ||
|
|
||
| exist_ok: Do not raise an error if repo already exists | ||
|
|
||
|
|
@@ -742,19 +742,19 @@ def create_repo( | |
| raise ValueError("Invalid repo type") | ||
|
|
||
| json = {"name": name, "organization": organization, "private": private} | ||
| if repo_type is not None: | ||
| if repo_type is not None and repo_type != "model": | ||
| json["type"] = repo_type | ||
| if repo_type == "space": | ||
| if space_sdk is None: | ||
| raise ValueError( | ||
| "No space_sdk provided. `create_repo` expects space_sdk to be one of " | ||
| f"{SPACES_SDK_TYPES} when repo_type is 'space'`" | ||
| ) | ||
| if space_sdk not in SPACES_SDK_TYPES: | ||
| raise ValueError( | ||
| f"Invalid space_sdk. Please choose one of {SPACES_SDK_TYPES}." | ||
| ) | ||
| json["sdk"] = space_sdk | ||
| elif repo_type == "space": | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually shouldn't this be an Would be nice to add a test for that specific behavior to ensure it's not broken. Thanks @julien-c for raising! |
||
| if space_sdk is None: | ||
| raise ValueError( | ||
| "No space_sdk provided. `create_repo` expects space_sdk to be one of " | ||
| f"{SPACES_SDK_TYPES} when repo_type is 'space'`" | ||
| ) | ||
| if space_sdk not in SPACES_SDK_TYPES: | ||
| raise ValueError( | ||
| f"Invalid space_sdk. Please choose one of {SPACES_SDK_TYPES}." | ||
| ) | ||
| json["sdk"] = space_sdk | ||
| if space_sdk is not None and repo_type != "space": | ||
| warnings.warn( | ||
| "Ignoring provided space_sdk because repo_type is not 'space'." | ||
|
|
@@ -822,7 +822,7 @@ def delete_repo( | |
| raise ValueError("Invalid repo type") | ||
|
|
||
| json = {"name": name, "organization": organization} | ||
| if repo_type is not None: | ||
| if repo_type is not None and repo_type != "model": | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment here, you can remove that |
||
| json["type"] = repo_type | ||
|
|
||
| r = requests.delete( | ||
|
|
@@ -913,7 +913,7 @@ def upload_file( | |
| Authentication token, obtained with :function:`HfApi.login` method. Will default to the stored token. | ||
|
|
||
| repo_type (``str``, Optional): | ||
| Set to :obj:`"dataset"` or :obj:`"space"` if uploading to a dataset or space, :obj:`None` if uploading to a model. Default is :obj:`None`. | ||
| Set to :obj:`"dataset"` or :obj:`"space"` if uploading to a dataset or space, :obj:`None` or :obj:`"model"` if uploading to a model. Default is :obj:`None`. | ||
|
|
||
| revision (``str``, Optional): | ||
| The git revision to commit from. Defaults to the :obj:`"main"` branch. | ||
|
|
@@ -1049,7 +1049,7 @@ def delete_file( | |
| Authentication token, obtained with :function:`HfApi.login` method. Will default to the stored token. | ||
|
|
||
| repo_type (``str``, Optional): | ||
| Set to :obj:`"dataset"` or :obj:`"space"` if the file is in a dataset or space repository, :obj:`None` if in a model. Default is :obj:`None`. | ||
| Set to :obj:`"dataset"` or :obj:`"space"` if the file is in a dataset or space, :obj:`None` or :obj:`"model"` if in a model. Default is :obj:`None`. | ||
|
|
||
| revision (``str``, Optional): | ||
| The git revision to commit from. Defaults to the :obj:`"main"` branch. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.