OSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the
Problem Description
OSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like distilbert-base-uncased-finetuned-sst-2-english is not the path to a directory containing a file named config.json.
Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.
This actually means that if the model is overseas, the server cannot access the foreign model, and the model needs to be downloaded locally.
solution
Download the model file below and put it in a folder
When loading the model, specify the local model
path = '/home/ubuntu/code/transformers-main/sentiment-analysis'
classifier = pipeline('sentiment-analysis',model=path)
a warning
UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
return self.fget.get(instance, owner)()
这个警告其实不影响代码的运行