huggingface-hub 0.21.3__py3-none-any.whl → 0.21.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.
- huggingface_hub/__init__.py +1 -1
- huggingface_hub/hub_mixin.py +14 -9
- {huggingface_hub-0.21.3.dist-info → huggingface_hub-0.21.4.dist-info}/METADATA +1 -1
- {huggingface_hub-0.21.3.dist-info → huggingface_hub-0.21.4.dist-info}/RECORD +8 -8
- {huggingface_hub-0.21.3.dist-info → huggingface_hub-0.21.4.dist-info}/LICENSE +0 -0
- {huggingface_hub-0.21.3.dist-info → huggingface_hub-0.21.4.dist-info}/WHEEL +0 -0
- {huggingface_hub-0.21.3.dist-info → huggingface_hub-0.21.4.dist-info}/entry_points.txt +0 -0
- {huggingface_hub-0.21.3.dist-info → huggingface_hub-0.21.4.dist-info}/top_level.txt +0 -0
huggingface_hub/__init__.py
CHANGED
huggingface_hub/hub_mixin.py
CHANGED
|
@@ -27,8 +27,8 @@ if is_torch_available():
|
|
|
27
27
|
import torch # type: ignore
|
|
28
28
|
|
|
29
29
|
if is_safetensors_available():
|
|
30
|
-
from safetensors import
|
|
31
|
-
from safetensors.torch import
|
|
30
|
+
from safetensors.torch import load_model as load_model_as_safetensor
|
|
31
|
+
from safetensors.torch import save_model as save_model_as_safetensor
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
logger = logging.get_logger(__name__)
|
|
@@ -463,7 +463,7 @@ class PyTorchModelHubMixin(ModelHubMixin):
|
|
|
463
463
|
def _save_pretrained(self, save_directory: Path) -> None:
|
|
464
464
|
"""Save weights from a Pytorch model to a local directory."""
|
|
465
465
|
model_to_save = self.module if hasattr(self, "module") else self # type: ignore
|
|
466
|
-
|
|
466
|
+
save_model_as_safetensor(model_to_save, str(save_directory / SAFETENSORS_SINGLE_FILE))
|
|
467
467
|
|
|
468
468
|
@classmethod
|
|
469
469
|
def _from_pretrained(
|
|
@@ -524,10 +524,15 @@ class PyTorchModelHubMixin(ModelHubMixin):
|
|
|
524
524
|
|
|
525
525
|
@classmethod
|
|
526
526
|
def _load_as_safetensor(cls, model: T, model_file: str, map_location: str, strict: bool) -> T:
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
527
|
+
load_model_as_safetensor(model, model_file, strict=strict) # type: ignore [arg-type]
|
|
528
|
+
if map_location != "cpu":
|
|
529
|
+
# TODO: remove this once https://github.com/huggingface/safetensors/pull/449 is merged.
|
|
530
|
+
logger.warning(
|
|
531
|
+
"Loading model weights on other devices than 'cpu' is not supported natively."
|
|
532
|
+
" This means that the model is loaded on 'cpu' first and then copied to the device."
|
|
533
|
+
" This leads to a slower loading time."
|
|
534
|
+
" Support for loading directly on other devices is planned to be added in future releases."
|
|
535
|
+
" See https://github.com/huggingface/huggingface_hub/pull/2086 for more details."
|
|
536
|
+
)
|
|
537
|
+
model.to(map_location) # type: ignore [attr-defined]
|
|
533
538
|
return model
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: huggingface-hub
|
|
3
|
-
Version: 0.21.
|
|
3
|
+
Version: 0.21.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=
|
|
1
|
+
huggingface_hub/__init__.py,sha256=nu0b7XY9x7XElBvxPdCmxewlejCC_OeLt7uR1_priWE,21502
|
|
2
2
|
huggingface_hub/_commit_api.py,sha256=ShZvHuBuARsZqzDVSzH07_E1M4LYk7dekGng9CYO0B0,29194
|
|
3
3
|
huggingface_hub/_commit_scheduler.py,sha256=FgfjYv3E0oK3iBxDdy45Y7t78FWkmjnBR4dRd5aZviU,13653
|
|
4
4
|
huggingface_hub/_inference_endpoints.py,sha256=HLsc3vr1EIBxB5zLtJvJh02ahew-0tXuEEWlpvzOjY4,15426
|
|
@@ -15,7 +15,7 @@ huggingface_hub/fastai_utils.py,sha256=5I7zAfgHJU_mZnxnf9wgWTHrCRu_EAV8VTangDVfE
|
|
|
15
15
|
huggingface_hub/file_download.py,sha256=1_7W6f0CmQYlRbmIrFNsIcHsnqHJ4UIhE-XS9cmm9WY,77558
|
|
16
16
|
huggingface_hub/hf_api.py,sha256=ebPm0KHK4V2OJLZW6t_tMSacegDhA6dQTXqbRpmwG8M,367012
|
|
17
17
|
huggingface_hub/hf_file_system.py,sha256=8-gNR_BsZccS2yfgub4D0GuIk75G4Tu40AJXmdnsOLg,34180
|
|
18
|
-
huggingface_hub/hub_mixin.py,sha256=
|
|
18
|
+
huggingface_hub/hub_mixin.py,sha256=1latp7B3le4uLUrrZByc3ym1t1AbeejMzedM1Ssphkw,23521
|
|
19
19
|
huggingface_hub/inference_api.py,sha256=UXOKu_Ez2I3hDsjguqCcCrj03WFDndehpngYiIAucdg,8331
|
|
20
20
|
huggingface_hub/keras_mixin.py,sha256=fxVjwm742fwsLwbuNVt7Slo3KAjEX7sCcTudKnolPZM,18741
|
|
21
21
|
huggingface_hub/lfs.py,sha256=_YA93hK_R2j8TUnMnGk2CanYty-hTPBZX0MJDHbzUqc,19333
|
|
@@ -73,9 +73,9 @@ huggingface_hub/utils/insecure_hashlib.py,sha256=OjxlvtSQHpbLp9PWSrXBDJ0wHjxCBU-
|
|
|
73
73
|
huggingface_hub/utils/logging.py,sha256=mARNwc5gY6apMQ9IM5zymn-RsYnFbYW3b0HDMYXmBS0,4729
|
|
74
74
|
huggingface_hub/utils/sha.py,sha256=IVi7CfBthfu-ExLduY_CQltTy-tVGTbrvURCTOWKcLA,901
|
|
75
75
|
huggingface_hub/utils/tqdm.py,sha256=zBWgoxxwHooOceABVREVqSNpJGcMpaByKFVDU8VbuUQ,6334
|
|
76
|
-
huggingface_hub-0.21.
|
|
77
|
-
huggingface_hub-0.21.
|
|
78
|
-
huggingface_hub-0.21.
|
|
79
|
-
huggingface_hub-0.21.
|
|
80
|
-
huggingface_hub-0.21.
|
|
81
|
-
huggingface_hub-0.21.
|
|
76
|
+
huggingface_hub-0.21.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
77
|
+
huggingface_hub-0.21.4.dist-info/METADATA,sha256=D8616jH4iiuDT94lfbzrnmcGfQUAaCEWoDNzu2-De0I,13176
|
|
78
|
+
huggingface_hub-0.21.4.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
79
|
+
huggingface_hub-0.21.4.dist-info/entry_points.txt,sha256=Y3Z2L02rBG7va_iE6RPXolIgwOdwUFONyRN3kXMxZ0g,131
|
|
80
|
+
huggingface_hub-0.21.4.dist-info/top_level.txt,sha256=8KzlQJAY4miUvjAssOAJodqKOw3harNzuiwGQ9qLSSk,16
|
|
81
|
+
huggingface_hub-0.21.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|