huggingface-hub 1.0.0rc6__py3-none-any.whl → 1.0.1__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 (38) hide show
  1. huggingface_hub/__init__.py +10 -1
  2. huggingface_hub/_commit_api.py +1 -5
  3. huggingface_hub/_jobs_api.py +1 -1
  4. huggingface_hub/_login.py +3 -3
  5. huggingface_hub/_snapshot_download.py +4 -3
  6. huggingface_hub/_upload_large_folder.py +2 -15
  7. huggingface_hub/_webhooks_server.py +1 -1
  8. huggingface_hub/cli/_cli_utils.py +1 -1
  9. huggingface_hub/cli/auth.py +0 -20
  10. huggingface_hub/cli/cache.py +561 -304
  11. huggingface_hub/cli/download.py +2 -2
  12. huggingface_hub/cli/repo.py +0 -7
  13. huggingface_hub/cli/upload.py +0 -8
  14. huggingface_hub/community.py +16 -8
  15. huggingface_hub/constants.py +10 -11
  16. huggingface_hub/file_download.py +9 -61
  17. huggingface_hub/hf_api.py +201 -132
  18. huggingface_hub/hf_file_system.py +32 -7
  19. huggingface_hub/inference/_client.py +1 -1
  20. huggingface_hub/inference/_common.py +1 -10
  21. huggingface_hub/inference/_generated/_async_client.py +1 -1
  22. huggingface_hub/inference/_providers/__init__.py +15 -2
  23. huggingface_hub/inference/_providers/_common.py +39 -0
  24. huggingface_hub/inference/_providers/clarifai.py +13 -0
  25. huggingface_hub/lfs.py +3 -65
  26. huggingface_hub/repocard_data.py +1 -1
  27. huggingface_hub/serialization/_torch.py +1 -1
  28. huggingface_hub/utils/__init__.py +0 -2
  29. huggingface_hub/utils/_cache_manager.py +17 -42
  30. huggingface_hub/utils/_http.py +25 -3
  31. huggingface_hub/utils/_parsing.py +98 -0
  32. huggingface_hub/utils/_runtime.py +1 -14
  33. {huggingface_hub-1.0.0rc6.dist-info → huggingface_hub-1.0.1.dist-info}/METADATA +5 -21
  34. {huggingface_hub-1.0.0rc6.dist-info → huggingface_hub-1.0.1.dist-info}/RECORD +38 -36
  35. {huggingface_hub-1.0.0rc6.dist-info → huggingface_hub-1.0.1.dist-info}/LICENSE +0 -0
  36. {huggingface_hub-1.0.0rc6.dist-info → huggingface_hub-1.0.1.dist-info}/WHEEL +0 -0
  37. {huggingface_hub-1.0.0rc6.dist-info → huggingface_hub-1.0.1.dist-info}/entry_points.txt +0 -0
  38. {huggingface_hub-1.0.0rc6.dist-info → huggingface_hub-1.0.1.dist-info}/top_level.txt +0 -0
huggingface_hub/hf_api.py CHANGED
@@ -145,7 +145,6 @@ ExpandModelProperty_T = Literal[
145
145
  "trendingScore",
146
146
  "usedStorage",
147
147
  "widgetData",
148
- "xetEnabled",
149
148
  ]
150
149
 
151
150
  ExpandDatasetProperty_T = Literal[
@@ -168,7 +167,6 @@ ExpandDatasetProperty_T = Literal[
168
167
  "tags",
169
168
  "trendingScore",
170
169
  "usedStorage",
171
- "xetEnabled",
172
170
  ]
173
171
 
174
172
  ExpandSpaceProperty_T = Literal[
@@ -190,7 +188,6 @@ ExpandSpaceProperty_T = Literal[
190
188
  "tags",
191
189
  "trendingScore",
192
190
  "usedStorage",
193
- "xetEnabled",
194
191
  ]
195
192
 
196
193
  USERNAME_PLACEHOLDER = "hf_user"
@@ -395,7 +392,7 @@ class CommitInfo(str):
395
392
 
396
393
  # Computed from `pr_url` in `__post_init__`
397
394
  pr_revision: Optional[str] = field(init=False)
398
- pr_num: Optional[str] = field(init=False)
395
+ pr_num: Optional[int] = field(init=False)
399
396
 
400
397
  def __new__(cls, *args, commit_url: str, **kwargs):
401
398
  return str.__new__(cls, commit_url)
@@ -801,7 +798,6 @@ class ModelInfo:
801
798
  spaces: Optional[list[str]]
802
799
  safetensors: Optional[SafeTensorsInfo]
803
800
  security_repo_status: Optional[dict]
804
- xet_enabled: Optional[bool]
805
801
 
806
802
  def __init__(self, **kwargs):
807
803
  self.id = kwargs.pop("id")
@@ -889,7 +885,6 @@ class ModelInfo:
889
885
  else None
890
886
  )
891
887
  self.security_repo_status = kwargs.pop("securityRepoStatus", None)
892
- self.xet_enabled = kwargs.pop("xetEnabled", None)
893
888
  # backwards compatibility
894
889
  self.lastModified = self.last_modified
895
890
  self.cardData = self.card_data
@@ -960,7 +955,6 @@ class DatasetInfo:
960
955
  trending_score: Optional[int]
961
956
  card_data: Optional[DatasetCardData]
962
957
  siblings: Optional[list[RepoSibling]]
963
- xet_enabled: Optional[bool]
964
958
 
965
959
  def __init__(self, **kwargs):
966
960
  self.id = kwargs.pop("id")
@@ -1006,7 +1000,6 @@ class DatasetInfo:
1006
1000
  if siblings is not None
1007
1001
  else None
1008
1002
  )
1009
- self.xet_enabled = kwargs.pop("xetEnabled", None)
1010
1003
  # backwards compatibility
1011
1004
  self.lastModified = self.last_modified
1012
1005
  self.cardData = self.card_data
@@ -1085,7 +1078,6 @@ class SpaceInfo:
1085
1078
  runtime: Optional[SpaceRuntime]
1086
1079
  models: Optional[list[str]]
1087
1080
  datasets: Optional[list[str]]
1088
- xet_enabled: Optional[bool]
1089
1081
 
1090
1082
  def __init__(self, **kwargs):
1091
1083
  self.id = kwargs.pop("id")
@@ -1134,7 +1126,6 @@ class SpaceInfo:
1134
1126
  self.runtime = SpaceRuntime(runtime) if runtime else None
1135
1127
  self.models = kwargs.pop("models", None)
1136
1128
  self.datasets = kwargs.pop("datasets", None)
1137
- self.xet_enabled = kwargs.pop("xetEnabled", None)
1138
1129
  # backwards compatibility
1139
1130
  self.lastModified = self.last_modified
1140
1131
  self.cardData = self.card_data
@@ -1367,16 +1358,48 @@ class Organization:
1367
1358
  Name of the organization on the Hub (unique).
1368
1359
  fullname (`str`):
1369
1360
  Organization's full name.
