Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/setfit/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@

import joblib
import numpy as np
import requests
import torch
from huggingface_hub import ModelHubMixin, hf_hub_download
from huggingface_hub.utils import validate_hf_hub_args
from huggingface_hub.utils import HfHubHTTPError, validate_hf_hub_args
from packaging.version import Version, parse
from sentence_transformers import SentenceTransformer
from sentence_transformers import __version__ as sentence_transformers_version
Expand Down Expand Up @@ -774,7 +773,7 @@ def _from_pretrained(
token=token,
local_files_only=local_files_only,
)
except requests.exceptions.RequestException:
except HfHubHTTPError:
pass

model_kwargs = {key: value for key, value in model_kwargs.items() if value is not None}
Expand Down Expand Up @@ -816,7 +815,7 @@ def _from_pretrained(
token=token,
local_files_only=local_files_only,
)
except requests.exceptions.RequestException:
except HfHubHTTPError:
logger.info(
f"{MODEL_HEAD_NAME} not found on HuggingFace Hub, initialising classification head with random weights."
" You should TRAIN this model on a downstream task to use it for predictions and inference."
Expand Down
Loading