huggingface-hub 1.0.0rc0__py3-none-any.whl → 1.0.0rc2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of huggingface-hub might be problematic. Click here for more details.

Files changed (48) hide show
  1. huggingface_hub/__init__.py +4 -4
  2. huggingface_hub/_commit_api.py +126 -66
  3. huggingface_hub/_commit_scheduler.py +4 -7
  4. huggingface_hub/_login.py +9 -15
  5. huggingface_hub/_tensorboard_logger.py +2 -5
  6. huggingface_hub/_webhooks_server.py +8 -20
  7. huggingface_hub/cli/__init__.py +0 -14
  8. huggingface_hub/cli/_cli_utils.py +79 -2
  9. huggingface_hub/cli/auth.py +104 -149
  10. huggingface_hub/cli/cache.py +97 -121
  11. huggingface_hub/cli/download.py +93 -110
  12. huggingface_hub/cli/hf.py +37 -41
  13. huggingface_hub/cli/jobs.py +687 -1014
  14. huggingface_hub/cli/lfs.py +116 -139
  15. huggingface_hub/cli/repo.py +290 -214
  16. huggingface_hub/cli/repo_files.py +50 -84
  17. huggingface_hub/cli/system.py +6 -25
  18. huggingface_hub/cli/upload.py +198 -212
  19. huggingface_hub/cli/upload_large_folder.py +90 -105
  20. huggingface_hub/dataclasses.py +3 -12
  21. huggingface_hub/errors.py +1 -1
  22. huggingface_hub/fastai_utils.py +22 -32
  23. huggingface_hub/file_download.py +18 -21
  24. huggingface_hub/hf_api.py +258 -410
  25. huggingface_hub/hf_file_system.py +17 -44
  26. huggingface_hub/inference/_client.py +25 -47
  27. huggingface_hub/inference/_generated/_async_client.py +25 -47
  28. huggingface_hub/inference/_mcp/agent.py +2 -5
  29. huggingface_hub/inference/_mcp/mcp_client.py +2 -5
  30. huggingface_hub/inference/_providers/__init__.py +11 -0
  31. huggingface_hub/inference/_providers/_common.py +1 -0
  32. huggingface_hub/inference/_providers/publicai.py +6 -0
  33. huggingface_hub/inference/_providers/scaleway.py +28 -0
  34. huggingface_hub/lfs.py +14 -8
  35. huggingface_hub/repocard.py +12 -16
  36. huggingface_hub/serialization/_base.py +3 -6
  37. huggingface_hub/serialization/_torch.py +16 -34
  38. huggingface_hub/utils/__init__.py +1 -1
  39. huggingface_hub/utils/_cache_manager.py +41 -71
  40. huggingface_hub/utils/_chunk_utils.py +2 -3
  41. huggingface_hub/utils/_http.py +32 -35
  42. huggingface_hub/utils/logging.py +8 -11
  43. {huggingface_hub-1.0.0rc0.dist-info → huggingface_hub-1.0.0rc2.dist-info}/METADATA +7 -2
  44. {huggingface_hub-1.0.0rc0.dist-info → huggingface_hub-1.0.0rc2.dist-info}/RECORD +48 -46
  45. {huggingface_hub-1.0.0rc0.dist-info → huggingface_hub-1.0.0rc2.dist-info}/LICENSE +0 -0
  46. {huggingface_hub-1.0.0rc0.dist-info → huggingface_hub-1.0.0rc2.dist-info}/WHEEL +0 -0
  47. {huggingface_hub-1.0.0rc0.dist-info → huggingface_hub-1.0.0rc2.dist-info}/entry_points.txt +0 -0
  48. {huggingface_hub-1.0.0rc0.dist-info → huggingface_hub-1.0.0rc2.dist-info}/top_level.txt +0 -0
@@ -21,227 +21,303 @@ Usage:
21
21
  hf repo create my-cool-model --private