1361
+ details (`str`, *optional*):
1362
+ Organization's description.
1363
+ is_verified (`bool`, *optional*):
1364
+ Whether the organization is verified.
1365
+ is_following (`bool`, *optional*):
1366
+ Whether the authenticated user follows this organization.
1367
+ num_users (`int`, *optional*):
1368
+ Number of members in the organization.
1369
+ num_models (`int`, *optional*):
1370
+ Number of models owned by the organization.
1371
+ num_spaces (`int`, *optional*):
1372
+ Number of Spaces owned by the organization.
1373
+ num_datasets (`int`, *optional*):
1374
+ Number of datasets owned by the organization.
1375
+ num_followers (`int`, *optional*):
1376
+ Number of followers of the organization.
1370
1377
  """
1371
1378
 
1372
1379
  avatar_url: str
1373
1380
  name: str
1374
1381
  fullname: str
1382
+ details: Optional[str] = None
1383
+ is_verified: Optional[bool] = None
1384
+ is_following: Optional[bool] = None
1385
+ num_users: Optional[int] = None
1386
+ num_models: Optional[int] = None
1387
+ num_spaces: Optional[int] = None
1388
+ num_datasets: Optional[int] = None
1389
+ num_followers: Optional[int] = None
1375
1390
 
1376
1391
  def __init__(self, **kwargs) -> None:
1377
1392
  self.avatar_url = kwargs.pop("avatarUrl", "")
1378
1393
  self.name = kwargs.pop("name", "")
1379
1394
  self.fullname = kwargs.pop("fullname", "")
1395
+ self.details = kwargs.pop("details", None)
1396
+ self.is_verified = kwargs.pop("isVerified", None)
1397
+ self.is_following = kwargs.pop("isFollowing", None)
1398
+ self.num_users = kwargs.pop("numUsers", None)
1399
+ self.num_models = kwargs.pop("numModels", None)
1400
+ self.num_spaces = kwargs.pop("numSpaces", None)
1401
+ self.num_datasets = kwargs.pop("numDatasets", None)
1402
+ self.num_followers = kwargs.pop("numFollowers", None)
1380
1403
 
1381
1404
  # forward compatibility
1382
1405
  self.__dict__.update(**kwargs)
@@ -1633,7 +1656,7 @@ class HfApi:
1633
1656
  Args:
1634
1657
  endpoint (`str`, *optional*):
1635
1658
  Endpoint of the Hub. Defaults to <https://huggingface.co>.
1636
- token (Union[bool, str, None], optional):
1659
+ token (`bool` or `str`, *optional*):
1637
1660
  A valid user access token (string). Defaults to the locally saved
1638
1661
  token, which is the recommended method for authentication (see
1639
1662
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -1715,7 +1738,7 @@ class HfApi:
1715
1738
  Call HF API to know "whoami".
1716
1739
 
1717
1740
  Args:
1718
- token (Union[bool, str, None], optional):
1741
+ token (`bool` or `str`, *optional*):
1719
1742
  A valid user access token (string). Defaults to the locally saved
1720
1743
  token, which is the recommended method for authentication (see
1721
1744
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -1838,7 +1861,7 @@ class HfApi:
1838
1861
  expand (`list[ExpandModelProperty_T]`, *optional*):
1839
1862
  List properties to return in the response. When used, only the properties in the list will be returned.
1840
1863
  This parameter cannot be used if `full`, `cardData` or `fetch_config` are passed.
1841
- Possible values are `"author"`, `"cardData"`, `"config"`, `"createdAt"`, `"disabled"`, `"downloads"`, `"downloadsAllTime"`, `"gated"`, `"gguf"`, `"inference"`, `"inferenceProviderMapping"`, `"lastModified"`, `"library_name"`, `"likes"`, `"mask_token"`, `"model-index"`, `"pipeline_tag"`, `"private"`, `"safetensors"`, `"sha"`, `"siblings"`, `"spaces"`, `"tags"`, `"transformersInfo"`, `"trendingScore"`, `"widgetData"`, `"resourceGroup"` and `"xetEnabled"`.
1864
+ Possible values are `"author"`, `"cardData"`, `"config"`, `"createdAt"`, `"disabled"`, `"downloads"`, `"downloadsAllTime"`, `"gated"`, `"gguf"`, `"inference"`, `"inferenceProviderMapping"`, `"lastModified"`, `"library_name"`, `"likes"`, `"mask_token"`, `"model-index"`, `"pipeline_tag"`, `"private"`, `"safetensors"`, `"sha"`, `"siblings"`, `"spaces"`, `"tags"`, `"transformersInfo"`, `"trendingScore"`, `"widgetData"`, and `"resourceGroup"`.
1842
1865
  full (`bool`, *optional*):
1843
1866
  Whether to fetch all model data, including the `last_modified`,
1844
1867
  the `sha`, the files and the `tags`. This is set to `True` by
@@ -1850,7 +1873,7 @@ class HfApi:
1850
1873
  fetch_config (`bool`, *optional*):
1851
1874
  Whether to fetch the model configs as well. This is not included
1852
1875
  in `full` due to its size.
1853
- token (Union[bool, str, None], optional):
1876
+ token (`bool` or `str`, *optional*):
1854
1877
  A valid user access token (string). Defaults to the locally saved
1855
1878
  token, which is the recommended method for authentication (see
1856
1879
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -2049,12 +2072,12 @@ class HfApi:
2049
2072
  expand (`list[ExpandDatasetProperty_T]`, *optional*):
2050
2073
  List properties to return in the response. When used, only the properties in the list will be returned.
2051
2074
  This parameter cannot be used if `full` is passed.
2052
- Possible values are `"author"`, `"cardData"`, `"citation"`, `"createdAt"`, `"disabled"`, `"description"`, `"downloads"`, `"downloadsAllTime"`, `"gated"`, `"lastModified"`, `"likes"`, `"paperswithcode_id"`, `"private"`, `"siblings"`, `"sha"`, `"tags"`, `"trendingScore"`, `"usedStorage"`, `"resourceGroup"` and `"xetEnabled"`.
2075
+ Possible values are `"author"`, `"cardData"`, `"citation"`, `"createdAt"`, `"disabled"`, `"description"`, `"downloads"`, `"downloadsAllTime"`, `"gated"`, `"lastModified"`, `"likes"`, `"paperswithcode_id"`, `"private"`, `"siblings"`, `"sha"`, `"tags"`, `"trendingScore"`, `"usedStorage"`, and `"resourceGroup"`.
2053
2076
  full (`bool`, *optional*):
2054
2077
  Whether to fetch all dataset data, including the `last_modified`,
2055
2078
  the `card_data` and the files. Can contain useful information such as the
2056
2079
  PapersWithCode ID.
2057
- token (Union[bool, str, None], optional):
2080
+ token (`bool` or `str`, *optional*):
2058
2081
  A valid user access token (string). Defaults to the locally saved
2059
2082
  token, which is the recommended method for authentication (see
2060
2083
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -2227,11 +2250,11 @@ class HfApi:
2227
2250
  expand (`list[ExpandSpaceProperty_T]`, *optional*):
2228
2251
  List properties to return in the response. When used, only the properties in the list will be returned.
2229
2252
  This parameter cannot be used if `full` is passed.
2230
- Possible values are `"author"`, `"cardData"`, `"datasets"`, `"disabled"`, `"lastModified"`, `"createdAt"`, `"likes"`, `"models"`, `"private"`, `"runtime"`, `"sdk"`, `"siblings"`, `"sha"`, `"subdomain"`, `"tags"`, `"trendingScore"`, `"usedStorage"`, `"resourceGroup"` and `"xetEnabled"`.
2253
+ Possible values are `"author"`, `"cardData"`, `"datasets"`, `"disabled"`, `"lastModified"`, `"createdAt"`, `"likes"`, `"models"`, `"private"`, `"runtime"`, `"sdk"`, `"siblings"`, `"sha"`, `"subdomain"`, `"tags"`, `"trendingScore"`, `"usedStorage"`, and `"resourceGroup"`.
2231
2254
  full (`bool`, *optional*):
2232
2255
  Whether to fetch all Spaces data, including the `last_modified`, `siblings`
2233
2256
  and `card_data` fields.
2234
- token (Union[bool, str, None], optional):
2257
+ token (`bool` or `str`, *optional*):
2235
2258
  A valid user access token (string). Defaults to the locally saved
2236
2259
  token, which is the recommended method for authentication (see
2237
2260
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -2306,7 +2329,7 @@ class HfApi:
2306
2329
  repo_id (`str`):
2307
2330
  The repository to unlike. Example: `"user/my-cool-model"`.
2308
2331
 
2309
- token (Union[bool, str, None], optional):
2332
+ token (`bool` or `str`, *optional*):
2310
2333
  A valid user access token (string). Defaults to the locally saved
2311
2334
  token, which is the recommended method for authentication (see
2312
2335
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -2356,7 +2379,7 @@ class HfApi:
2356
2379
  Args:
2357
2380
  user (`str`, *optional*):
2358
2381
  Name of the user for which you want to fetch the likes.
2359
- token (Union[bool, str, None], optional):
2382
+ token (`bool` or `str`, *optional*):
2360
2383
  A valid user access token (string). Defaults to the locally saved
2361
2384
  token, which is the recommended method for authentication (see
2362
2385
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -2431,7 +2454,7 @@ class HfApi:
2431
2454
  repo_id (`str`):
2432
2455
  The repository to retrieve . Example: `"user/my-cool-model"`.
2433
2456
 
2434
- token (Union[bool, str, None], optional):
2457
+ token (`bool` or `str`, *optional*):
2435
2458
  A valid user access token (string). Defaults to the locally saved
2436
2459
  token, which is the recommended method for authentication (see
2437
2460
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -2488,8 +2511,8 @@ class HfApi:
2488
2511
  expand (`list[ExpandModelProperty_T]`, *optional*):
2489
2512
  List properties to return in the response. When used, only the properties in the list will be returned.
2490
2513
  This parameter cannot be used if `securityStatus` or `files_metadata` are passed.
2491
- Possible values are `"author"`, `"baseModels"`, `"cardData"`, `"childrenModelCount"`, `"config"`, `"createdAt"`, `"disabled"`, `"downloads"`, `"downloadsAllTime"`, `"gated"`, `"gguf"`, `"inference"`, `"inferenceProviderMapping"`, `"lastModified"`, `"library_name"`, `"likes"`, `"mask_token"`, `"model-index"`, `"pipeline_tag"`, `"private"`, `"safetensors"`, `"sha"`, `"siblings"`, `"spaces"`, `"tags"`, `"transformersInfo"`, `"trendingScore"`, `"widgetData"`, `"usedStorage"`, `"resourceGroup"` and `"xetEnabled"`.
2492
- token (Union[bool, str, None], optional):
2514
+ Possible values are `"author"`, `"baseModels"`, `"cardData"`, `"childrenModelCount"`, `"config"`, `"createdAt"`, `"disabled"`, `"downloads"`, `"downloadsAllTime"`, `"gated"`, `"gguf"`, `"inference"`, `"inferenceProviderMapping"`, `"lastModified"`, `"library_name"`, `"likes"`, `"mask_token"`, `"model-index"`, `"pipeline_tag"`, `"private"`, `"safetensors"`, `"sha"`, `"siblings"`, `"spaces"`, `"tags"`, `"transformersInfo"`, `"trendingScore"`, `"widgetData"`, `"usedStorage"`, and `"resourceGroup"`.
2515
+ token (`bool` or `str`, *optional*):
2493
2516
  A valid user access token (string). Defaults to the locally saved
2494
2517
  token, which is the recommended method for authentication (see
2495
2518
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -2559,8 +2582,8 @@ class HfApi:
2559
2582
  expand (`list[ExpandDatasetProperty_T]`, *optional*):
2560
2583
  List properties to return in the response. When used, only the properties in the list will be returned.
2561
2584
  This parameter cannot be used if `files_metadata` is passed.
2562
- Possible values are `"author"`, `"cardData"`, `"citation"`, `"createdAt"`, `"disabled"`, `"description"`, `"downloads"`, `"downloadsAllTime"`, `"gated"`, `"lastModified"`, `"likes"`, `"paperswithcode_id"`, `"private"`, `"siblings"`, `"sha"`, `"tags"`, `"trendingScore"`,`"usedStorage"`, `"resourceGroup"` and `"xetEnabled"`.
2563
- token (Union[bool, str, None], optional):
2585
+ Possible values are `"author"`, `"cardData"`, `"citation"`, `"createdAt"`, `"disabled"`, `"description"`, `"downloads"`, `"downloadsAllTime"`, `"gated"`, `"lastModified"`, `"likes"`, `"paperswithcode_id"`, `"private"`, `"siblings"`, `"sha"`, `"tags"`, `"trendingScore"`,`"usedStorage"`, and `"resourceGroup"`.
2586
+ token (`bool` or `str`, *optional*):
2564
2587
  A valid user access token (string). Defaults to the locally saved
2565
2588
  token, which is the recommended method for authentication (see
2566
2589
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -2629,8 +2652,8 @@ class HfApi:
2629
2652
  expand (`list[ExpandSpaceProperty_T]`, *optional*):
2630
2653
  List properties to return in the response. When used, only the properties in the list will be returned.
2631
2654
  This parameter cannot be used if `full` is passed.
2632
- Possible values are `"author"`, `"cardData"`, `"createdAt"`, `"datasets"`, `"disabled"`, `"lastModified"`, `"likes"`, `"models"`, `"private"`, `"runtime"`, `"sdk"`, `"siblings"`, `"sha"`, `"subdomain"`, `"tags"`, `"trendingScore"`, `"usedStorage"`, `"resourceGroup"` and `"xetEnabled"`.
2633
- token (Union[bool, str, None], optional):
2655
+ Possible values are `"author"`, `"cardData"`, `"createdAt"`, `"datasets"`, `"disabled"`, `"lastModified"`, `"likes"`, `"models"`, `"private"`, `"runtime"`, `"sdk"`, `"siblings"`, `"sha"`, `"subdomain"`, `"tags"`, `"trendingScore"`, `"usedStorage"`, and `"resourceGroup"`.
2656
+ token (`bool` or `str`, *optional*):
2634
2657
  A valid user access token (string). Defaults to the locally saved
2635
2658
  token, which is the recommended method for authentication (see
2636
2659
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -2702,7 +2725,7 @@ class HfApi:
2702
2725
  files_metadata (`bool`, *optional*):
2703
2726
  Whether or not to retrieve metadata for files in the repository
2704
2727
  (size, LFS metadata, etc). Defaults to `False`.
2705
- token (Union[bool, str, None], optional):
2728
+ token (`bool` or `str`, *optional*):
2706
2729
  A valid user access token (string). Defaults to the locally saved
2707
2730
  token, which is the recommended method for authentication (see
2708
2731
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -2757,7 +2780,7 @@ class HfApi:
2757
2780
  repo_type (`str`, *optional*):
2758
2781
  Set to `"dataset"` or `"space"` if getting repository info from a dataset or a space,
2759
2782
  `None` or `"model"` if getting repository info from a model. Default is `None`.
2760
- token (Union[bool, str, None], optional):
2783
+ token (`bool` or `str`, *optional*):
2761
2784
  A valid user access token (string). Defaults to the locally saved
2762
2785
  token, which is the recommended method for authentication (see
2763
2786
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -2804,7 +2827,7 @@ class HfApi:
2804
2827
  repo_type (`str`, *optional*):
2805
2828
  Set to `"dataset"` or `"space"` if getting repository info from a dataset or a space,
2806
2829
  `None` or `"model"` if getting repository info from a model. Default is `None`.
2807
- token (Union[bool, str, None], optional):
2830
+ token (`bool` or `str`, *optional*):
2808
2831
  A valid user access token (string). Defaults to the locally saved
2809
2832
  token, which is the recommended method for authentication (see
2810
2833
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -2855,7 +2878,7 @@ class HfApi:
2855
2878
  `None` or `"model"` if getting repository info from a model. Default is `None`.
2856
2879
  revision (`str`, *optional*):
2857
2880
  The revision of the repository from which to get the information. Defaults to `"main"` branch.
2858
- token (Union[bool, str, None], optional):
2881
+ token (`bool` or `str`, *optional*):
2859
2882
  A valid user access token (string). Defaults to the locally saved
2860
2883
  token, which is the recommended method for authentication (see
2861
2884
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -2908,7 +2931,7 @@ class HfApi:
2908
2931
  repo_type (`str`, *optional*):
2909
2932
  Set to `"dataset"` or `"space"` if uploading to a dataset or space, `None` or `"model"` if uploading to
2910
2933
  a model. Default is `None`.
2911
- token (Union[bool, str, None], optional):
2934
+ token (`bool` or `str`, *optional*):
2912
2935
  A valid user access token (string). Defaults to the locally saved
2913
2936
  token, which is the recommended method for authentication (see
2914
2937
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -2958,7 +2981,7 @@ class HfApi:
2958
2981
  repo_type (`str`, *optional*):
2959
2982
  The type of the repository from which to get the tree (`"model"`, `"dataset"` or `"space"`.
2960
2983
  Defaults to `"model"`.
2961
- token (Union[bool, str, None], optional):
2984
+ token (`bool` or `str`, *optional*):
2962
2985
  A valid user access token (string). Defaults to the locally saved
2963
2986
  token, which is the recommended method for authentication (see
2964
2987
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -3078,7 +3101,7 @@ class HfApi:
3078
3101
  `None` or `"model"` if listing from a model. Default is `None`.
3079
3102
  include_pull_requests (`bool`, *optional*):
3080
3103
  Whether to include refs from pull requests in the list. Defaults to `False`.
3081
- token (Union[bool, str, None], optional):
3104
+ token (`bool` or `str`, *optional*):
3082
3105
  A valid user access token (string). Defaults to the locally saved
3083
3106
  token, which is the recommended method for authentication (see
3084
3107
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -3150,7 +3173,7 @@ class HfApi:
3150
3173
  repo_type (`str`, *optional*):
3151
3174
  Set to `"dataset"` or `"space"` if listing commits from a dataset or a Space, `None` or `"model"` if
3152
3175
  listing from a model. Default is `None`.
3153
- token (Union[bool, str, None], optional):
3176
+ token (`bool` or `str`, *optional*):
3154
3177
  A valid user access token (string). Defaults to the locally saved
3155
3178
  token, which is the recommended method for authentication (see
3156
3179
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -3245,7 +3268,7 @@ class HfApi:
3245
3268
  repo_type (`str`, *optional*):
3246
3269
  The type of the repository from which to get the information (`"model"`, `"dataset"` or `"space"`.
3247
3270
  Defaults to `"model"`.
3248
- token (Union[bool, str, None], optional):
3271
+ token (`bool` or `str`, *optional*):
3249
3272
  A valid user access token (string). Defaults to the locally saved
3250
3273
  token, which is the recommended method for authentication (see
3251
3274
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -3324,7 +3347,7 @@ class HfApi:
3324
3347
  repo_type (`str`, *optional*):
3325
3348
  Set to `"dataset"` or `"space"` if listing commits from a dataset or a Space, `None` or `"model"` if
3326
3349
  listing from a model. Default is `None`.
3327
- token (Union[bool, str, None], optional):
3350
+ token (`bool` or `str`, *optional*):
3328
3351
  A valid user access token (string). Defaults to the locally saved
3329
3352
  token, which is the recommended method for authentication (see
3330
3353
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -3393,7 +3416,7 @@ class HfApi:
3393
3416
  repo_type (`str`, *optional*):
3394
3417
  Type of repository. Set to `"dataset"` or `"space"` if listing from a dataset or space, `None` or
3395
3418
  `"model"` if listing from a model. Default is `None`.
3396
- token (Union[bool, str, None], optional):
3419
+ token (`bool` or `str`, *optional*):
3397
3420
  A valid user access token (string). Defaults to the locally saved
3398
3421
  token, which is the recommended method for authentication (see
3399
3422
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -3454,7 +3477,7 @@ class HfApi:
3454
3477
  repo_type (`str`, *optional*):
3455
3478
  Type of repository. Set to `"dataset"` or `"space"` if listing from a dataset or space, `None` or
3456
3479
  `"model"` if listing from a model. Default is `None`.
3457
- token (Union[bool, str, None], optional):
3480
+ token (`bool` or `str`, *optional*):
3458
3481
  A valid user access token (string). Defaults to the locally saved
3459
3482
  token, which is the recommended method for authentication (see
3460
3483
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -3517,7 +3540,7 @@ class HfApi:
3517
3540
  repo_id (`str`):
3518
3541
  A namespace (user or an organization) and a repo name separated
3519
3542
  by a `/`.
3520
- token (Union[bool, str, None], optional):
3543
+ token (`bool` or `str`, *optional*):
3521
3544
  A valid user access token (string). Defaults to the locally saved
3522
3545
  token, which is the recommended method for authentication (see
3523
3546
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -3600,11 +3623,6 @@ class HfApi:
3600
3623
  if provided_space_args:
3601
3624
  warnings.warn(f"Ignoring provided {', '.join(provided_space_args)} because repo_type is not 'space'.")
3602
3625
 
3603
- if getattr(self, "_lfsmultipartthresh", None):
3604
- # Testing purposes only.
3605
- # See https://github.com/huggingface/huggingface_hub/pull/733/files#r820604472
3606
- json["lfsmultipartthresh"] = self._lfsmultipartthresh # type: ignore
3607
-
3608
3626
  if resource_group_id is not None:
3609
3627
  json["resourceGroupId"] = resource_group_id
3610
3628
 
@@ -3659,7 +3677,7 @@ class HfApi:
3659
3677
  repo_id (`str`):
3660
3678
  A namespace (user or an organization) and a repo name separated
3661
3679
  by a `/`.
3662
- token (Union[bool, str, None], optional):
3680
+ token (`bool` or `str`, *optional*):
3663
3681
  A valid user access token (string). Defaults to the locally saved
3664
3682
  token, which is the recommended method for authentication (see
3665
3683
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -3702,7 +3720,6 @@ class HfApi:
3702
3720
  private: Optional[bool] = None,
3703
3721
  token: Union[str, bool, None] = None,
3704
3722
  repo_type: Optional[str] = None,
3705
- xet_enabled: Optional[bool] = None,
3706
3723
  ) -> None:
3707
3724
  """
