Can't download Meta-Llama-3-8B model due to a ConnectionError

Below is the snapshot_download command I sent
repo_id = “meta-llama/Meta-Llama-3-8B”
local_dir = “/home/canh/llama3-models/data/LLMs/llama-3/8B/Llama-3-8b/”
cache_dir = “/home/canh/llama3-models/data/8b/.cache”

from huggingface_hub import snapshot_download

snapshot_download(repo_id=repo_id, local_dir=local_dir, cache_dir=cache_dir)

And below is what I saw
Can you take a look and give me suggestions ?

Fetching 17 files: 35%|██████████████████████▉ | 6/17 [00:00<00:00, 22.09it/s]
Traceback (most recent call last):
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 789, in urlopen
response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 490, in _make_request
raise new_e
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 466, in _make_request
self._validate_conn(conn)
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 1095, in _validate_conn
conn.connect()
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/connection.py”, line 652, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/connection.py”, line 805, in ssl_wrap_socket_and_match_hostname
ssl_sock = ssl_wrap_socket(
^^^^^^^^^^^^^^^^
File "/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/util/ssl
.py", line 465, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/util/ssl
.py", line 509, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/ssl.py”, line 517, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/ssl.py”, line 1104, in _create
self.do_handshake()
File “/home/canh/anaconda3/envs/llama/lib/python3.11/ssl.py”, line 1382, in do_handshake
self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/requests/adapters.py”, line 667, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 843, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/util/retry.py”, line 474, in increment
raise reraise(type(error), error, _stacktrace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/util/util.py”, line 38, in reraise
raise value.with_traceback(tb)
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 789, in urlopen
response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 490, in _make_request
raise new_e
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 466, in _make_request
self._validate_conn(conn)
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 1095, in _validate_conn
conn.connect()
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/connection.py”, line 652, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/connection.py”, line 805, in ssl_wrap_socket_and_match_hostname
ssl_sock = ssl_wrap_socket(
^^^^^^^^^^^^^^^^
File "/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/util/ssl
.py", line 465, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/urllib3/util/ssl
.py", line 509, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/ssl.py”, line 517, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/ssl.py”, line 1104, in _create
self.do_handshake()
File “/home/canh/anaconda3/envs/llama/lib/python3.11/ssl.py”, line 1382, in do_handshake
self._sslobj.do_handshake()
urllib3.exceptions.ProtocolError: (‘Connection aborted.’, ConnectionResetError(104, ‘Connection reset by peer’))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/canh/llama_download.py”, line 7, in
snapshot_download(repo_id=repo_id, local_dir=local_dir, cache_dir=cache_dir)
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py”, line 114, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/huggingface_hub/_snapshot_download.py”, line 290, in snapshot_download
thread_map(
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/tqdm/contrib/concurrent.py”, line 69, in thread_map
return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/tqdm/contrib/concurrent.py”, line 51, in _executor_map
return list(tqdm_class(ex.map(fn, *iterables, chunksize=chunksize), **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/tqdm/std.py”, line 1181, in iter
for obj in iterable:
File “/home/canh/anaconda3/envs/llama/lib/python3.11/concurrent/futures/_base.py”, line 619, in result_iterator
yield _result_or_cancel(fs.pop())
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/concurrent/futures/_base.py”, line 317, in _result_or_cancel
return fut.result(timeout)
^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/concurrent/futures/_base.py”, line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/concurrent/futures/_base.py”, line 401, in __get_result
raise self._exception
File “/home/canh/anaconda3/envs/llama/lib/python3.11/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/huggingface_hub/_snapshot_download.py”, line 264, in _inner_hf_hub_download
return hf_hub_download(
^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/huggingface_hub/utils/_deprecation.py”, line 101, in inner_f
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py”, line 114, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/huggingface_hub/file_download.py”, line 1212, in hf_hub_download
return _hf_hub_download_to_local_dir(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/huggingface_hub/file_download.py”, line 1508, in _hf_hub_download_to_local_dir
_download_to_tmp_and_move(
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/huggingface_hub/file_download.py”, line 1915, in _download_to_tmp_and_move
http_get(
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/huggingface_hub/file_download.py”, line 455, in http_get
r = _request_wrapper(
^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/huggingface_hub/file_download.py”, line 387, in _request_wrapper
response = get_session().request(method=method, url=url, **params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/requests/sessions.py”, line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/requests/sessions.py”, line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/huggingface_hub/utils/_http.py”, line 93, in send
return super().send(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/canh/anaconda3/envs/llama/lib/python3.11/site-packages/requests/adapters.py”, line 682, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: (ProtocolError(‘Connection aborted.’, ConnectionResetError(104, ‘Connection reset by peer’)), ‘(Request ID: 055d2f8a-70f6-41f6-9a2c-4ee89df36c36)’)
(llama) [canh@Dalat2 ~]$

1 Like

There are several possible causes, but they all seem to be errors that occur in special network environments.
Otherwise, retrying may fix the problem.