huggingface / huggingface/setfit
No timeout downloading model card data from hub api when loading pretrained model in disconnected environment
- Dominant language
- Jupyter Notebook
- Stars
- 2.8k
- Forks
- 267
- Avg merge
- 36m
- Merged PRs (30d)
- 5
Description
When calling `SetFitModel.from_pretrained` to load a pretrained model from a local directory, setfit attempts to load the model card using the huggingface hub api in the [method](https://github.com/huggingface/setfit/blob/1e3ce937e2e430c549b5b43ffb48b43d714efc24/src/setfit/model_card.py#L437) `model_card.SetFitModelCardData.infer_st_id`. In a disconnected environment with no internet access, this causes it to hang for a long time as it tries to call the hub REST API, usually up to around 5 minutes. This causes problems in environments where no internet access is available, perhaps for security reasons.
A workaround to this problem, is to specify a timeout by passing the timeout argument to `model_info` in the `is_on_huggingface()` [function](https://github.com/huggingface/setfit/blob/1e3ce937e2e430c549b5b43ffb48b43d714efc24/src/setfit/model_card.py#L565).
It would be helpful to be able to set a global timeout for all operations involving a call to the hub api, in a similar way to how datasets allows the `HF_DATASETS_OFFLINE` to be specified.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.