huggingface-hub 0.24.2__py3-none-any.whl → 0.24.4__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.

@@ -46,7 +46,7 @@ import sys
46
46
  from typing import TYPE_CHECKING
47
47
 
48
48
 
49
- __version__ = "0.24.2"
49
+ __version__ = "0.24.4"
50
50
 
51
51
  # Alphabetical order of definitions is ensured in tests
52
52
  # WARNING: any comment added in this dictionary definition will be lost when
@@ -1951,6 +1951,11 @@ def _chmod_and_move(src: Path, dst: Path) -> None:
1951
1951
  tmp_file.touch()
1952
1952
  cache_dir_mode = Path(tmp_file).stat().st_mode
1953
1953
  os.chmod(str(src), stat.S_IMODE(cache_dir_mode))
1954
+ except OSError as e:
1955
+ logger.warning(
1956
+ f"Could not set the permissions on the file '{src}'. "
1957
+ f"Error: {e}.\nContinuing without setting permissions."
1958
+ )
1954
1959
  finally:
1955
1960
  try:
1956
1961
  tmp_file.unlink()
@@ -1959,7 +1964,21 @@ def _chmod_and_move(src: Path, dst: Path) -> None:
1959
1964
  # See https://github.com/huggingface/huggingface_hub/issues/2359
1960
1965
  pass
1961
1966
 
1962
- shutil.move(str(src), str(dst))
1967
+ shutil.move(str(src), str(dst), copy_function=_copy_no_matter_what)
1968
+
1969
+
1970
+ def _copy_no_matter_what(src: str, dst: str) -> None:
1971
+ """Copy file from src to dst.
1972
+
1973
+ If `shutil.copy2` fails, fallback to `shutil.copyfile`.
1974
+ """
1975
+ try:
1976
+ # Copy file with metadata and permission
1977
+ # Can fail e.g. if dst is an S3 mount
1978
+ shutil.copy2(src, dst)
1979
+ except OSError:
1980
+ # Copy only file content
1981
+ shutil.copyfile(src, dst)
1963
1982
 
1964
1983
 
1965
1984
  def _get_pointer_path(storage_folder: str, revision: str, relative_filename: str) -> str:
@@ -819,13 +819,16 @@ class InferenceClient:
819
819
  # First, resolve the model chat completions URL
820
820
  if model == self.base_url:
821
821
  # base_url passed => add server route
822
- model_url = model + "/v1/chat/completions"
822
+ model_url = model.rstrip("/")
823
+ if not model_url.endswith("/v1"):
824
+ model_url += "/v1"
825
+ model_url += "/chat/completions"
823
826
  elif is_url:
824
827
  # model is a URL => use it directly
825
828
  model_url = model
826
829
  else:
827
830
  # model is a model ID => resolve it + add server route
828
- model_url = self._resolve_url(model) + "/v1/chat/completions"
831
+ model_url = self._resolve_url(model).rstrip("/") + "/v1/chat/completions"
829
832
 
830
833
  # `model` is sent in the payload. Not used by the server but can be useful for debugging/routing.
831
834
  # If it's a ID on the Hub => use it. Otherwise, we use a random string.
@@ -825,13 +825,16 @@ class AsyncInferenceClient:
825
825
  # First, resolve the model chat completions URL
826
826
  if model == self.base_url:
827
827
  # base_url passed => add server route
828
- model_url = model + "/v1/chat/completions"
828
+ model_url = model.rstrip("/")
829
+ if not model_url.endswith("/v1"):
830
+ model_url += "/v1"
831
+ model_url += "/chat/completions"
829
832
  elif is_url:
830
833
  # model is a URL => use it directly
831
834
  model_url = model
832
835
  else:
833
836
  # model is a model ID => resolve it + add server route
834
- model_url = self._resolve_url(model) + "/v1/chat/completions"
837
+ model_url = self._resolve_url(model).rstrip("/") + "/v1/chat/completions"
835
838
 
836
839
  # `model` is sent in the payload. Not used by the server but can be useful for debugging/routing.
837
840
  # If it's a ID on the Hub => use it. Otherwise, we use a random string.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: huggingface-hub
3
- Version: 0.24.2
3
+ Version: 0.24.4
4
4
  Summary: Client library to download and publish models, datasets and other repos on the huggingface.co hub
5
5
  Home-page: https://github.com/huggingface/huggingface_hub
6
6
  Author: Hugging Face, Inc.
@@ -1,4 +1,4 @@
1
- huggingface_hub/__init__.py,sha256=SwU8lwrGTWMwmxGEtUdkOpsUf9F_f7mQffM3o9fY_WY,33897
1
+ huggingface_hub/__init__.py,sha256=iZNFPk2xzqsESO1Lm7c9_P8a2d8YAqT5RJDTC7pSkd8,33897
2
2
  huggingface_hub/_commit_api.py,sha256=Yj1ft_WbsnqjSbiYHgdqGmLTF6BTA4E8kAGYW89t2sQ,31057
3
3
  huggingface_hub/_commit_scheduler.py,sha256=nlJS_vnLb8i92NLrRwJX8Mg9QZ7f3kfLbLlQuEd5YjU,13647
4
4
  huggingface_hub/_inference_endpoints.py,sha256=th6vlJ2vUg314x7uMLzQHfy4AuX5mFlJqNobVIz5yOY,15944
@@ -14,7 +14,7 @@ huggingface_hub/community.py,sha256=SBaOfI-3atCzRbO0gDS8BYxctbdvD4G0X6D0GfY8Fgc,
14
14
  huggingface_hub/constants.py,sha256=BG3n2gl4JbxMw_JRvNTFyMcNnZIPzvT3KXSH-jm2J08,8005
15
15
  huggingface_hub/errors.py,sha256=IM0lNbExLzaYEs0HrrPvY4-kyj6DiP2Szu7Jy9slHOE,2083
16
16
  huggingface_hub/fastai_utils.py,sha256=5I7zAfgHJU_mZnxnf9wgWTHrCRu_EAV8VTangDVfE_o,16676
17
- huggingface_hub/file_download.py,sha256=Lf1RhCMb9HkXPUy90O_zUc-fonmFTwE2xadbZpVoKrM,84243
17
+ huggingface_hub/file_download.py,sha256=jbyp_B22xOknzy6FjlLly8i3we3UqVK39DWmUtxKPNI,84854
18
18
  huggingface_hub/hf_api.py,sha256=2tcE3gCnASv2UEVst_oMzTZiKmjlTraV7bP8ujbDmLQ,406710
19
19
  huggingface_hub/hf_file_system.py,sha256=HlYbWFhMrPWNqGUQfQrZR6H70QK0PgsxRvO4FantCNc,39160
20
20
  huggingface_hub/hub_mixin.py,sha256=bm5hZGeOHBSUBfiAXJv8cU05nAZr65TxnkUJLWLwAEg,37308
@@ -37,12 +37,12 @@ huggingface_hub/commands/tag.py,sha256=gCoR8G95lhHBzyVytTxT7MnqTmjKYtStDnHXcysOJ
37
37
  huggingface_hub/commands/upload.py,sha256=Mr69qO60otqCVw0sVSBPykUTkL9HO-pkCyulSD2mROM,13622
38
38
  huggingface_hub/commands/user.py,sha256=QApZJOCQEHADhjunM3hlQ72uqHsearCiCE4SdpzGdcc,6893
39
39
  huggingface_hub/inference/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
- huggingface_hub/inference/_client.py,sha256=6oJjWgDIGqKK52DU7VR2fQkqYqf2UGQbHWMEqVszaZU,129014
40
+ huggingface_hub/inference/_client.py,sha256=xZJIdLXyP4KBz4H4YH1bpaAzCor7NlYIQ6ZvKbnDlqY,129139
41
41
  huggingface_hub/inference/_common.py,sha256=EEF8T9jtfLvqhIwwDM0vt8S54yObExoBncJIiHvEew8,14882
42
42
  huggingface_hub/inference/_templating.py,sha256=LCy-U_25R-l5dhcEHsyRwiOrgvKQHXkdSmynWCfsPjI,3991
43
43
  huggingface_hub/inference/_types.py,sha256=C73l5-RO8P1UMBHF8OAO9CRUq7Xdv33pcADoJsGMPSU,1782
44
44
  huggingface_hub/inference/_generated/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
- huggingface_hub/inference/_generated/_async_client.py,sha256=X7dHAHJdDbAvho3_tsyOjH0spC_aJUCNeG_UclHSo_Q,132715
45
+ huggingface_hub/inference/_generated/_async_client.py,sha256=6DsgWd79983rtd9GZsERCZz7qHwhcBApLNuT7QdHq5s,132840
46
46
  huggingface_hub/inference/_generated/types/__init__.py,sha256=uEsA0z8Gcu34q0gNAZVcqHFqJT5BPrhnM9qS_LQgN0Q,5215
47
47
  huggingface_hub/inference/_generated/types/audio_classification.py,sha256=wk4kUTLQZoXWLpiUOpKRHRRE-JYqqJlzGVe62VACR-0,1347
48
48
  huggingface_hub/inference/_generated/types/audio_to_audio.py,sha256=n7GeCepzt254yoSLsdjrI1j4fzYgjWzxoaKE5gZJc48,881
@@ -107,9 +107,9 @@ huggingface_hub/utils/insecure_hashlib.py,sha256=OjxlvtSQHpbLp9PWSrXBDJ0wHjxCBU-
107
107
  huggingface_hub/utils/logging.py,sha256=Cp03s0uEl3kDM9XHQW9a8GAoExODQ-e7kEtgMt-_To8,4728
108
108
  huggingface_hub/utils/sha.py,sha256=OFnNGCba0sNcT2gUwaVCJnldxlltrHHe0DS_PCpV3C4,2134
109
109
  huggingface_hub/utils/tqdm.py,sha256=jQiVYwRG78HK4_54u0vTtz6Kt9IMGiHy3ixbIn3h2TU,9368
110
- huggingface_hub-0.24.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
111
- huggingface_hub-0.24.2.dist-info/METADATA,sha256=v6G7PRFjD854k5FqvZSixwtHyQq2bMb5wNvWcfwMRqk,13183
112
- huggingface_hub-0.24.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
113
- huggingface_hub-0.24.2.dist-info/entry_points.txt,sha256=Y3Z2L02rBG7va_iE6RPXolIgwOdwUFONyRN3kXMxZ0g,131
114
- huggingface_hub-0.24.2.dist-info/top_level.txt,sha256=8KzlQJAY4miUvjAssOAJodqKOw3harNzuiwGQ9qLSSk,16
115
- huggingface_hub-0.24.2.dist-info/RECORD,,
110
+ huggingface_hub-0.24.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
111
+ huggingface_hub-0.24.4.dist-info/METADATA,sha256=uxQamTAa7pYn6rfUBoGdbUfQuWW0d2rBEASQI0qbovI,13183
112
+ huggingface_hub-0.24.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
113
+ huggingface_hub-0.24.4.dist-info/entry_points.txt,sha256=Y3Z2L02rBG7va_iE6RPXolIgwOdwUFONyRN3kXMxZ0g,131
114
+ huggingface_hub-0.24.4.dist-info/top_level.txt,sha256=8KzlQJAY4miUvjAssOAJodqKOw3harNzuiwGQ9qLSSk,16
115
+ huggingface_hub-0.24.4.dist-info/RECORD,,