huggingface-hub 0.13.2__tar.gz → 0.13.3__tar.gz

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 (63) hide show
  1. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/PKG-INFO +1 -1
  2. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/__init__.py +1 -1
  3. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/file_download.py +31 -5
  4. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub.egg-info/PKG-INFO +1 -1
  5. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/LICENSE +0 -0
  6. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/MANIFEST.in +0 -0
  7. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/README.md +0 -0
  8. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/pyproject.toml +0 -0
  9. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/setup.cfg +0 -0
  10. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/setup.py +0 -0
  11. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/_commit_api.py +0 -0
  12. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/_login.py +0 -0
  13. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/_snapshot_download.py +0 -0
  14. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/_space_api.py +0 -0
  15. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/commands/__init__.py +0 -0
  16. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/commands/_cli_utils.py +0 -0
  17. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/commands/delete_cache.py +0 -0
  18. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/commands/env.py +0 -0
  19. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/commands/huggingface_cli.py +0 -0
  20. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/commands/lfs.py +0 -0
  21. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/commands/scan_cache.py +0 -0
  22. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/commands/user.py +0 -0
  23. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/community.py +0 -0
  24. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/constants.py +0 -0
  25. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/fastai_utils.py +0 -0
  26. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/hf_api.py +0 -0
  27. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/hub_mixin.py +0 -0
  28. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/inference_api.py +0 -0
  29. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/keras_mixin.py +0 -0
  30. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/lfs.py +0 -0
  31. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/repocard.py +0 -0
  32. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/repocard_data.py +0 -0
  33. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/repository.py +0 -0
  34. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/templates/datasetcard_template.md +0 -0
  35. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/templates/modelcard_template.md +0 -0
  36. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/__init__.py +0 -0
  37. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/_cache_assets.py +0 -0
  38. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/_cache_manager.py +0 -0
  39. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/_chunk_utils.py +0 -0
  40. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/_datetime.py +0 -0
  41. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/_deprecation.py +0 -0
  42. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/_errors.py +0 -0
  43. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/_fixes.py +0 -0
  44. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/_git_credential.py +0 -0
  45. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/_headers.py +0 -0
  46. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/_hf_folder.py +0 -0
  47. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/_http.py +0 -0
  48. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/_pagination.py +0 -0
  49. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/_paths.py +0 -0
  50. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/_runtime.py +0 -0
  51. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/_subprocess.py +0 -0
  52. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/_telemetry.py +0 -0
  53. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/_typing.py +0 -0
  54. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/_validators.py +0 -0
  55. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/endpoint_helpers.py +0 -0
  56. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/logging.py +0 -0
  57. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/sha.py +0 -0
  58. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub/utils/tqdm.py +0 -0
  59. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub.egg-info/SOURCES.txt +0 -0
  60. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub.egg-info/dependency_links.txt +0 -0
  61. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub.egg-info/entry_points.txt +0 -0
  62. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub.egg-info/requires.txt +0 -0
  63. {huggingface_hub-0.13.2 → huggingface_hub-0.13.3}/src/huggingface_hub.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: huggingface_hub
3
- Version: 0.13.2
3
+ Version: 0.13.3
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.
@@ -46,7 +46,7 @@ import sys
46
46
  from typing import TYPE_CHECKING
47
47
 
48
48
 
49
- __version__ = "0.13.2"
49
+ __version__ = "0.13.3"
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
@@ -819,14 +819,30 @@ def _normalize_etag(etag: Optional[str]) -> Optional[str]:
819
819
  return etag.strip('"')
820
820
 
821
821
 
822
+ def _create_relative_symlink(src: str, dst: str, new_blob: bool = False) -> None:
823
+ """Alias method used in `transformers` conversion script."""
824
+ return _create_symlink(src=src, dst=dst, new_blob=new_blob)
825
+
826
+
822
827
  def _create_symlink(src: str, dst: str, new_blob: bool = False) -> None:
823
- """Create a symbolic link named dst pointing to src as an absolute path.
828
+ """Create a symbolic link named dst pointing to src.
829
+
830
+ By default, it will try to create a symlink using a relative path. Relative paths have 2 advantages:
831
+ - If the cache_folder is moved (example: back-up on a shared drive), relative paths within the cache folder will
832
+ not brake.
833
+ - Relative paths seems to be better handled on Windows. Issue was reported 3 times in less than a week when
834
+ changing from relative to absolute paths. See https://github.com/huggingface/huggingface_hub/issues/1398,
835
+ https://github.com/huggingface/diffusers/issues/2729 and https://github.com/huggingface/transformers/pull/22228.
836
+ NOTE: The issue with absolute paths doesn't happen on admin mode.
837
+ When creating a symlink from the cache to a local folder, it is possible that a relative path cannot be created.
838
+ This happens when paths are not on the same volume. In that case, we use absolute paths.
839
+
824
840
 
825
841
  The result layout looks something like
826
842
  └── [ 128] snapshots
827
843
  ├── [ 128] 2439f60ef33a0d46d85da5001d52aeda5b00ce9f
828
- │ ├── [ 52] README.md -> /path/to/cache/blobs/d7edf6bd2a681fb0175f7735299831ee1b22b812
829
- │ └── [ 76] pytorch_model.bin -> /path/to/cache/blobs/403450e234d65943a7dcf7e05a771ce3c92faa84dd07db4ac20f592037a1e4bd
844
+ │ ├── [ 52] README.md -> ../../../blobs/d7edf6bd2a681fb0175f7735299831ee1b22b812
845
+ │ └── [ 76] pytorch_model.bin -> ../../../blobs/403450e234d65943a7dcf7e05a771ce3c92faa84dd07db4ac20f592037a1e4bd
830
846
 
831
847
  If symlinks cannot be created on this platform (most likely to be Windows), the workaround is to avoid symlinks by
832
848
  having the actual file in `dst`. If it is a new file (`new_blob=True`), we move it to `dst`. If it is not a new file
@@ -844,6 +860,15 @@ def _create_symlink(src: str, dst: str, new_blob: bool = False) -> None:
844
860
  abs_src = os.path.abspath(os.path.expanduser(src))
845
861
  abs_dst = os.path.abspath(os.path.expanduser(dst))
846
862
 
863
+ # Use relative_dst in priority
864
+ try:
865
+ relative_src = os.path.relpath(abs_src, os.path.dirname(abs_dst))
866
+ except ValueError:
867
+ # Raised on Windows if src and dst are not on the same volume. This is the case when creating a symlink to a
868
+ # local_dir instead of within the cache directory.
869
+ # See https://docs.python.org/3/library/os.path.html#os.path.relpath
870
+ relative_src = None
871
+
847
872
  try:
848
873
  _support_symlinks = are_symlinks_supported(os.path.dirname(os.path.commonpath([abs_src, abs_dst])))
849
874
  except PermissionError:
@@ -852,9 +877,10 @@ def _create_symlink(src: str, dst: str, new_blob: bool = False) -> None:
852
877
  _support_symlinks = are_symlinks_supported(os.path.dirname(abs_dst))
853
878
 
854
879
  if _support_symlinks:
855
- logger.info(f"Creating pointer from {abs_src} to {abs_dst}")
880
+ src_rel_or_abs = relative_src or abs_src
881
+ logger.info(f"Creating pointer from {src_rel_or_abs} to {abs_dst}")
856
882
  try:
857
- os.symlink(abs_src, abs_dst)
883
+ os.symlink(src_rel_or_abs, abs_dst)
858
884
  except FileExistsError:
859
885
  if os.path.islink(abs_dst) and os.path.realpath(abs_dst) == os.path.realpath(abs_src):
860
886
  # `abs_dst` already exists and is a symlink to the `abs_src` blob. It is most likely that the file has
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: huggingface-hub
3
- Version: 0.13.2
3
+ Version: 0.13.3
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.