3708
3725
  Update the settings of a repository, including gated access and visibility.
@@ -3728,8 +3745,6 @@ class HfApi:
3728
3745
  repo_type (`str`, *optional*):
3729
3746
  The type of the repository to update settings from (`"model"`, `"dataset"` or `"space"`).
3730
3747
  Defaults to `"model"`.
3731
- xet_enabled (`bool`, *optional*):
3732
- Whether the repository should be enabled for Xet Storage.
3733
3748
  Raises:
3734
3749
  [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
3735
3750
  If gated is not one of "auto", "manual", or False.
@@ -3758,9 +3773,6 @@ class HfApi:
3758
3773
  if private is not None:
3759
3774
  payload["private"] = private
3760
3775
 
3761
- if xet_enabled is not None:
3762
- payload["xetEnabled"] = xet_enabled
3763
-
3764
3776
  if len(payload) == 0:
3765
3777
  raise ValueError("At least one setting must be updated.")
3766
3778
 
@@ -3800,7 +3812,7 @@ class HfApi:
3800
3812
  Set to `"dataset"` or `"space"` if uploading to a dataset or
3801
3813
  space, `None` or `"model"` if uploading to a model. Default is
3802
3814
  `None`.
3803
- token (Union[bool, str, None], optional):
3815
+ token (`bool` or `str`, *optional*):
3804
3816
  A valid user access token (string). Defaults to the locally saved
3805
3817
  token, which is the recommended method for authentication (see
3806
3818
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -3924,7 +3936,7 @@ class HfApi:
3924
3936
  commit_description (`str`, *optional*):
3925
3937
  The description of the commit that will be created
3926
3938
 
3927
- token (Union[bool, str, None], optional):
3939
+ token (`bool` or `str`, *optional*):
3928
3940
  A valid user access token (string). Defaults to the locally saved
3929
3941
  token, which is the recommended method for authentication (see
3930
3942
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -4193,7 +4205,7 @@ class HfApi:
4193
4205
  The list of files to upload. Warning: the objects in this list will be mutated to include information
4194
4206
  relative to the upload. Do not reuse the same objects for multiple commits.
4195
4207
 
4196
- token (Union[bool, str, None], optional):
4208
+ token (`bool` or `str`, *optional*):
4197
4209
  A valid user access token (string). Defaults to the locally saved
4198
4210
  token, which is the recommended method for authentication (see
4199
4211
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -4377,7 +4389,7 @@ class HfApi:
4377
4389
  repo_id (`str`):
4378
4390
  The repository to which the file will be uploaded, for example:
4379
4391
  `"username/custom_transformers"`
4380
- token (Union[bool, str, None], optional):
4392
+ token (`bool` or `str`, *optional*):
4381
4393
  A valid user access token (string). Defaults to the locally saved
4382
4394
  token, which is the recommended method for authentication (see
4383
4395
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -4579,7 +4591,7 @@ class HfApi:
4579
4591
  path_in_repo (`str`, *optional*):
4580
4592
  Relative path of the directory in the repo, for example:
4581
4593
  `"checkpoints/1fec34a/results"`. Will default to the root folder of the repository.
4582
- token (Union[bool, str, None], optional):
4594
+ token (`bool` or `str`, *optional*):
4583
4595
  A valid user access token (string). Defaults to the locally saved
4584
4596
  token, which is the recommended method for authentication (see
4585
4597
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -4753,7 +4765,7 @@ class HfApi:
4753
4765
  repo_id (`str`):
4754
4766
  The repository from which the file will be deleted, for example:
4755
4767
  `"username/custom_transformers"`
4756
- token (Union[bool, str, None], optional):
4768
+ token (`bool` or `str`, *optional*):
4757
4769
  A valid user access token (string). Defaults to the locally saved
4758
4770
  token, which is the recommended method for authentication (see
4759
4771
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -4844,7 +4856,7 @@ class HfApi:
4844
4856
  List of files or folders to delete. Each string can either be
4845
4857
  a file path, a folder path or a Unix shell-style wildcard.
4846
4858
  E.g. `["file.txt", "folder/", "data/*.parquet"]`
4847
- token (Union[bool, str, None], optional):
4859
+ token (`bool` or `str`, *optional*):
4848
4860
  A valid user access token (string). Defaults to the locally saved
4849
4861
  token, which is the recommended method for authentication (see
4850
4862
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -4917,7 +4929,7 @@ class HfApi:
4917
4929
  repo_id (`str`):
4918
4930
  The repository from which the folder will be deleted, for example:
4919
4931
  `"username/custom_transformers"`
4920
- token (Union[bool, str, None], optional):
4932
+ token (`bool` or `str`, *optional*):
4921
4933
  A valid user access token (string). Defaults to the locally saved
4922
4934
  token, which is the recommended method for authentication (see
4923
4935
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -5052,14 +5064,13 @@ class HfApi:
5052
5064
  4. Pre-upload LFS file if at least 1 file and no worker is pre-uploading.
5053
5065
  5. Hash file if at least 1 file and no worker is hashing.
5054
5066
  6. Get upload mode if at least 1 file and no worker is getting upload mode.
5055
- 7. Pre-upload LFS file if at least 1 file (exception: if hf_transfer is enabled, only 1 worker can preupload LFS at a time).
5067
+ 7. Pre-upload LFS file if at least 1 file.
5056
5068
  8. Hash file if at least 1 file to hash.
5057
5069
  9. Get upload mode if at least 1 file to get upload mode.
5058
5070
  10. Commit if at least 1 file to commit and at least 1 min since last commit attempt.
5059
5071
  11. Commit if at least 1 file to commit and all other queues are empty.
5060
5072
 
5061
5073
  Special rules:
5062
- - If `hf_transfer` is enabled, only 1 LFS uploader at a time. Otherwise the CPU would be bloated by `hf_transfer`.
5063
5074
  - Only one worker can commit at a time.
5064
5075
  - If no tasks are available, the worker waits for 10 seconds before checking again.
5065
5076
  """
@@ -5090,7 +5101,7 @@ class HfApi:
5090
5101
  Args:
5091
5102
  url (`str`):
5092
5103
  File url, for example returned by [`hf_hub_url`].
5093
- token (Union[bool, str, None], optional):
5104
+ token (`bool` or `str`, *optional*):
5094
5105
  A valid user access token (string). Defaults to the locally saved
5095
5106
  token, which is the recommended method for authentication (see
5096
5107
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -5226,7 +5237,7 @@ class HfApi:
5226
5237
  etag_timeout (`float`, *optional*, defaults to `10`):
5227
5238
  When fetching ETag, how many seconds to wait for the server to send
5228
5239
  data before giving up which is passed to `httpx.request`.
5229
- token (Union[bool, str, None], optional):
5240
+ token (`bool` or `str`, *optional*):
5230
5241
  A valid user access token (string). Defaults to the locally saved
5231
5242
  token, which is the recommended method for authentication (see
5232
5243
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -5336,7 +5347,7 @@ class HfApi:
5336
5347
  data before giving up which is passed to `httpx.request`.
5337
5348
  force_download (`bool`, *optional*, defaults to `False`):
5338
5349
  Whether the file should be downloaded even if it already exists in the local cache.
5339
- token (Union[bool, str, None], optional):
5350
+ token (`bool` or `str`, *optional*):
5340
5351
  A valid user access token (string). Defaults to the locally saved
5341
5352
  token, which is the recommended method for authentication (see
5342
5353
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -5428,7 +5439,7 @@ class HfApi:
5428
5439
  revision (`str`, *optional*):
5429
5440
  The git revision to fetch the file from. Can be a branch name, a tag, or a commit hash. Defaults to the
5430
5441
  head of the `"main"` branch.
5431
- token (Union[bool, str, None], optional):
5442
+ token (`bool` or `str`, *optional*):
5432
5443
  A valid user access token (string). Defaults to the locally saved
5433
5444
  token, which is the recommended method for authentication (see
5434
5445
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -5567,7 +5578,7 @@ class HfApi:
5567
5578
  revision (`str`, *optional*):
5568
5579
  The git revision to fetch the file from. Can be a branch name, a tag, or a commit hash. Defaults to the
5569
5580
  head of the `"main"` branch.
5570
- token (Union[bool, str, None], optional):
5581
+ token (`bool` or `str`, *optional*):
5571
5582
  A valid user access token (string). Defaults to the locally saved
5572
5583
  token, which is the recommended method for authentication (see
5573
5584
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -5671,7 +5682,7 @@ class HfApi:
5671
5682
  the OID/SHA of a commit, as a hexadecimal string. Defaults to the head
5672
5683
  of the `"main"` branch.
5673
5684
 
5674
- token (Union[bool, str, None], optional):
5685
+ token (`bool` or `str`, *optional*):
5675
5686
  A valid user access token (string). Defaults to the locally saved
5676
5687
  token, which is the recommended method for authentication (see
5677
5688
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -5743,7 +5754,7 @@ class HfApi:
5743
5754
  branch (`str`):
5744
5755
  The name of the branch to delete.
5745
5756
 
5746
- token (Union[bool, str, None], optional):
5757
+ token (`bool` or `str`, *optional*):
5747
5758
  A valid user access token (string). Defaults to the locally saved
5748
5759
  token, which is the recommended method for authentication (see
5749
5760
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -5806,7 +5817,7 @@ class HfApi:
5806
5817
  commit, as a hexadecimal string. Shorthands (7 first characters) are
5807
5818
  also supported. Defaults to the head of the `"main"` branch.
5808
5819
 
5809
- token (Union[bool, str, None], optional):
5820
+ token (`bool` or `str`, *optional*):
5810
5821
  A valid user access token (string). Defaults to the locally saved
5811
5822
  token, which is the recommended method for authentication (see
5812
5823
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -5869,7 +5880,7 @@ class HfApi:
5869
5880
  tag (`str`):
5870
5881
  The name of the tag to delete.
5871
5882
 
5872
- token (Union[bool, str, None], optional):
5883
+ token (`bool` or `str`, *optional*):
5873
5884
  A valid user access token (string). Defaults to the locally saved
5874
5885
  token, which is the recommended method for authentication (see
5875
5886
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -5916,7 +5927,7 @@ class HfApi:
5916
5927
  organization (`str`, *optional*):
5917
5928
  If passed, the repository name will be in the organization
5918
5929
  namespace instead of the user namespace.
5919
- token (Union[bool, str, None], optional):
5930
+ token (`bool` or `str`, *optional*):
5920
5931
  A valid user access token (string). Defaults to the locally saved
5921
5932
  token, which is the recommended method for authentication (see
5922
5933
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -5970,7 +5981,7 @@ class HfApi:
5970
5981
  Set to `"dataset"` or `"space"` if fetching from a dataset or
5971
5982
  space, `None` or `"model"` if fetching from a model. Default is
5972
5983
  `None`.
5973
- token (Union[bool, str, None], optional):
5984
+ token (`bool` or `str`, *optional*):
5974
5985
  A valid user access token (string). Defaults to the locally saved
5975
5986
  token, which is the recommended method for authentication (see
5976
5987
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -6065,7 +6076,7 @@ class HfApi:
6065
6076
  Set to `"dataset"` or `"space"` if uploading to a dataset or
6066
6077
  space, `None` or `"model"` if uploading to a model. Default is
6067
6078
  `None`.
6068
- token (Union[bool, str, None], optional):
6079
+ token (`bool` or `str`, *optional*):
6069
6080
  A valid user access token (string). Defaults to the locally saved
6070
6081
  token, which is the recommended method for authentication (see
6071
6082
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -6145,7 +6156,7 @@ class HfApi:
6145
6156
  The title of the discussion. It can be up to 200 characters long,
6146
6157
  and must be at least 3 characters long. Leading and trailing whitespaces
6147
6158
  will be stripped.
6148
- token (Union[bool, str, None], optional):
6159
+ token (`bool` or `str`, *optional*):
6149
6160
  A valid user access token (string). Defaults to the locally saved
6150
6161
  token, which is the recommended method for authentication (see
6151
6162
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -6233,7 +6244,7 @@ class HfApi:
6233
6244
  The title of the discussion. It can be up to 200 characters long,
6234
6245
  and must be at least 3 characters long. Leading and trailing whitespaces
6235
6246
  will be stripped.
6236
- token (Union[bool, str, None], optional):
6247
+ token (`bool` or `str`, *optional*):
6237
6248
  A valid user access token (string). Defaults to the locally saved
6238
6249
  token, which is the recommended method for authentication (see
6239
6250
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -6317,7 +6328,7 @@ class HfApi:
6317
6328
  Set to `"dataset"` or `"space"` if uploading to a dataset or
6318
6329
  space, `None` or `"model"` if uploading to a model. Default is
6319
6330
  `None`.
6320
- token (Union[bool, str, None], optional):
6331
+ token (`bool` or `str`, *optional*):
6321
6332
  A valid user access token (string). Defaults to the locally saved
6322
6333
  token, which is the recommended method for authentication (see
6323
6334
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -6393,7 +6404,7 @@ class HfApi:
6393
6404
  Set to `"dataset"` or `"space"` if uploading to a dataset or
6394
6405
  space, `None` or `"model"` if uploading to a model. Default is
6395
6406
  `None`.
6396
- token (Union[bool, str, None], optional):
6407
+ token (`bool` or `str`, *optional*):
6397
6408
  A valid user access token (string). Defaults to the locally saved
6398
6409
  token, which is the recommended method for authentication (see
6399
6410
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -6463,7 +6474,7 @@ class HfApi:
6463
6474
  Set to `"dataset"` or `"space"` if uploading to a dataset or
6464
6475
  space, `None` or `"model"` if uploading to a model. Default is
6465
6476
  `None`.
6466
- token (Union[bool, str, None], optional):
6477
+ token (`bool` or `str`, *optional*):
6467
6478
  A valid user access token (string). Defaults to the locally saved
6468
6479
  token, which is the recommended method for authentication (see
6469
6480
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -6535,7 +6546,7 @@ class HfApi:
6535
6546
  Set to `"dataset"` or `"space"` if uploading to a dataset or
6536
6547
  space, `None` or `"model"` if uploading to a model. Default is
6537
6548
  `None`.
6538
- token (Union[bool, str, None], optional):
6549
+ token (`bool` or `str`, *optional*):
6539
6550
  A valid user access token (string). Defaults to the locally saved
6540
6551
  token, which is the recommended method for authentication (see
6541
6552
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -6591,7 +6602,7 @@ class HfApi:
6591
6602
  Set to `"dataset"` or `"space"` if uploading to a dataset or
6592
6603
  space, `None` or `"model"` if uploading to a model. Default is
6593
6604
  `None`.
6594
- token (Union[bool, str, None], optional):
6605
+ token (`bool` or `str`, *optional*):
6595
6606
  A valid user access token (string). Defaults to the locally saved
6596
6607
  token, which is the recommended method for authentication (see
6597
6608
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -6648,7 +6659,7 @@ class HfApi:
6648
6659
  Set to `"dataset"` or `"space"` if uploading to a dataset or
6649
6660
  space, `None` or `"model"` if uploading to a model. Default is
6650
6661
  `None`.
6651
- token (Union[bool, str, None], optional):
6662
+ token (`bool` or `str`, *optional*):
6652
6663
  A valid user access token (string). Defaults to the locally saved
6653
6664
  token, which is the recommended method for authentication (see
6654
6665
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -6705,7 +6716,7 @@ class HfApi:
6705
6716
  Secret value. Example: `"your_github_api_key"`.
6706
6717
  description (`str`, *optional*):
6707
6718
  Secret description. Example: `"Github API key to access the Github API"`.
6708
- token (Union[bool, str, None], optional):
6719
+ token (`bool` or `str`, *optional*):
6709
6720
  A valid user access token (string). Defaults to the locally saved
6710
6721
  token, which is the recommended method for authentication (see
6711
6722
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -6733,7 +6744,7 @@ class HfApi:
6733
6744
  ID of the repo to update. Example: `"bigcode/in-the-stack"`.
6734
6745
  key (`str`):
6735
6746
  Secret key. Example: `"GITHUB_API_KEY"`.
6736
- token (Union[bool, str, None], optional):
6747
+ token (`bool` or `str`, *optional*):
6737
6748
  A valid user access token (string). Defaults to the locally saved
6738
6749
  token, which is the recommended method for authentication (see
6739
6750
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -6757,7 +6768,7 @@ class HfApi:
6757
6768
  Args:
6758
6769
  repo_id (`str`):
6759
6770
  ID of the repo to query. Example: `"bigcode/in-the-stack"`.
6760
- token (Union[bool, str, None], optional):
6771
+ token (`bool` or `str`, *optional*):
6761
6772
  A valid user access token (string). Defaults to the locally saved
6762
6773
  token, which is the recommended method for authentication (see
6763
6774
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -6794,7 +6805,7 @@ class HfApi:
6794
6805
  Variable value. Example: `"the_model_repo_id"`.
6795
6806
  description (`str`):
6796
6807
  Description of the variable. Example: `"Model Repo ID of the implemented model"`.
6797
- token (Union[bool, str, None], optional):
6808
+ token (`bool` or `str`, *optional*):
6798
6809
  A valid user access token (string). Defaults to the locally saved
6799
6810
  token, which is the recommended method for authentication (see
6800
6811
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -6825,7 +6836,7 @@ class HfApi:
6825
6836
  ID of the repo to update. Example: `"bigcode/in-the-stack"`.
6826
6837
  key (`str`):
6827
6838
  Variable key. Example: `"MODEL_REPO_ID"`
6828
- token (Union[bool, str, None], optional):
6839
+ token (`bool` or `str`, *optional*):
6829
6840
  A valid user access token (string). Defaults to the locally saved
6830
6841
  token, which is the recommended method for authentication (see
6831
6842
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -6847,7 +6858,7 @@ class HfApi:
6847
6858
  Args:
6848
6859
  repo_id (`str`):
6849
6860
  ID of the repo to update. Example: `"bigcode/in-the-stack"`.
6850
- token (Union[bool, str, None], optional):
6861
+ token (`bool` or `str`, *optional*):
6851
6862
  A valid user access token (string). Defaults to the locally saved
6852
6863
  token, which is the recommended method for authentication (see
6853
6864
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -6877,7 +6888,7 @@ class HfApi:
6877
6888
  ID of the repo to update. Example: `"bigcode/in-the-stack"`.
6878
6889
  hardware (`str` or [`SpaceHardware`]):
6879
6890
  Hardware on which to run the Space. Example: `"t4-medium"`.
6880
- token (Union[bool, str, None], optional):
6891
+ token (`bool` or `str`, *optional*):
6881
6892
  A valid user access token (string). Defaults to the locally saved
6882
6893
  token, which is the recommended method for authentication (see
6883
6894
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -6930,7 +6941,7 @@ class HfApi:
6930
6941
  your Space to pause (default behavior for upgraded hardware). For free hardware, you can't configure
6931
6942
  the sleep time (value is fixed to 48 hours of inactivity).
6932
6943
  See https://huggingface.co/docs/hub/spaces-gpus#sleep-time for more details.
6933
- token (Union[bool, str, None], optional):
6944
+ token (`bool` or `str`, *optional*):
6934
6945
  A valid user access token (string). Defaults to the locally saved
6935
6946
  token, which is the recommended method for authentication (see
6936
6947
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -6972,7 +6983,7 @@ class HfApi:
6972
6983
  Args:
6973
6984
  repo_id (`str`):
6974
6985
  ID of the Space to pause. Example: `"Salesforce/BLIP2"`.
6975
- token (Union[bool, str, None], optional):
6986
+ token (`bool` or `str`, *optional*):
6976
6987
  A valid user access token (string). Defaults to the locally saved
6977
6988
  token, which is the recommended method for authentication (see
6978
6989
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -7013,7 +7024,7 @@ class HfApi:
7013
7024
  Args:
7014
7025
  repo_id (`str`):
7015
7026
  ID of the Space to restart. Example: `"Salesforce/BLIP2"`.
7016
- token (Union[bool, str, None], optional):
7027
+ token (`bool` or `str`, *optional*):
7017
7028
  A valid user access token (string). Defaults to the locally saved
7018
7029
  token, which is the recommended method for authentication (see
7019
7030
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -7072,7 +7083,7 @@ class HfApi:
7072
7083
  name as the original Space, but in your account.
7073
7084
  private (`bool`, *optional*):
7074
7085
  Whether the new Space should be private or not. Defaults to the same privacy as the original Space.
7075
- token (Union[bool, str, None], optional):
7086
+ token (`bool` or `str`, *optional*):
7076
7087
  A valid user access token (string). Defaults to the locally saved
7077
7088
  token, which is the recommended method for authentication (see
7078
7089
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -7177,7 +7188,7 @@ class HfApi:
7177
7188
  ID of the Space to update. Example: `"open-llm-leaderboard/open_llm_leaderboard"`.
7178
7189
  storage (`str` or [`SpaceStorage`]):
7179
7190
  Storage tier. Either 'small', 'medium', or 'large'.
7180
- token (Union[bool, str, None], optional):
7191
+ token (`bool` or `str`, *optional*):
7181
7192
  A valid user access token (string). Defaults to the locally saved
7182
7193
  token, which is the recommended method for authentication (see
7183
7194
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -7210,7 +7221,7 @@ class HfApi:
7210
7221
  Args:
7211
7222
  repo_id (`str`):
7212
7223
  ID of the Space to update. Example: `"open-llm-leaderboard/open_llm_leaderboard"`.
7213
- token (Union[bool, str, None], optional):
7224
+ token (`bool` or `str`, *optional*):
7214
7225
  A valid user access token (string). Defaults to the locally saved
7215
7226
  token, which is the recommended method for authentication (see
7216
7227
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -7242,7 +7253,7 @@ class HfApi:
7242
7253
  namespace (`str`, *optional*):
7243
7254
  The namespace to list endpoints for. Defaults to the current user. Set to `"*"` to list all endpoints
7244
7255
  from all namespaces (i.e. personal namespace and all orgs the user belongs to).
7245
- token (Union[bool, str, None], optional):
7256
+ token (`bool` or `str`, *optional*):
7246
7257
  A valid user access token (string). Defaults to the locally saved
7247
7258
  token, which is the recommended method for authentication (see
7248
7259
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -7371,7 +7382,7 @@ class HfApi:
7371
7382
  A list of tags to associate with the Inference Endpoint.
7372
7383
  namespace (`str`, *optional*):
7373
7384
  The namespace where the Inference Endpoint will be created. Defaults to the current user's namespace.
7374
- token (Union[bool, str, None], optional):
7385
+ token (`bool` or `str`, *optional*):
7375
7386
  A valid user access token (string). Defaults to the locally saved
7376
7387
  token, which is the recommended method for authentication (see
7377
7388
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -7541,7 +7552,7 @@ class HfApi:
7541
7552
  The ID of the model in the catalog to deploy as an Inference Endpoint.
7542
7553
  name (`str`, *optional*):
7543
7554
  The unique name for the new Inference Endpoint. If not provided, a random name will be generated.
7544
- token (Union[bool, str, None], optional):
7555
+ token (`bool` or `str`, *optional*):
7545
7556
  A valid user access token (string). Defaults to the locally saved
7546
7557
  token, which is the recommended method for authentication (see
7547
7558
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -7584,7 +7595,7 @@ class HfApi:
7584
7595
  Use [`create_inference_endpoint_from_catalog`] to deploy a model from the catalog.
7585
7596
 
7586
7597
  Args:
7587
- token (Union[bool, str, None], optional):
7598
+ token (`bool` or `str`, *optional*):
7588
7599
  A valid user access token (string). Defaults to the locally saved
7589
7600
  token, which is the recommended method for authentication (see
7590
7601
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -7612,7 +7623,7 @@ class HfApi:
7612
7623
  The name of the Inference Endpoint to retrieve information about.
7613
7624
  namespace (`str`, *optional*):
7614
7625
  The namespace in which the Inference Endpoint is located. Defaults to the current user.
7615
- token (Union[bool, str, None], optional):
7626
+ token (`bool` or `str`, *optional*):
7616
7627
  A valid user access token (string). Defaults to the locally saved
7617
7628
  token, which is the recommended method for authentication (see
7618
7629
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -7729,7 +7740,7 @@ class HfApi:
7729
7740
 
7730
7741
  namespace (`str`, *optional*):
7731
7742
  The namespace where the Inference Endpoint will be updated. Defaults to the current user's namespace.
7732
- token (Union[bool, str, None], optional):
7743
+ token (`bool` or `str`, *optional*):
7733
7744
  A valid user access token (string). Defaults to the locally saved
7734
7745
  token, which is the recommended method for authentication (see
7735
7746
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -7801,7 +7812,7 @@ class HfApi:
7801
7812
  The name of the Inference Endpoint to delete.
7802
7813
  namespace (`str`, *optional*):
7803
7814
  The namespace in which the Inference Endpoint is located. Defaults to the current user.
7804
- token (Union[bool, str, None], optional):
7815
+ token (`bool` or `str`, *optional*):
7805
7816
  A valid user access token (string). Defaults to the locally saved
7806
7817
  token, which is the recommended method for authentication (see
7807
7818
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -7830,7 +7841,7 @@ class HfApi:
7830
7841
  The name of the Inference Endpoint to pause.
7831
7842
  namespace (`str`, *optional*):
7832
7843
  The namespace in which the Inference Endpoint is located. Defaults to the current user.
7833
- token (Union[bool, str, None], optional):
7844
+ token (`bool` or `str`, *optional*):
7834
7845
  A valid user access token (string). Defaults to the locally saved
7835
7846
  token, which is the recommended method for authentication (see
7836
7847
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -7869,7 +7880,7 @@ class HfApi:
7869
7880
  running_ok (`bool`, *optional*):
7870
7881
  If `True`, the method will not raise an error if the Inference Endpoint is already running. Defaults to
7871
7882
  `True`.
7872
- token (Union[bool, str, None], optional):
7883
+ token (`bool` or `str`, *optional*):
7873
7884
  A valid user access token (string). Defaults to the locally saved
7874
7885
  token, which is the recommended method for authentication (see
7875
7886
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -7911,7 +7922,7 @@ class HfApi:
7911
7922
  The name of the Inference Endpoint to scale to zero.
7912
7923
  namespace (`str`, *optional*):
7913
7924
  The namespace in which the Inference Endpoint is located. Defaults to the current user.
7914
- token (Union[bool, str, None], optional):
7925
+ token (`bool` or `str`, *optional*):
7915
7926
  A valid user access token (string). Defaults to the locally saved
7916
7927
  token, which is the recommended method for authentication (see
7917
7928
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -7969,7 +7980,7 @@ class HfApi:
7969
7980
  Sort collections by last modified, trending or upvotes.
7970
7981
  limit (`int`, *optional*):
7971
7982
  Maximum number of collections to be returned.
7972
- token (Union[bool, str, None], optional):
7983
+ token (`bool` or `str`, *optional*):
7973
7984
  A valid user access token (string). Defaults to the locally saved
7974
7985
  token, which is the recommended method for authentication (see
7975
7986
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -8006,7 +8017,7 @@ class HfApi:
8006
8017
  Args:
8007
8018
  collection_slug (`str`):
8008
8019
  Slug of the collection of the Hub. Example: `"TheBloke/recent-models-64f9a55bb3115b4f513ec026"`.
8009
- token (Union[bool, str, None], optional):
8020
+ token (`bool` or `str`, *optional*):
8010
8021
  A valid user access token (string). Defaults to the locally saved
8011
8022
  token, which is the recommended method for authentication (see
8012
8023
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -8062,7 +8073,7 @@ class HfApi:
8062
8073
  Whether the collection should be private or not. Defaults to `False` (i.e. public collection).
8063
8074
  exists_ok (`bool`, *optional*):
8064
8075
  If `True`, do not raise an error if collection already exists.
8065
- token (Union[bool, str, None], optional):
8076
+ token (`bool` or `str`, *optional*):
8066
8077
  A valid user access token (string). Defaults to the locally saved
8067
8078
  token, which is the recommended method for authentication (see
8068
8079
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -8135,7 +8146,7 @@ class HfApi:
8135
8146
  Whether the collection should be private or not.
8136
8147
  theme (`str`, *optional*):
8137
8148
  Theme of the collection on the Hub.
8138
- token (Union[bool, str, None], optional):
8149
+ token (`bool` or `str`, *optional*):
8139
8150
  A valid user access token (string). Defaults to the locally saved
8140
8151
  token, which is the recommended method for authentication (see
8141
8152
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -8185,7 +8196,7 @@ class HfApi:
8185
8196
  Slug of the collection to delete. Example: `"TheBloke/recent-models-64f9a55bb3115b4f513ec026"`.
8186
8197
  missing_ok (`bool`, *optional*):
8187
8198
  If `True`, do not raise an error if collection doesn't exists.
8188
- token (Union[bool, str, None], optional):
8199
+ token (`bool` or `str`, *optional*):
8189
8200
  A valid user access token (string). Defaults to the locally saved
8190
8201
  token, which is the recommended method for authentication (see
8191
8202
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -8237,7 +8248,7 @@ class HfApi:
8237
8248
  A note to attach to the item in the collection. The maximum size for a note is 500 characters.
8238
8249
  exists_ok (`bool`, *optional*):
8239
8250
  If `True`, do not raise an error if item already exists.
8240
- token (Union[bool, str, None], optional):
8251
+ token (`bool` or `str`, *optional*):
8241
8252
  A valid user access token (string). Defaults to the locally saved
8242
8253
  token, which is the recommended method for authentication (see
8243
8254
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -8316,7 +8327,7 @@ class HfApi:
8316
8327
  A note to attach to the item in the collection. The maximum size for a note is 500 characters.
8317
8328
  position (`int`, *optional*):
8318
8329
  New position of the item in the collection.
8319
- token (Union[bool, str, None], optional):
8330
+ token (`bool` or `str`, *optional*):
8320
8331
  A valid user access token (string). Defaults to the locally saved
8321
8332
  token, which is the recommended method for authentication (see
8322
8333
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -8366,7 +8377,7 @@ class HfApi:
8366
8377
  It must be retrieved from a [`CollectionItem`] object. Example: `collection.items[0].item_object_id`.
8367
8378
  missing_ok (`bool`, *optional*):
8368
8379
  If `True`, do not raise an error if item doesn't exists.
8369
- token (Union[bool, str, None], optional):
8380
+ token (`bool` or `str`, *optional*):
8370
8381
  A valid user access token (string). Defaults to the locally saved
8371
8382
  token, which is the recommended method for authentication (see
8372
8383
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -8423,7 +8434,7 @@ class HfApi:
8423
8434
  repo_type (`str`, *optional*):
8424
8435
  The type of the repo to get access requests for. Must be one of `model`, `dataset` or `space`.
8425
8436
  Defaults to `model`.
8426
- token (Union[bool, str, None], optional):
8437
+ token (`bool` or `str`, *optional*):
8427
8438
  A valid user access token (string). Defaults to the locally saved
8428
8439
  token, which is the recommended method for authentication (see
8429
8440
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -8489,7 +8500,7 @@ class HfApi:
8489
8500
  repo_type (`str`, *optional*):
8490
8501
  The type of the repo to get access requests for. Must be one of `model`, `dataset` or `space`.
8491
8502
  Defaults to `model`.
8492
- token (Union[bool, str, None], optional):
8503
+ token (`bool` or `str`, *optional*):
8493
8504
  A valid user access token (string). Defaults to the locally saved
8494
8505
  token, which is the recommended method for authentication (see
8495
8506
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -8551,7 +8562,7 @@ class HfApi:
8551
8562
  repo_type (`str`, *optional*):
8552
8563
  The type of the repo to get access requests for. Must be one of `model`, `dataset` or `space`.
8553
8564
  Defaults to `model`.
8554
- token (Union[bool, str, None], optional):
8565
+ token (`bool` or `str`, *optional*):
8555
8566
  A valid user access token (string). Defaults to the locally saved
8556
8567
  token, which is the recommended method for authentication (see
8557
8568
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -8640,7 +8651,7 @@ class HfApi:
8640
8651
  repo_type (`str`, *optional*):
8641
8652
  The type of the repo to cancel access request for. Must be one of `model`, `dataset` or `space`.
8642
8653
  Defaults to `model`.
8643
- token (Union[bool, str, None], optional):
8654
+ token (`bool` or `str`, *optional*):
8644
8655
  A valid user access token (string). Defaults to the locally saved
8645
8656
  token, which is the recommended method for authentication (see
8646
8657
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -8682,7 +8693,7 @@ class HfApi:
8682
8693
  repo_type (`str`, *optional*):
8683
8694
  The type of the repo to accept access request for. Must be one of `model`, `dataset` or `space`.
8684
8695
  Defaults to `model`.
8685
- token (Union[bool, str, None], optional):
8696
+ token (`bool` or `str`, *optional*):
8686
8697
  A valid user access token (string). Defaults to the locally saved
8687
8698
  token, which is the recommended method for authentication (see
8688
8699
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -8732,7 +8743,7 @@ class HfApi:
8732
8743
  Defaults to `model`.
8733
8744
  rejection_reason (`str`, *optional*):
8734
8745
  Optional rejection reason that will be visible to the user (max 200 characters).
8735
- token (Union[bool, str, None], optional):
8746
+ token (`bool` or `str`, *optional*):
8736
8747
  A valid user access token (string). Defaults to the locally saved
8737
8748
  token, which is the recommended method for authentication (see
8738
8749
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -8805,7 +8816,7 @@ class HfApi:
8805
8816
  repo_type (`str`, *optional*):
8806
8817
  The type of the repo to grant access to. Must be one of `model`, `dataset` or `space`.
8807
8818
  Defaults to `model`.
8808
- token (Union[bool, str, None], optional):
8819
+ token (`bool` or `str`, *optional*):
8809
8820
  A valid user access token (string). Defaults to the locally saved
8810
8821
  token, which is the recommended method for authentication (see
8811
8822
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -8846,7 +8857,7 @@ class HfApi:
8846
8857
  Args:
8847
8858
  webhook_id (`str`):
8848
8859
  The unique identifier of the webhook to get.
8849
- token (Union[bool, str, None], optional):
8860
+ token (`bool` or `str`, *optional*):
8850
8861
  A valid user access token (string). Defaults to the locally saved token, which is the recommended
8851
8862
  method for authentication (see https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
8852
8863
  To disable authentication, pass `False`.
@@ -8897,7 +8908,7 @@ class HfApi:
8897
8908
  """List all configured webhooks.
8898
8909
 
8899
8910
  Args:
8900
- token (Union[bool, str, None], optional):
8911
+ token (`bool` or `str`, *optional*):
8901
8912
  A valid user access token (string). Defaults to the locally saved token, which is the recommended
8902
8913
  method for authentication (see https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
8903
8914
  To disable authentication, pass `False`.
@@ -8972,7 +8983,7 @@ class HfApi:
8972
8983
  List of domains to watch. It can be "repo", "discussion" or both.
8973
8984
  secret (`str`, optional):
8974
8985
  A secret to sign the payload with.
8975
- token (Union[bool, str, None], optional):
8986
+ token (`bool` or `str`, *optional*):
8976
8987
  A valid user access token (string). Defaults to the locally saved token, which is the recommended
8977
8988
  method for authentication (see https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
8978
8989
  To disable authentication, pass `False`.
@@ -9098,7 +9109,7 @@ class HfApi:
9098
9109
  The domains to watch. This can include "repo", "discussion", or both.
9099
9110
  secret (`str`, optional):
9100
9111
  A secret to sign the payload with, providing an additional layer of security.
9101
- token (Union[bool, str, None], optional):
9112
+ token (`bool` or `str`, *optional*):
9102
9113
  A valid user access token (string). Defaults to the locally saved token, which is the recommended
9103
9114
  method for authentication (see https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
9104
9115
  To disable authentication, pass `False`.
@@ -9161,7 +9172,7 @@ class HfApi:
9161
9172
  Args:
9162
9173
  webhook_id (`str`):
9163
9174
  The unique identifier of the webhook to enable.
9164
- token (Union[bool, str, None], optional):
9175
+ token (`bool` or `str`, *optional*):
9165
9176
  A valid user access token (string). Defaults to the locally saved token, which is the recommended
9166
9177
  method for authentication (see https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
9167
9178
  To disable authentication, pass `False`.
@@ -9214,7 +9225,7 @@ class HfApi:
9214
9225
  Args:
9215
9226
  webhook_id (`str`):
9216
9227
  The unique identifier of the webhook to disable.
9217
- token (Union[bool, str, None], optional):
9228
+ token (`bool` or `str`, *optional*):
9218
9229
  A valid user access token (string). Defaults to the locally saved token, which is the recommended
9219
9230
  method for authentication (see https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
9220
9231
  To disable authentication, pass `False`.
@@ -9267,7 +9278,7 @@ class HfApi:
9267
9278
  Args:
9268
9279
  webhook_id (`str`):
9269
9280
  The unique identifier of the webhook to delete.
9270
- token (Union[bool, str, None], optional):
9281
+ token (`bool` or `str`, *optional*):
9271
9282
  A valid user access token (string). Defaults to the locally saved token, which is the recommended
9272
9283
  method for authentication (see https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
9273
9284
  To disable authentication, pass `False`.
@@ -9427,7 +9438,7 @@ class HfApi:
9427
9438
  repo_type (`str`, *optional*):
9428
9439
  The type of the repo to grant access to. Must be one of `model`, `dataset` or `space`.
9429
9440
  Defaults to `model`.
9430
- token (Union[bool, str, None], optional):
9441
+ token (`bool` or `str`, *optional*):
9431
9442
  A valid user access token (string). Defaults to the locally saved
9432
9443
  token, which is the recommended method for authentication (see
9433
9444
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -9466,7 +9477,7 @@ class HfApi:
9466
9477
  Args:
9467
9478
  username (`str`):
9468
9479
  Username of the user to get an overview of.
9469
- token (Union[bool, str, None], optional):
9480
+ token (`bool` or `str`, *optional*):
9470
9481
  A valid user access token (string). Defaults to the locally saved
9471
9482
  token, which is the recommended method for authentication (see
9472
9483
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -9485,6 +9496,62 @@ class HfApi:
9485
9496
  hf_raise_for_status(r)
9486
9497
  return User(**r.json())
9487
9498
 
9499
+ @validate_hf_hub_args
9500
+ def get_organization_overview(self, organization: str, token: Union[bool, str, None] = None) -> Organization:
9501
+ """
9502
+ Get an overview of an organization on the Hub.
9503
+
9504
+ Args:
9505
+ organization (`str`):
9506
+ Name of the organization to get an overview of.
9507
+ token (`bool` or `str`, *optional*):
9508
+ A valid user access token (string). Defaults to the locally saved token, which is the recommended method
9509
+ for authentication (see https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
9510
+ To disable authentication, pass `False`.
9511
+
9512
+ Returns:
9513
+ `Organization`: An [`Organization`] object with the organization's overview.
9514
+
9515
+ Raises:
9516
+ [`HTTPError`](https://requests.readthedocs.io/en/latest/api/#requests.HTTPError):
9517
+ HTTP 404 If the organization does not exist on the Hub.
9518
+ """
9519
+ r = get_session().get(
9520
+ f"{constants.ENDPOINT}/api/organizations/{organization}/overview",
9521
+ headers=self._build_hf_headers(token=token),
9522
+ )
9523
+ hf_raise_for_status(r)
9524
+ return Organization(**r.json())
9525
+
9526
+ @validate_hf_hub_args
9527
+ def list_organization_followers(self, organization: str, token: Union[bool, str, None] = None) -> Iterable[User]:
9528
+ """
9529
+ List followers of an organization on the Hub.
9530
+
9531
+ Args:
9532
+ organization (`str`):
9533
+ Name of the organization to get the followers of.
9534
+ token (`bool` or `str`, *optional*):
9535
+ A valid user access token (string). Defaults to the locally saved
9536
+ token, which is the recommended method for authentication (see
9537
+ https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
9538
+ To disable authentication, pass `False`.
9539
+
9540
+ Returns:
9541
+ `Iterable[User]`: A list of [`User`] objects with the followers of the organization.
9542
+
9543
+ Raises:
9544
+ [`HfHubHTTPError`]:
9545
+ HTTP 404 If the organization does not exist on the Hub.
9546
+
9547
+ """
9548
+ for follower in paginate(
9549
+ path=f"{constants.ENDPOINT}/api/organizations/{organization}/followers",
9550
+ params={},
9551
+ headers=self._build_hf_headers(token=token),
9552
+ ):
9553
+ yield User(**follower)
9554
+
9488
9555
  def list_organization_members(self, organization: str, token: Union[bool, str, None] = None) -> Iterable[User]:
9489
9556
  """
9490
9557
  List of members of an organization on the Hub.
@@ -9492,7 +9559,7 @@ class HfApi:
9492
9559
  Args:
9493
9560
  organization (`str`):
9494
9561
  Name of the organization to get the members of.
9495
- token (Union[bool, str, None], optional):
9562
+ token (`bool` or `str`, *optional*):
9496
9563
  A valid user access token (string). Defaults to the locally saved
9497
9564
  token, which is the recommended method for authentication (see
9498
9565
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -9520,7 +9587,7 @@ class HfApi:
9520
9587
  Args:
9521
9588
  username (`str`):
9522
9589
  Username of the user to get the followers of.
9523
- token (Union[bool, str, None], optional):
9590
+ token (`bool` or `str`, *optional*):
9524
9591
  A valid user access token (string). Defaults to the locally saved
9525
9592
  token, which is the recommended method for authentication (see
9526
9593
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -9548,7 +9615,7 @@ class HfApi:
9548
9615
  Args:
9549
9616
  username (`str`):
9550
9617
  Username of the user to get the users followed by.
9551
- token (Union[bool, str, None], optional):
9618
+ token (`bool` or `str`, *optional*):
9552
9619
  A valid user access token (string). Defaults to the locally saved
9553
9620
  token, which is the recommended method for authentication (see
9554
9621
  https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
@@ -10775,6 +10842,8 @@ update_webhook = api.update_webhook
10775
10842
 
10776
10843
  # User API
10777
10844
  get_user_overview = api.get_user_overview
10845
+ get_organization_overview = api.get_organization_overview
10846
+ list_organization_followers = api.list_organization_followers
10778
10847
  list_organization_members = api.list_organization_members
10779
10848
  list_user_followers = api.list_user_followers
10780
10849
  list_user_following = api.list_user_following