Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to access Huggingface #2043

Open
ai-ml-with-kapil opened this issue Feb 23, 2024 · 20 comments
Open

Unable to access Huggingface #2043

ai-ml-with-kapil opened this issue Feb 23, 2024 · 20 comments
Labels
bug Something isn't working

Comments

@ai-ml-with-kapil
Copy link

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 ai-ml-with-kapil added the bug Something isn't working label Feb 23, 2024
@ai-ml-with-kapil
Copy link
Author

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
Copy link
Contributor

Wauplin commented Feb 26, 2024

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 😕

@Vasanthengineer4949
Copy link

Even for downloading I am unable to download actually

@RikkB
Copy link

RikkB commented Apr 2, 2024

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_wrap_socket(
File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\urllib3\util\ssl
.py", line 449, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(
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_wrap_socket(
File "C:\Users\RV4Ly\ComfyUI\venv\lib\site-packages\urllib3\util\ssl
.py", line 449, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(
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
Copy link

AndreasKarasenko commented Apr 17, 2024

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
Copy link

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

@RikkB
Copy link

RikkB commented Apr 29, 2024

@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
Copy link
Contributor

Wauplin commented Apr 29, 2024

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

@RikkB
Copy link

RikkB commented Apr 29, 2024

@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
Copy link

jamesmcbennett commented Apr 29, 2024 via email

@RikkB
Copy link

RikkB commented Apr 29, 2024

...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
Copy link

jamesmcbennett commented Apr 30, 2024 via email

@Wauplin
Copy link
Contributor

Wauplin commented Apr 30, 2024

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
Copy link

jamesmcbennett commented Apr 30, 2024 via email

@Wauplin
Copy link
Contributor

Wauplin commented Apr 30, 2024

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

@OfficiallyMelon
Copy link

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

@RikkB
Copy link

RikkB commented May 9, 2024

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
Copy link
Member

julien-c commented May 9, 2024

@coyotte508 is this not happening on your Starlink connection?

@alisson-anjos
Copy link

alisson-anjos commented May 9, 2024

@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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants