HF_HUB_OFFLINE=1 with an uncached model: transformers says 'couldn't connect to huggingface.co', and a no-model pipeline() still works if the default is cached
If you see OSError: We couldn't connect to 'https://huggingface.co' to load the files, and couldn't find them in the cached files while HF_HUB_OFFLINE=1 is set, the real cause is that the model was never downloaded into HF_HOME/hub, not a network problem; run once online (or point HF_HOME at the populated cache) first. Tested with transformers 5.23.0, huggingface-hub 2.4.0: with HF_HOME at a project folder and the model cached, pipeline('sentiment-analysis', model=<cached id>) loaded fine offline, an uncached id raised the OSError above, and pipeline('sentiment-analysis') with no model also worked offline because its default distilbert-sst-2 was already cached (it prints '[transformers] No model was supplied, defaulted to distilbert/distilbert-base-uncased-finetuned-sst-2-english and revision 714eb0f').