huggingface-hub 0.13.2__py3-none-any.whl → 0.13.3__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.
- huggingface_hub/__init__.py +1 -1
- huggingface_hub/file_download.py +31 -5
- {huggingface_hub-0.13.2.dist-info → huggingface_hub-0.13.3.dist-info}/METADATA +1 -1
- {huggingface_hub-0.13.2.dist-info → huggingface_hub-0.13.3.dist-info}/RECORD +8 -8
- {huggingface_hub-0.13.2.dist-info → huggingface_hub-0.13.3.dist-info}/WHEEL +1 -1
- {huggingface_hub-0.13.2.dist-info → huggingface_hub-0.13.3.dist-info}/LICENSE +0 -0
- {huggingface_hub-0.13.2.dist-info → huggingface_hub-0.13.3.dist-info}/entry_points.txt +0 -0
- {huggingface_hub-0.13.2.dist-info → huggingface_hub-0.13.3.dist-info}/top_level.txt +0 -0
huggingface_hub/__init__.py
CHANGED
huggingface_hub/file_download.py
CHANGED
|
@@ -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
|
|
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 ->
|
|
829
|
-
│ └── [ 76] pytorch_model.bin ->
|
|
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
|
-
|
|
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(
|
|
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.
|
|
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.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
huggingface_hub/__init__.py,sha256=
|
|
1
|
+
huggingface_hub/__init__.py,sha256=8PDH0M8_c2CwqboAvkN8wrnOiMWUNZxfEqclxK4aLfQ,14645
|
|
2
2
|
huggingface_hub/_commit_api.py,sha256=QP3YtZdMOFKW0EchiS9JGPo5EVlkUz6cGktCagvoOx0,22558
|
|
3
3
|
huggingface_hub/_login.py,sha256=iKK6-4tDBcdCoJar_TXILUdJ76G00QYbgFVM5Dtput8,11531
|
|
4
4
|
huggingface_hub/_snapshot_download.py,sha256=eY0OWOpunWJY32d1d30ggV3rr3ND_LpEnYmu87nzZcY,11339
|
|
@@ -6,7 +6,7 @@ huggingface_hub/_space_api.py,sha256=URSt8IDDnzZ4wiGiuoZgwNP3ZMgNmXZQGFcOQhfkQEU
|
|
|
6
6
|
huggingface_hub/community.py,sha256=WwVSOtephAX0OqALlOW_1EPu09r-Y5WpIF7jPkn0ze8,11062
|
|
7
7
|
huggingface_hub/constants.py,sha256=EIhFt9LSDZKnstgJ3Zwqu2coHBHg8ms7dXNPE6QkFU8,4714
|
|
8
8
|
huggingface_hub/fastai_utils.py,sha256=5I7zAfgHJU_mZnxnf9wgWTHrCRu_EAV8VTangDVfE_o,16676
|
|
9
|
-
huggingface_hub/file_download.py,sha256=
|
|
9
|
+
huggingface_hub/file_download.py,sha256=2KBueqiPJ2MGuuvCIkH2yOEhfAwODnpWERrKpRhIgic,65133
|
|
10
10
|
huggingface_hub/hf_api.py,sha256=Zh_iIV_Qhk79nbKaXigtcanCeGVfIpqdkqU9yYhaH3M,173043
|
|
11
11
|
huggingface_hub/hub_mixin.py,sha256=94BN_vzHDBX2tDgVV8la4CfkUzN2OgLsV9p9sz4OP7c,16783
|
|
12
12
|
huggingface_hub/inference_api.py,sha256=3NkHAAGS9wK8PbXxly8YI-0V6gfZgZvV3N5bTdRfvDM,7882
|
|
@@ -48,9 +48,9 @@ huggingface_hub/utils/endpoint_helpers.py,sha256=wXE3U1resSFvfdZbNevzrFyf39o9LfE
|
|
|
48
48
|
huggingface_hub/utils/logging.py,sha256=-Uov2WGLv16hS-V4Trvs_XO-TvSeZ1xIWZ-cfvDl7ac,4778
|
|
49
49
|
huggingface_hub/utils/sha.py,sha256=Wmeh2lwS2H0_CNLqDk_mNyb4jAjfTdlG6FZsuh6LqVg,890
|
|
50
50
|
huggingface_hub/utils/tqdm.py,sha256=iTe9IhbPWIezSn6GBAuPlZe_q-5T47ARwUJAQZ6xepc,5741
|
|
51
|
-
huggingface_hub-0.13.
|
|
52
|
-
huggingface_hub-0.13.
|
|
53
|
-
huggingface_hub-0.13.
|
|
54
|
-
huggingface_hub-0.13.
|
|
55
|
-
huggingface_hub-0.13.
|
|
56
|
-
huggingface_hub-0.13.
|
|
51
|
+
huggingface_hub-0.13.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
52
|
+
huggingface_hub-0.13.3.dist-info/METADATA,sha256=nt-YabDZxogsoN7HxTX4nyVt0TXB6cPAYTVZb7eZJKI,7476
|
|
53
|
+
huggingface_hub-0.13.3.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
54
|
+
huggingface_hub-0.13.3.dist-info/entry_points.txt,sha256=7-_O79Kk26OM9R3QgywVzfyrNjZ3F8tCUhDtozJ7yIc,83
|
|
55
|
+
huggingface_hub-0.13.3.dist-info/top_level.txt,sha256=8KzlQJAY4miUvjAssOAJodqKOw3harNzuiwGQ9qLSSk,16
|
|
56
|
+
huggingface_hub-0.13.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|