From b3ceb9d0188cd1d29668c081a5b12d78bda4af72 Mon Sep 17 00:00:00 2001 From: Lucain Pouget Date: Wed, 16 Oct 2024 11:10:13 +0200 Subject: [PATCH] Fix 2609 - Import packaging by default --- src/huggingface_hub/hub_mixin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/huggingface_hub/hub_mixin.py b/src/huggingface_hub/hub_mixin.py index 1e77fffb6b..4c504f26d0 100644 --- a/src/huggingface_hub/hub_mixin.py +++ b/src/huggingface_hub/hub_mixin.py @@ -17,6 +17,8 @@ Union, ) +import packaging.version + from . import constants from .errors import EntryNotFoundError, HfHubHTTPError from .file_download import hf_hub_download @@ -41,7 +43,6 @@ import torch # type: ignore if is_safetensors_available(): - import packaging.version import safetensors from safetensors.torch import load_model as load_model_as_safetensor from safetensors.torch import save_model as save_model_as_safetensor