huggingface / huggingface_hub

The official Python client for the Huggingface Hub.
https://huggingface.co/docs/huggingface_hub
Apache License 2.0
2.14k stars 560 forks source link

Unable to access Huggingface #2043

Open ai-ml-with-kapil opened 9 months ago

ai-ml-with-kapil commented 9 months ago

Describe the bug

I am getting this error "We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like sentence-transformers/all-MiniLM-L6-v2 is not the path to a directory containing a file named config.json." Although I am able to access website using my web browser and also I have tried creating new token and tried that but same result. Unable to use any model.

Reproduction

No response

Logs

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 sentence-transformers/all-MiniLM-L6-v2 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'.

System info

- huggingface_hub version: 0.20.2
- Platform: Windows-11-10.0.22621-SP0
- Python version: 3.12.2
- Running in iPython ?: No
- Running in notebook ?: No
- Running in Google Colab ?: No
- Token path ?: C:\Users\panwa\.cache\huggingface\token
- Has saved token ?: False
- Configured git credential helpers: manager
- FastAI: N/A
- Tensorflow: N/A
- Torch: 2.2.1
- Jinja2: 3.1.3
- Graphviz: N/A
- Pydot: N/A
- Pillow: 10.2.0
- hf_transfer: N/A
- gradio: N/A
- tensorboard: N/A
- numpy: 1.26.4
- pydantic: 2.6.1
- aiohttp: 3.9.3
- ENDPOINT: https://huggingface.co
- HF_HUB_CACHE: C:\Users\panwa\.cache\huggingface\hub
- HF_ASSETS_CACHE: C:\Users\panwa\.cache\huggingface\assets
- HF_TOKEN_PATH: C:\Users\panwa\.cache\huggingface\token
- HF_HUB_OFFLINE: False
- HF_HUB_DISABLE_TELEMETRY: False
- HF_HUB_DISABLE_PROGRESS_BARS: None
- HF_HUB_DISABLE_SYMLINKS_WARNING: False
- HF_HUB_DISABLE_IMPLICIT_TOKEN: False
- HF_HUB_ENABLE_HF_TRANSFER: False
- HF_HUB_ETAG_TIMEOUT: 10
- HF_HUB_DOWNLOAD_TIMEOUT: 10

{'huggingface_hub version': '0.20.2', 'Platform': 'Windows-11-10.0.22621-SP0', 'Python version': '3.12.2', 'Running in iPython ?': 'No', 'Running in notebook ?': 'No', 'Running in Google Colab ?': 'No', 'Token path ?': 'C:\\Users\\panwa\\.cache\\huggingface\\token', 'Has saved token ?': False, 'Configured git credential helpers': 'manager', 'FastAI': 'N/A', 'Tensorflow': 'N/A', 'Torch': '2.2.1', 'Jinja2': '3.1.3', 'Graphviz': 'N/A', 'Pydot': 'N/A', 'Pillow': '10.2.0', 'hf_transfer': 'N/A', 'gradio': 'N/A', 'tensorboard': 'N/A', 'numpy': '1.26.4', 'pydantic': '2.6.1', 'aiohttp': '3.9.3', 'ENDPOINT': 'https://huggingface.co', 'HF_HUB_CACHE': 'C:\\Users\\panwa\\.cache\\huggingface\\hub', 'HF_ASSETS_CACHE': 'C:\\Users\\panwa\\.cache\\huggingface\\assets', 'HF_TOKEN_PATH': 'C:\\Users\\panwa\\.cache\\huggingface\\token', 'HF_HUB_OFFLINE': False, 'HF_HUB_DISABLE_TELEMETRY': False, 'HF_HUB_DISABLE_PROGRESS_BARS': None, 'HF_HUB_DISABLE_SYMLINKS_WARNING': False, 'HF_HUB_DISABLE_EXPERIMENTAL_WARNING': False, 'HF_HUB_DISABLE_IMPLICIT_TOKEN': False, 'HF_HUB_ENABLE_HF_TRANSFER': False, 'HF_HUB_ETAG_TIMEOUT': 10, 'HF_HUB_DOWNLOAD_TIMEOUT': 10}
ai-ml-with-kapil commented 9 months ago

Sometimes I am also getting

requests.exceptions.ConnectionError: (ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)), '(Request ID: 48f0d300-d29a-4633-b40f-bee23b47284b)')

Wauplin commented 9 months ago

Hi @ai-ml-with-kapil, sorry you're facing this issue. Could you copy-paste the full traceback when you get this OSError? It might contains more information to understand what's going on. The ConnectionError might be due to an unstable connection unfortunately. Do you constantly have such an error?

What you can try to do is to run

huggingface-cli download sentence-transformers/all-MiniLM-L6-v2

in your terminal which would download the whole repo in your cache. Once cached, loading the files should work. This way you decouple the "download" and the "load weights" parts. Hope this will prove useful in your case :confused:

Vasanthengineer4949 commented 8 months ago

Even for downloading I am unable to download actually

RikkB commented 8 months ago

From the command line: huggingface-cli download Gourieff/ReActor I get:

Consider using hf_transfer for faster downloads. This solution comes with some limitations. See https://huggingface.co/docs/huggingface_hub/hf_transfer for more details. Traceback (most recent call last): File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\urllib3\connectionpool.py", line 715, in urlopen httplib_response = self._make_request( File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\urllib3\connectionpool.py", line 404, in _make_request self._validate_conn(conn) File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\urllib3\connectionpool.py", line 1058, in _validate_conn conn.connect() File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\urllib3\connection.py", line 419, in connect self.sock = ssl_wrapsocket( File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\urllib3\util\ssl.py", line 449, in ssl_wrap_socket ssl_sock = _ssl_wrap_socketimpl( File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\urllib3\util\ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "C:\Python3_10_11\lib\ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "C:\Python3_10_11\lib\ssl.py", line 1071, in _create self.do_handshake() File "C:\Python3_10_11\lib\ssl.py", line 1342, in do_handshake self._sslobj.do_handshake() ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\requests\adapters.py", line 486, in send resp = conn.urlopen( File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\urllib3\connectionpool.py", line 799, in urlopen retries = retries.increment( File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\urllib3\util\retry.py", line 550, in increment raise six.reraise(type(error), error, _stacktrace) File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\urllib3\packages\six.py", line 769, in reraise raise value.with_traceback(tb) File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\urllib3\connectionpool.py", line 715, in urlopen httplib_response = self._make_request( File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\urllib3\connectionpool.py", line 404, in _make_request self._validate_conn(conn) File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\urllib3\connectionpool.py", line 1058, in _validate_conn conn.connect() File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\urllib3\connection.py", line 419, in connect self.sock = ssl_wrapsocket( File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\urllib3\util\ssl.py", line 449, in ssl_wrap_socket ssl_sock = _ssl_wrap_socketimpl( File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\urllib3\util\ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "C:\Python3_10_11\lib\ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "C:\Python3_10_11\lib\ssl.py", line 1071, in _create self.do_handshake() File "C:\Python3_10_11\lib\ssl.py", line 1342, in do_handshake self._sslobj.do_handshake() urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\huggingface_hub_snapshot_download.py", line 186, in snapshot_download repo_info = api.repo_info(repo_id=repo_id, repo_type=repo_type, revision=revision, token=token) File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\huggingface_hub\utils_validators.py", line 119, in _inner_fn return fn(*args, kwargs) File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\huggingface_hub\hf_api.py", line 2418, in repo_info return method( File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\huggingface_hub\utils_validators.py", line 119, in _inner_fn return fn(args, kwargs) File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\huggingface_hub\hf_api.py", line 2227, in model_info r = get_session().get(path, headers=headers, timeout=timeout, params=params) File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\requests\sessions.py", line 602, in get return self.request("GET", url, kwargs) File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\requests\sessions.py", line 589, in request resp = self.send(prep, send_kwargs) File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\requests\sessions.py", line 703, in send r = adapter.send(request, kwargs) File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\huggingface_hub\utils_http.py", line 68, in send return super().send(request, args, kwargs) File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\requests\adapters.py", line 501, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: (ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)), '(Request ID: 04132bd5-394c-475f-8bd2-d403014542d1)')

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Python3_10_11\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Python3_10_11\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\RV4Ly\ComfyUI\venv\Scripts\huggingface-cli.exe__main__.py", line 7, in File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\huggingface_hub\commands\huggingface_cli.py", line 49, in main service.run() File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\huggingface_hub\commands\download.py", line 161, in run print(self._download()) # Print path to downloaded files File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\huggingface_hub\commands\download.py", line 202, in _download return snapshot_download( File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\huggingface_hub\utils_validators.py", line 119, in _inner_fn return fn(*args, **kwargs) File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\huggingface_hub_snapshot_download.py", line 258, in snapshot_download raise LocalEntryNotFoundError( huggingface_hub.utils._errors.LocalEntryNotFoundError: An error happened while trying to locate the files on the Hub and we cannot find the appropriate snapshot folder for the specified revision on the local disk. Please check your internet connection and try again.

Occasionally, I'm able to retry & retry & retry and it may/may not actually connect and download the target file/repo.

In addition, I see that if I try to access Huggingface.co from my web browser I almost always get a connection error first, then refreshing the browser one, two, three times or more, I get a connection. I don't seem to have this issue with any other sites

AndreasKarasenko commented 7 months ago

Is there any update on this issue? I am getting similar errors when trying to download sample datasets ... E.g.

from datasets import load_dataset
imdb = load_dataset("imdb")

Leads to ConnectionError: Couldn't reach https://huggingface.co/datasets/imdb/resolve/e6281661ce1c48d982bc483cf8a173c1bbeb5d31/.huggingface.yaml (ConnectionError(ProtocolError('Connection aborted.', ConnectionResetError(10054, 'Eine vorhandene Verbindung wurde vom Remotehost geschlossen', None, 10054, None))))

And sometimes ConnectionError: Couldn't reach 'imdb' on the Hub (ConnectionError)

jamesmcbennett commented 7 months ago

@RikkB did you resolve it? I have the same issue.

RikkB commented 7 months ago

@RikkB did you resolve it? I have the same issue.

Have not resolved it. However, there are workarounds depending on how you're trying to access HF. Simplest workaround is to change network providers. I'm on Starlink & have found this ONLY occurs when a script is trying to d/l from HF via HF hub. However, if I look in the logs, I can manually download the same file from HF via browser (after a few tries); haven't tried HF hub cli.

Wauplin commented 7 months ago

@RikkB thanks for providing some context. Out of curiosity, do you know if you have ipv6 when accessing from Starlink?

RikkB commented 7 months ago

@RikkB thanks for providing some context. Out of curiosity, do you know if you have ipv6 when accessing from Starlink?

LOL.... never thought about, checked into it. But, yeah, ran some IPv6 tests & seems to work fine. As an alternative to wired network service, I've loved my SL; except for this little issue.

jamesmcbennett commented 7 months ago

I've got 5G T-Mobile internet (200+mbps) that has IPv6. My issue isn't worth switching internet providers over... I'm still a little unsure what the problem is, trying to get the most basic version working for the first time.

On Mon, Apr 29, 2024 at 2:46 PM RikkB @.***> wrote:

@RikkB https://github.com/RikkB thanks for providing some context. Out of curiosity, do you know if you have ipv6 when accessing from Starlink?

LOL.... never thought about, checked into it. But, yeah, ran some IPv6 tests & seems to work fine. As an alternative to wired network service, I've loved my SL; except for this little issue.

— Reply to this email directly, view it on GitHub https://github.com/huggingface/huggingface_hub/issues/2043#issuecomment-2083531854, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABU6QFGKUPN3EXZLEUWGJITY72PPZAVCNFSM6AAAAABDXD4AQCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBTGUZTCOBVGQ . You are receiving this because you commented.Message ID: @.***>

-- James McBennett jamesmcbennett.com

RikkB commented 7 months ago

...a little unsure what the problem is...

My best guess, there are unclosed HTTP requests between the provider (SL & T-Mobile, et al) and HF. MY THOUGHT is it's on HF's side, leaving connections open far too long.

I've seen code where there's built in retries (HF hub), but, I'm a long ways from being a coder anymore. Would just like to see a wait/retry loop built into the code.

jamesmcbennett commented 7 months ago

Whatever my issue, it's probably something else. Works on my old laptop but not my desktop using the same steps.

"Couldn't connect to the Hub: (ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)), '(Request ID: fc4e5a1d-055f-4903-9a4e-5d5e2019a121)')."

On Mon, Apr 29, 2024 at 4:16 PM RikkB @.***> wrote:

...a little unsure what the problem is...

My best guess, there are unclosed HTTP requests between the provider (SL & T-Mobile, et al) and HF. MY THOUGHT is it's on HF's side, leaving connections open far too long.

— Reply to this email directly, view it on GitHub https://github.com/huggingface/huggingface_hub/issues/2043#issuecomment-2083680286, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABU6QFDYWNUSMAVUSPQYCN3Y722B7AVCNFSM6AAAAABDXD4AQCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBTGY4DAMRYGY . You are receiving this because you commented.Message ID: @.***>

-- James McBennett jamesmcbennett.com

Wauplin commented 7 months ago

Thanks for the context @jamesmcbennett @RikkB ! As a test, could you try to disable ipv6, run the same script and tell me if you're able to reach HF that way? That would be really helpful to us

jamesmcbennett commented 7 months ago

and we have lift off!!!! Thank you. That was it for me, ipv6 disabled. Much much much appreciated!

On Tue, Apr 30, 2024 at 2:55 AM Lucain @.***> wrote:

Thanks for the context @jamesmcbennett https://github.com/jamesmcbennett @RikkB https://github.com/RikkB ! As a test, could you try to disable ipv6, run the same script and tell me if you're able to reach HF that way? That would be really helpful to us

— Reply to this email directly, view it on GitHub https://github.com/huggingface/huggingface_hub/issues/2043#issuecomment-2084632367, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABU6QFDU4XUDUOGV75EXCCLY75E7LAVCNFSM6AAAAABDXD4AQCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBUGYZTEMZWG4 . You are receiving this because you were mentioned.Message ID: @.***>

-- James McBennett jamesmcbennett.com

Wauplin commented 7 months ago

Great! Glad it solved your problem @jamesmcbennett and thanks for the feedback. That's very valuable to help us fix this :+1:

OfficiallyMelon commented 6 months ago

Can confirm issue only happening on Starlink with IPV6 enabled, disabling fixes error (for now).

RikkB commented 6 months ago

Previously, only had experienced this with HF. Two nights ago, started getting the same issue w/Github. When I disabled IPv6 the issue resolved. So, for me, for now, I consider this 'resolved' as I know a fairly simple workaround. TY for everyone's input and especially for those that realized it was an IPv6 issue.

julien-c commented 6 months ago

@coyotte508 is this not happening on your Starlink connection?

alisson-anjos commented 6 months ago

@Wauplin Thank you very much, it worked very well for me, I always had this problem, I never imagined it would be because of this.

YassinTalssis commented 2 months ago

If you're working on kaggle don't forget to get internet on. If you're working in local environment: create an account in hugging-face and use token