Skip to content

"I may not be able to use a VPN when running the code on the server, and I encounter numerous errors every time it reaches the 'Transfer to deit-b' part. How can I resolve this?" #11

Open

Description

@nil0330

*Transfer to deit-b
Traceback (most recent call last):
File "/usr/local/miniconda3/envs/students/lib/python3.10/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/usr/local/miniconda3/envs/students/lib/python3.10/site-packages/urllib3/util/connection.py", line 95, in create_connection
raise err
File "/usr/local/miniconda3/envs/students/lib/python3.10/site-packages/urllib3/util/connection.py", line 85, in create_connection
sock.connect(sa)
OSError: [Errno 101] Network is unreachable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/miniconda3/envs/students/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/usr/local/miniconda3/envs/students/lib/python3.10/site-packages/urllib3/connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "/usr/local/miniconda3/envs/students/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
conn.connect()
File "/usr/local/miniconda3/envs/students/lib/python3.10/site-packages/urllib3/connection.py", line 358, in connect
self.sock = conn = self._new_conn()
File "/usr/local/miniconda3/envs/students/lib/python3.10/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7eff29f1e2f0>: Failed to establish a new connection: [Errno 101] Network is unreachable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/miniconda3/envs/students/lib/python3.10/site-packages/requests/adapters.py", line 489, in send
resp = conn.urlopen(
File "/usr/local/miniconda3/envs/students/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "/usr/local/miniconda3/envs/students/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /timm/deit_base_patch16_224.fb_in1k/resolve/main/pytorch_model.bin (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7eff29f1e2f0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/tianfengyuan/.local/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1232, in hf_hub_download
metadata = get_hf_file_metadata(
File "/home/tianfengyuan/.local/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
return fn(*args, **kwargs)
File "/home/tianfengyuan/.local/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1599, in get_hf_file_metadata
r = _request_wrapper(
File "/home/tianfengyuan/.local/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 417, in _request_wrapper
response = _request_wrapper(
File "/home/tianfengyuan/.local/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 452, in _request_wrapper
return http_backoff(
File "/home/tianfengyuan/.local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py", line 258, in http_backoff
response = session.request(method=method, url=url, **kwargs)
File "/usr/local/miniconda3/envs/students/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/miniconda3/envs/students/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/home/tianfengyuan/.local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py", line 63, in send
return super().send(request, *args, **kwargs)
File "/usr/local/miniconda3/envs/students/lib/python3.10/site-packages/requests/adapters.py", line 565, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /timm/deit_base_patch16_224.fb_in1k/resolve/main/pytorch_model.bin (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7eff29f1e2f0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))"), '(Request ID: 95b9f5fa-b3a6-4355-a9a0-acd37a7082d9)')

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

Traceback (most recent call last):
File "/home/tianfengyuan/diff_attack/DiffAttack/main.py", line 203, in
model_transfer(images, adv_images, label, res, save_path=save_dir, args=args)
File "/home/tianfengyuan/diff_attack/DiffAttack/other_attacks.py", line 111, in model_transfer
model = model_selection(name)
File "/home/tianfengyuan/diff_attack/DiffAttack/other_attacks.py", line 37, in model_selection
model = timm.create_model(
File "/home/tianfengyuan/.local/lib/python3.10/site-packages/timm/models/_factory.py", line 114, in create_model
model = create_fn(
File "/home/tianfengyuan/.local/lib/python3.10/site-packages/timm/models/deit.py", line 269, in deit_base_patch16_224
model = _create_deit('deit_base_patch16_224', pretrained=pretrained, **dict(model_args, **kwargs))
File "/home/tianfengyuan/.local/lib/python3.10/site-packages/timm/models/deit.py", line 125, in _create_deit
model = build_model_with_cfg(
File "/home/tianfengyuan/.local/lib/python3.10/site-packages/timm/models/_builder.py", line 393, in build_model_with_cfg
load_pretrained(
File "/home/tianfengyuan/.local/lib/python3.10/site-packages/timm/models/_builder.py", line 186, in load_pretrained
state_dict = load_state_dict_from_hf(pretrained_loc)
File "/home/tianfengyuan/.local/lib/python3.10/site-packages/timm/models/_hub.py", line 188, in load_state_dict_from_hf
cached_file = hf_hub_download(hf_model_id, filename=filename, revision=hf_revision)
File "/home/tianfengyuan/.local/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
return fn(*args, **kwargs)
File "/home/tianfengyuan/.local/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1349, in hf_hub_download
raise LocalEntryNotFoundError(
huggingface_hub.utils._errors.LocalEntryNotFoundError: An error happened while trying to locate the file on the Hub and we cannot find the requested files in the local cache. Please check your connection and try again or make sure your Internet connection is on.

I may not be able to use a VPN when running the code on the server, and I encounter numerous errors every time it reaches the 'Transfer to deit-b' part. How can I resolve this?

Activity

  1. WindVChen commented on Oct 18, 2023

    @WindVChen
    Owner

    Hi @nil0330 ,

    An alternative way is to download the pre-trained weight manually. I would recommend referring to the answer here.

    Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions