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

"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
nil0330 opened this issue Oct 18, 2023 · 1 comment

Comments

@nil0330
Copy link

nil0330 commented Oct 18, 2023

*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?

@WindVChen
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants