Skip to content

Commit

Permalink
Do not warn in ModelHubMixin on missing config file (#1776)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wauplin authored Oct 26, 2023
1 parent 0a2503d commit dd864fd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/huggingface_hub/hub_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
from pathlib import Path
from typing import Dict, List, Optional, Type, TypeVar, Union

import requests

from .constants import CONFIG_NAME, PYTORCH_WEIGHTS_NAME
from .file_download import hf_hub_download, is_torch_available
from .hf_api import HfApi
from .utils import SoftTemporaryDirectory, logging, validate_hf_hub_args
from .utils import HfHubHTTPError, SoftTemporaryDirectory, logging, validate_hf_hub_args


if is_torch_available():
Expand Down Expand Up @@ -148,8 +146,8 @@ def from_pretrained(
token=token,
local_files_only=local_files_only,
)
except requests.exceptions.RequestException:
logger.warning(f"{CONFIG_NAME} not found in HuggingFace Hub.")
except HfHubHTTPError:
logger.info(f"{CONFIG_NAME} not found in HuggingFace Hub.")

if config_file is not None:
with open(config_file, "r", encoding="utf-8") as f:
Expand Down

0 comments on commit dd864fd

Please sign in to comment.