mirror of
https://github.com/huggingface/pytorch-image-models.git
synced 2025-06-03 15:01:08 +08:00
changed warning to info
This commit is contained in:
parent
8470e29541
commit
a09d403c24
@ -167,14 +167,14 @@ def load_state_dict_from_hf(model_id: str, filename: str = HF_WEIGHTS_NAME):
|
|||||||
for safe_filename in _get_safe_alternatives(filename):
|
for safe_filename in _get_safe_alternatives(filename):
|
||||||
try:
|
try:
|
||||||
cached_safe_file = hf_hub_download(repo_id=hf_model_id, filename=safe_filename, revision=hf_revision)
|
cached_safe_file = hf_hub_download(repo_id=hf_model_id, filename=safe_filename, revision=hf_revision)
|
||||||
_logger.warning(f"[{model_id}] Safe alternative available for '{filename}' (as '{safe_filename}'). Loading weights using safetensors.")
|
_logger.info(f"[{model_id}] Safe alternative available for '{filename}' (as '{safe_filename}'). Loading weights using safetensors.")
|
||||||
return safetensors.torch.load_file(cached_safe_file, device="cpu")
|
return safetensors.torch.load_file(cached_safe_file, device="cpu")
|
||||||
except EntryNotFoundError:
|
except EntryNotFoundError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Otherwise, load using pytorch.load
|
# Otherwise, load using pytorch.load
|
||||||
cached_file = hf_hub_download(hf_model_id, filename=filename, revision=hf_revision)
|
cached_file = hf_hub_download(hf_model_id, filename=filename, revision=hf_revision)
|
||||||
_logger.warning(f"[{model_id}] Safe alternative not found for '{filename}'. Loading weights using default pytorch.")
|
_logger.info(f"[{model_id}] Safe alternative not found for '{filename}'. Loading weights using default pytorch.")
|
||||||
return torch.load(cached_file, map_location='cpu')
|
return torch.load(cached_file, map_location='cpu')
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user