22
22
  """
23
23
 
24
- import argparse
25
- from argparse import _SubParsersAction
26
- from typing import Optional
24
+ import enum
25
+ from typing import Annotated, Optional
26
+
27
+ import typer
27
28
 
28
- from huggingface_hub.commands import BaseHuggingfaceCLICommand
29
- from huggingface_hub.commands._cli_utils import ANSI
30
- from huggingface_hub.constants import REPO_TYPES, SPACES_SDK_TYPES
31
29
  from huggingface_hub.errors import HfHubHTTPError, RepositoryNotFoundError, RevisionNotFoundError
32
- from huggingface_hub.hf_api import HfApi
33
30
  from huggingface_hub.utils import logging
34
31
 
32
+ from ._cli_utils import (
33
+ ANSI,
34
+ PrivateOpt,
35
+ RepoIdArg,
36
+ RepoType,
37
+ RepoTypeOpt,
38
+ RevisionOpt,
39
+ TokenOpt,
40
+ get_hf_api,
41
+ typer_factory,
42
+ )
43
+
35
44
 
36
45
  logger = logging.get_logger(__name__)
37
46
 
47
+ repo_cli = typer_factory(help="Manage repos on the Hub.")
48
+ tag_cli = typer_factory(help="Manage tags for a repo on the Hub.")
49
+ branch_cli = typer_factory(help="Manage branches for a repo on the Hub.")
50
+ repo_cli.add_typer(tag_cli, name="tag")
51
+ repo_cli.add_typer(branch_cli, name="branch")
52
+
38
53
 
39
- class RepoCommands(BaseHuggingfaceCLICommand):
40
- @staticmethod
41
- def register_subcommand(parser: _SubParsersAction):
42
- repo_parser = parser.add_parser("repo", help="Manage repos on the Hub.")
43
- repo_subparsers = repo_parser.add_subparsers(help="huggingface.co repos related commands")
44
-
45
- # Show help if no subcommand is provided
46
- repo_parser.set_defaults(func=lambda args: repo_parser.print_help())
47
-
48
- # CREATE
49
- repo_create_parser = repo_subparsers.add_parser("create", help="Create a new repo on huggingface.co")
50
- repo_create_parser.add_argument(
51
- "repo_id",
52
- type=str,
53
- help="The ID of the repo to create to (e.g. `username/repo-name`). The username is optional and will be set to your username if not provided.",
54
- )
55
- repo_create_parser.add_argument(
56
- "--repo-type",
57
- type=str,
58
- help='Optional: set to "dataset" or "space" if creating a dataset or space, default is model.',
59
- )
60
- repo_create_parser.add_argument(
61
- "--space_sdk",
62
- type=str,
63
- help='Optional: Hugging Face Spaces SDK type. Required when --type is set to "space".',
64
- choices=SPACES_SDK_TYPES,
65
- )
66
- repo_create_parser.add_argument(
67
- "--private",
68
- action="store_true",
69
- help="Whether to create a private repository. Defaults to public unless the organization's default is private.",
70
- )
71
- repo_create_parser.add_argument(
72
- "--token",
73
- type=str,
74
- help="Hugging Face token. Will default to the locally saved token if not provided.",
75
- )
76
- repo_create_parser.add_argument(
77
- "--exist-ok",
78
- action="store_true",
54
+ class GatedChoices(str, enum.Enum):
55
+ auto = "auto"
56
+ manual = "manual"
57
+ false = "false"
58
+
59
+
60
+ @repo_cli.command("create", help="Create a new repo on the Hub.")
61
+ def repo_create(
62
+ repo_id: RepoIdArg,
63
+ repo_type: RepoTypeOpt = RepoType.model,
64
+ space_sdk: Annotated[
65
+ Optional[str],
66
+ typer.Option(
67
+ help="Hugging Face Spaces SDK type. Required when --type is set to 'space'.",
68
+ ),
69
+ ] = None,
70
+ private: PrivateOpt = False,
71
+ token: TokenOpt = None,
72
+ exist_ok: Annotated[
73
+ bool,
74
+ typer.Option(
79
75
  help="Do not raise an error if repo already exists.",
80
- )
81
- repo_create_parser.add_argument(
82
- "--resource-group-id",
83
- type=str,
76
+ ),
77
+ ] = False,
78
+ resource_group_id: Annotated[
79
+ Optional[str],
80
+ typer.Option(
84
81
  help="Resource group in which to create the repo. Resource groups is only available for Enterprise Hub organizations.",
85
- )
86
- repo_create_parser.set_defaults(func=lambda args: RepoCreateCommand(args))
87
-
88
- # TAG SUBCOMMANDS
89
- repo_tag_parser = repo_subparsers.add_parser("tag", help="Manage tags for a repo on the Hub.")
90
- tag_subparsers = repo_tag_parser.add_subparsers(help="Tag actions", dest="tag_action", required=True)
91
-
92
- # tag create
93
- tag_create_parser = tag_subparsers.add_parser("create", help="Create a tag for a repo.")
94
- tag_create_parser.add_argument(
95
- "repo_id", type=str, help="The ID of the repo to tag (e.g. `username/repo-name`)."
96
- )
97
- tag_create_parser.add_argument("tag", type=str, help="The name of the tag to create.")
98
- tag_create_parser.add_argument("-m", "--message", type=str, help="The description of the tag to create.")
99
- tag_create_parser.add_argument("--revision", type=str, help="The git revision to tag.")
100
- tag_create_parser.add_argument(
101
- "--token", type=str, help="A User Access Token generated from https://huggingface.co/settings/tokens."
102
- )
103
- tag_create_parser.add_argument(
104
- "--repo-type",
105
- choices=["model", "dataset", "space"],
106
- default="model",
107
- help="Set the type of repository (model, dataset, or space).",
108
- )
109
- tag_create_parser.set_defaults(func=lambda args: RepoTagCreateCommand(args))
110
-
111
- # tag list
112
- tag_list_parser = tag_subparsers.add_parser("list", help="List tags for a repo.")
113
- tag_list_parser.add_argument(
114
- "repo_id", type=str, help="The ID of the repo to list tags for (e.g. `username/repo-name`)."
115
- )
116
- tag_list_parser.add_argument(
117
- "--token", type=str, help="A User Access Token generated from https://huggingface.co/settings/tokens."
118
- )
119
- tag_list_parser.add_argument(
120
- "--repo-type",
121
- choices=["model", "dataset", "space"],
122
- default="model",
123
- help="Set the type of repository (model, dataset, or space).",
124
- )
125
- tag_list_parser.set_defaults(func=lambda args: RepoTagListCommand(args))
126
-
127
- # tag delete
128
- tag_delete_parser = tag_subparsers.add_parser("delete", help="Delete a tag from a repo.")
129
- tag_delete_parser.add_argument(
130
- "repo_id", type=str, help="The ID of the repo to delete the tag from (e.g. `username/repo-name`)."
131
- )
132
- tag_delete_parser.add_argument("tag", type=str, help="The name of the tag to delete.")
133
- tag_delete_parser.add_argument("-y", "--yes", action="store_true", help="Answer Yes to prompts automatically.")
134
- tag_delete_parser.add_argument(
135
- "--token", type=str, help="A User Access Token generated from https://huggingface.co/settings/tokens."
136
- )
137
- tag_delete_parser.add_argument(
138
- "--repo-type",
139
- choices=["model", "dataset", "space"],
140
- default="model",
141
- help="Set the type of repository (model, dataset, or space).",
142
- )
143
- tag_delete_parser.set_defaults(func=lambda args: RepoTagDeleteCommand(args))
144
-
145
-
146
- class RepoCreateCommand:
147
- def __init__(self, args: argparse.Namespace):
148
- self.repo_id: str = args.repo_id
149
- self.repo_type: Optional[str] = args.repo_type
150
- self.space_sdk: Optional[str] = args.space_sdk
151
- self.private: bool = args.private
152
- self.token: Optional[str] = args.token
153
- self.exist_ok: bool = args.exist_ok
154
- self.resource_group_id: Optional[str] = args.resource_group_id
155
- self._api = HfApi()
156
-
157
- def run(self):
158
- repo_url = self._api.create_repo(
159
- repo_id=self.repo_id,
160
- repo_type=self.repo_type,
161
- private=self.private,
162
- token=self.token,
163
- exist_ok=self.exist_ok,
164
- resource_group_id=self.resource_group_id,
165
- space_sdk=self.space_sdk,
166
- )
167
- print(f"Successfully created {ANSI.bold(repo_url.repo_id)} on the Hub.")
168
- print(f"Your repo is now available at {ANSI.bold(repo_url)}")
169
-
170
-
171
- class RepoTagCommand:
172
- def __init__(self, args):
173
- self.args = args
174
- self.api = HfApi(token=getattr(args, "token", None))
175
- self.repo_id = args.repo_id
176
- self.repo_type = getattr(args, "repo_type", "model")
177
- if self.repo_type not in REPO_TYPES:
178
- print("Invalid repo --repo-type")
179
- exit(1)
180
-
181
-
182
- class RepoTagCreateCommand(RepoTagCommand):
183
- def run(self):
184
- print(
185
- f"You are about to create tag {ANSI.bold(str(self.args.tag))} on {self.repo_type} {ANSI.bold(self.repo_id)}"
186
- )
187
- try:
188
- self.api.create_tag(
189
- repo_id=self.repo_id,
190
- tag=self.args.tag,
191
- tag_message=getattr(self.args, "message", None),
192
- revision=getattr(self.args, "revision", None),
193
- repo_type=self.repo_type,
194
- )
195
- except RepositoryNotFoundError:
196
- print(f"{self.repo_type.capitalize()} {ANSI.bold(self.repo_id)} not found.")
197
- exit(1)
198
- except RevisionNotFoundError:
199
- print(f"Revision {ANSI.bold(str(getattr(self.args, 'revision', None)))} not found.")
200
- exit(1)
201
- except HfHubHTTPError as e:
202
- if e.response.status_code == 409:
203
- print(f"Tag {ANSI.bold(str(self.args.tag))} already exists on {ANSI.bold(self.repo_id)}")
204
- exit(1)
205
- raise e
206
- print(f"Tag {ANSI.bold(str(self.args.tag))} created on {ANSI.bold(self.repo_id)}")
207
-
208
-
209
- class RepoTagListCommand(RepoTagCommand):
210
- def run(self):
211
- try:
212
- refs = self.api.list_repo_refs(
213
- repo_id=self.repo_id,
214
- repo_type=self.repo_type,
215
- )
216
- except RepositoryNotFoundError:
217
- print(f"{self.repo_type.capitalize()} {ANSI.bold(self.repo_id)} not found.")
218
- exit(1)
219
- except HfHubHTTPError as e:
220
- print(e)
221
- print(ANSI.red(e.response.text))
222
- exit(1)
223
- if len(refs.tags) == 0:
224
- print("No tags found")
225
- exit(0)
226
- print(f"Tags for {self.repo_type} {ANSI.bold(self.repo_id)}:")
227
- for tag in refs.tags:
228
- print(tag.name)
229
-
230
-
231
- class RepoTagDeleteCommand(RepoTagCommand):
232
- def run(self):
233
- print(f"You are about to delete tag {ANSI.bold(self.args.tag)} on {self.repo_type} {ANSI.bold(self.repo_id)}")
234
- if not getattr(self.args, "yes", False):
235
- choice = input("Proceed? [Y/n] ").lower()
236
- if choice not in ("", "y", "yes"):
237
- print("Abort")
238
- exit()
239
- try:
240
- self.api.delete_tag(repo_id=self.repo_id, tag=self.args.tag, repo_type=self.repo_type)
241
- except RepositoryNotFoundError:
242
- print(f"{self.repo_type.capitalize()} {ANSI.bold(self.repo_id)} not found.")
243
- exit(1)
244
- except RevisionNotFoundError:
245
- print(f"Tag {ANSI.bold(self.args.tag)} not found on {ANSI.bold(self.repo_id)}")
246
- exit(1)
247
- print(f"Tag {ANSI.bold(self.args.tag)} deleted on {ANSI.bold(self.repo_id)}")
82
+ ),
83
+ ] = None,
84
+ ) -> None:
85
+ api = get_hf_api(token=token)
86
+ repo_url = api.create_repo(
87
+ repo_id=repo_id,
88
+ repo_type=repo_type.value,
89
+ private=private,
90
+ token=token,
91
+ exist_ok=exist_ok,
92
+ resource_group_id=resource_group_id,
93
+ space_sdk=space_sdk,
94
+ )
95
+ print(f"Successfully created {ANSI.bold(repo_url.repo_id)} on the Hub.")
96
+ print(f"Your repo is now available at {ANSI.bold(repo_url)}")
97
+
98
+
99
+ @repo_cli.command("delete", help="Delete a repo from the Hub. this is an irreversible operation.")
100
+ def repo_delete(
101
+ repo_id: RepoIdArg,
102
+ repo_type: RepoTypeOpt = RepoType.model,
103
+ token: TokenOpt = None,
104
+ missing_ok: Annotated[
105
+ bool,
106
+ typer.Option(
107
+ help="If set to True, do not raise an error if repo does not exist.",
108
+ ),
109
+ ] = False,
110
+ ) -> None:
111
+ api = get_hf_api(token=token)
112
+ api.delete_repo(
113
+ repo_id=repo_id,
114
+ repo_type=repo_type.value,
115
+ missing_ok=missing_ok,
116
+ )
117
+ print(f"Successfully deleted {ANSI.bold(repo_id)} on the Hub.")
118
+
119
+
120
+ @repo_cli.command("move", help="Move a repository from a namespace to another namespace.")
121
+ def repo_move(
122
+ from_id: RepoIdArg,
123
+ to_id: RepoIdArg,
124
+ token: TokenOpt = None,
125
+ repo_type: RepoTypeOpt = RepoType.model,
126
+ ) -> None:
127
+ api = get_hf_api(token=token)
128
+ api.move_repo(
129
+ from_id=from_id,
130
+ to_id=to_id,
131
+ repo_type=repo_type.value,
132
+ )
133
+ print(f"Successfully moved {ANSI.bold(from_id)} to {ANSI.bold(to_id)} on the Hub.")
134
+
135
+
136
+ @repo_cli.command("settings", help="Update the settings of a repository.")
137
+ def repo_settings(
138
+ repo_id: RepoIdArg,
139
+ gated: Annotated[
140
+ Optional[GatedChoices],
141
+ typer.Option(
142
+ help="The gated status for the repository.",
143
+ ),
144
+ ] = None,
145
+ private: Annotated[
146
+ Optional[bool],
147
+ typer.Option(
148
+ help="Whether the repository should be private.",
149
+ ),
150
+ ] = None,
151
+ xet_enabled: Annotated[
152
+ Optional[bool],
153
+ typer.Option(
154
+ help=" Whether the repository should be enabled for Xet Storage.",
155
+ ),
156
+ ] = None,
157
+ token: TokenOpt = None,
158
+ repo_type: RepoTypeOpt = RepoType.model,
159
+ ) -> None:
160
+ api = get_hf_api(token=token)
161
+ api.update_repo_settings(
162
+ repo_id=repo_id,
163
+ gated=(gated.value if gated else None), # type: ignore [arg-type]
164
+ private=private,
165
+ xet_enabled=xet_enabled,
166
+ repo_type=repo_type.value,
167
+ )
168
+ print(f"Successfully updated the settings of {ANSI.bold(repo_id)} on the Hub.")
169
+
170
+
171
+ @branch_cli.command("create", help="Create a new branch for a repo on the Hub.")
172
+ def branch_create(
173
+ repo_id: RepoIdArg,
174
+ branch: Annotated[
175
+ str,
176
+ typer.Argument(
177
+ help="The name of the branch to create.",
178
+ ),
179
+ ],
180
+ revision: RevisionOpt = None,
181
+ token: TokenOpt = None,
182
+ repo_type: RepoTypeOpt = RepoType.model,
183
+ exist_ok: Annotated[
184
+ bool,
185
+ typer.Option(
186
+ help="If set to True, do not raise an error if branch already exists.",
187
+ ),
188
+ ] = False,
189
+ ) -> None:
190
+ api = get_hf_api(token=token)
191
+ api.create_branch(
192
+ repo_id=repo_id,
193
+ branch=branch,
194
+ revision=revision,
195
+ repo_type=repo_type.value,
196
+ exist_ok=exist_ok,
197
+ )
198
+ print(f"Successfully created {ANSI.bold(branch)} branch on {repo_type.value} {ANSI.bold(repo_id)}")
199
+
200
+
201
+ @branch_cli.command("delete", help="Delete a branch from a repo on the Hub.")
202
+ def branch_delete(
203
+ repo_id: RepoIdArg,
204
+ branch: Annotated[
205
+ str,
206
+ typer.Argument(
207
+ help="The name of the branch to delete.",
208
+ ),
209
+ ],
210
+ token: TokenOpt = None,
211
+ repo_type: RepoTypeOpt = RepoType.model,
212
+ ) -> None:
213
+ api = get_hf_api(token=token)
214
+ api.delete_branch(
215
+ repo_id=repo_id,
216
+ branch=branch,
217
+ repo_type=repo_type.value,
218
+ )
219
+ print(f"Successfully deleted {ANSI.bold(branch)} branch on {repo_type.value} {ANSI.bold(repo_id)}")
220
+
221
+
222
+ @tag_cli.command("create", help="Create a tag for a repo.")
223
+ def tag_create(
224
+ repo_id: RepoIdArg,
225
+ tag: Annotated[
226
+ str,
227
+ typer.Argument(
228
+ help="The name of the tag to create.",
229
+ ),
230
+ ],
231
+ message: Annotated[
232
+ Optional[str],
233
+ typer.Option(
234
+ "-m",
235
+ "--message",
236
+ help="The description of the tag to create.",
237
+ ),
238
+ ] = None,
239
+ revision: RevisionOpt = None,
240
+ token: TokenOpt = None,
241
+ repo_type: RepoTypeOpt = RepoType.model,
242
+ ) -> None:
243
+ repo_type_str = repo_type.value
244
+ api = get_hf_api(token=token)
245
+ print(f"You are about to create tag {ANSI.bold(tag)} on {repo_type_str} {ANSI.bold(repo_id)}")
246
+ try:
247
+ api.create_tag(repo_id=repo_id, tag=tag, tag_message=message, revision=revision, repo_type=repo_type_str)
248
+ except RepositoryNotFoundError:
249
+ print(f"{repo_type_str.capitalize()} {ANSI.bold(repo_id)} not found.")
250
+ raise typer.Exit(code=1)
251
+ except RevisionNotFoundError:
252
+ print(f"Revision {ANSI.bold(str(revision))} not found.")
253
+ raise typer.Exit(code=1)
254
+ except HfHubHTTPError as e:
255
+ if e.response.status_code == 409:
256
+ print(f"Tag {ANSI.bold(tag)} already exists on {ANSI.bold(repo_id)}")
257
+ raise typer.Exit(code=1)
258
+ raise e
259
+ print(f"Tag {ANSI.bold(tag)} created on {ANSI.bold(repo_id)}")
260
+
261
+
262
+ @tag_cli.command("list", help="List tags for a repo.")
263
+ def tag_list(
264
+ repo_id: RepoIdArg,
265
+ token: TokenOpt = None,
266
+ repo_type: RepoTypeOpt = RepoType.model,
267
+ ) -> None:
268
+ repo_type_str = repo_type.value
269
+ api = get_hf_api(token=token)
270
+ try:
271
+ refs = api.list_repo_refs(repo_id=repo_id, repo_type=repo_type_str)
272
+ except RepositoryNotFoundError:
273
+ print(f"{repo_type_str.capitalize()} {ANSI.bold(repo_id)} not found.")
274
+ raise typer.Exit(code=1)
275
+ except HfHubHTTPError as e:
276
+ print(e)
277
+ print(ANSI.red(e.response.text))
278
+ raise typer.Exit(code=1)
279
+ if len(refs.tags) == 0:
280
+ print("No tags found")
281
+ raise typer.Exit(code=0)
282
+ print(f"Tags for {repo_type_str} {ANSI.bold(repo_id)}:")
283
+ for t in refs.tags:
284
+ print(t.name)
285
+
286
+
287
+ @tag_cli.command("delete", help="Delete a tag for a repo.")
288
+ def tag_delete(
289
+ repo_id: RepoIdArg,
290
+ tag: Annotated[
291
+ str,
292
+ typer.Argument(
293
+ help="The name of the tag to delete.",
294
+ ),
295
+ ],
296
+ yes: Annotated[
297
+ bool,
298
+ typer.Option(
299
+ "-y",
300
+ "--yes",
301
+ help="Answer Yes to prompt automatically",
302
+ ),
303
+ ] = False,
304
+ token: TokenOpt = None,
305
+ repo_type: RepoTypeOpt = RepoType.model,
306
+ ) -> None:
307
+ repo_type_str = repo_type.value
308
+ print(f"You are about to delete tag {ANSI.bold(tag)} on {repo_type_str} {ANSI.bold(repo_id)}")
309
+ if not yes:
310
+ choice = input("Proceed? [Y/n] ").lower()
311
+ if choice not in ("", "y", "yes"):
312
+ print("Abort")
313
+ raise typer.Exit()
314
+ api = get_hf_api(token=token)
315
+ try:
316
+ api.delete_tag(repo_id=repo_id, tag=tag, repo_type=repo_type_str)
317
+ except RepositoryNotFoundError:
318
+ print(f"{repo_type_str.capitalize()} {ANSI.bold(repo_id)} not found.")
319
+ raise typer.Exit(code=1)
320
+ except RevisionNotFoundError:
321
+ print(f"Tag {ANSI.bold(tag)} not found on {ANSI.bold(repo_id)}")
322
+ raise typer.Exit(code=1)
323
+ print(f"Tag {ANSI.bold(tag)} deleted on {ANSI.bold(repo_id)}")