sstary / SSRS

Apache License 2.0
317 stars 38 forks source link

Huggingface:运行train_Mamba.py时报错。貌似是联网问题,请问如何解决?感谢!!! #23

Closed Tate2099 closed 6 months ago

Tate2099 commented 6 months ago

RS3Mamba, Train, Vaihingen /home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/timm/models/_factory.py:117: UserWarning: Mapping deprecated model name swsl_resnet18 to current resnet18.fb_swsl_ig1b_ft_in1k. model = create_fn( Traceback (most recent call last): File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/urllib3/connection.py", line 174, in _new_conn conn = connection.create_connection( File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/urllib3/util/connection.py", line 95, in create_connection raise err File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/urllib3/util/connection.py", line 85, in create_connection sock.connect(sa) TimeoutError: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/urllib3/connectionpool.py", line 386, in _make_request self._validate_conn(conn) File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn conn.connect() File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/urllib3/connection.py", line 358, in connect self.sock = conn = self._new_conn() File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/urllib3/connection.py", line 179, in _new_conn raise ConnectTimeoutError( urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x7f616ad8c580>, 'Connection to huggingface.co timed out. (connect timeout=10)')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/requests/adapters.py", line 489, in send resp = conn.urlopen( File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen retries = retries.increment( File "/home/zl/anaconda3/envs/RS/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/resnet18.fb_swsl_ig1b_ft_in1k/resolve/main/pytorch_model.bin (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f616ad8c580>, 'Connection to huggingface.co timed out. (connect timeout=10)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1722, in _get_metadata_or_catch_error metadata = get_hf_file_metadata(url=url, proxies=proxies, timeout=etag_timeout, headers=headers) File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn return fn(args, kwargs) File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1645, in get_hf_file_metadata r = _request_wrapper( File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 372, in _request_wrapper response = _request_wrapper( File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 395, in _request_wrapper response = get_session().request(method=method, url=url, params) File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/requests/sessions.py", line 587, in request resp = self.send(prep, send_kwargs) File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/requests/sessions.py", line 701, in send r = adapter.send(request, kwargs) File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/huggingface_hub/utils/_http.py", line 66, in send return super().send(request, args, **kwargs) File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/requests/adapters.py", line 553, in send raise ConnectTimeout(e, request=request) requests.exceptions.ConnectTimeout: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /timm/resnet18.fb_swsl_ig1b_ft_in1k/resolve/main/pytorch_model.bin (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f616ad8c580>, 'Connection to huggingface.co timed out. (connect timeout=10)'))"), '(Request ID: 4ba8abf4-e029-406d-99e7-c6ebbdfee09e)')

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

Traceback (most recent call last): File "/home/zl/Desktop/SSRS-main/RS3Mamba/train_Mamba.py", line 28, in net = RS3Mamba(num_classes=N_CLASSES).cuda() File "/home/zl/Desktop/SSRS-main/RS3Mamba/model/RS3Mamba.py", line 516, in init self.backbone = timm.create_model(backbone_name, features_only=True, output_stride=32, File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/timm/models/_factory.py", line 117, in create_model model = create_fn( File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/timm/models/_registry.py", line 145, in _fn return current_fn(pretrained=pretrained, pretrained_cfg=pretrained_cfg or current_tag, kwargs) File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/timm/models/resnet.py", line 1266, in resnet18 return _create_resnet('resnet18', pretrained, dict(model_args, kwargs)) File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/timm/models/resnet.py", line 584, in _create_resnet return build_model_with_cfg(ResNet, variant, pretrained, kwargs) File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/timm/models/_builder.py", line 410, in build_model_with_cfg load_pretrained( File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/timm/models/_builder.py", line 190, in load_pretrained state_dict = load_state_dict_from_hf(pretrained_loc) File "/home/zl/anaconda3/envs/RS/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/zl/anaconda3/envs/RS/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1221, in hf_hub_download return _hf_hub_download_to_cache_dir( File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1325, in _hf_hub_download_to_cache_dir _raise_on_head_call_error(head_call_error, force_download, local_files_only) File "/home/zl/anaconda3/envs/RS/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1826, in _raise_on_head_call_error 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.

sstary commented 6 months ago

请参考:https://github.com/Stability-AI/generative-models/issues/215#issuecomment-1960803222