问题描述
Traceback (most recent call last):
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/urllib3/connection.py", line 203, in _new_conn
sock = connection.create_connection(
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/urllib3/util/connection.py", line 85, in create_connection
raise err
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/urllib3/util/connection.py", line 73, in create_connection
sock.connect(sa)
OSError: [Errno 113] No route to host
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/urllib3/connectionpool.py", line 790, in urlopen
response = self._make_request(
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/urllib3/connectionpool.py", line 491, in _make_request
raise new_e
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/urllib3/connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1096, in _validate_conn
conn.connect()
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/urllib3/connection.py", line 611, in connect
self.sock = sock = self._new_conn()
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/urllib3/connection.py", line 218, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7fbf305f9b50>: Failed to establish a new connection: [Errno 113] No route to host
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/urllib3/connectionpool.py", line 844, in urlopen
retries = retries.increment(
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/urllib3/util/retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /laion/CLIP-ViT-H-14-laion2B-s32B-b79K/resolve/main/open_clip_pytorch_model.bin (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fbf305f9b50>: Failed to establish a new connection: [Errno 113] No route to host'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 1247, in hf_hub_download
metadata = get_hf_file_metadata(
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
return fn(*args, **kwargs)
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 1624, in get_hf_file_metadata
r = _request_wrapper(
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 402, in _request_wrapper
response = _request_wrapper(
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 425, in _request_wrapper
response = get_session().request(method=method, url=url, **params)
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/huggingface_hub/utils/_http.py", line 63, in send
return super().send(request, *args, **kwargs)
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/requests/adapters.py", line 519, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /laion/CLIP-ViT-H-14-laion2B-s32B-b79K/resolve/main/open_clip_pytorch_model.bin (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fbf305f9b50>: Failed to establish a new connection: [Errno 113] No route to host'))"), '(Request ID: 4c8819e2-c10b-4c21-be90-781a99e19186)')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/media/visionx/monica/project/GlyphControl-release/inference.py", line 143, in <module>
model = load_model_from_config(cfg, args.ckpt, verbose=True)
File "/media/visionx/monica/project/GlyphControl-release/scripts/rendertext_tool.py", line 22, in load_model_from_config
model = instantiate_from_config(cfg.model)
File "/media/visionx/monica/project/GlyphControl-release/ldm/util.py", line 79, in instantiate_from_config
return get_obj_from_str(config["target"])(**config.get("params", dict()))
File "/media/visionx/monica/project/GlyphControl-release/cldm/cldm.py", line 334, in __init__
super().__init__(*args, use_ema=False, **kwargs)
File "/media/visionx/monica/project/GlyphControl-release/ldm/models/diffusion/ddpm.py", line 632, in __init__
self.instantiate_cond_stage(cond_stage_config)
File "/media/visionx/monica/project/GlyphControl-release/ldm/models/diffusion/ddpm.py", line 763, in instantiate_cond_stage
model = instantiate_from_config(config)
File "/media/visionx/monica/project/GlyphControl-release/ldm/util.py", line 79, in instantiate_from_config
return get_obj_from_str(config["target"])(**config.get("params", dict()))
File "/media/visionx/monica/project/GlyphControl-release/ldm/modules/encoders/modules.py", line 182, in __init__
model, _, _ = open_clip.create_model_and_transforms(arch, device=torch.device('cpu'), pretrained=version)
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/open_clip/factory.py", line 382, in create_model_and_transforms
model = create_model(
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/open_clip/factory.py", line 281, in create_model
checkpoint_path = download_pretrained(pretrained_cfg, cache_dir=cache_dir)
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/open_clip/pretrained.py", line 552, in download_pretrained
target = download_pretrained_from_hf(model_id, cache_dir=cache_dir)
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/open_clip/pretrained.py", line 522, in download_pretrained_from_hf
cached_file = hf_hub_download(model_id, filename, revision=revision, cache_dir=cache_dir)
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
return fn(*args, **kwargs)
File "/home/visionx/anaconda3/envs/glyphcontrol/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 1377, 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.
解决办法
出现No route to host 的时候,有如下几种可能:
1、对方的域名确实不通
2、本机自己开了防火墙
3、本机的etc/hosts 里面没有配置本机的机器名和ip (可能性最大)
其中第三点是最猫腻的,在不配置的时候是间断性的(可能1个月都正常,然后突然几天不正常)。修改方案如下:
在结尾加上:机器名和机器ip(用空格隔开)
————————————————
版权声明:本文为CSDN博主「浪子尘晨」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/fygkchina/article/details/103425183
延伸阅读
我懒得为自己辩解,因为你不值得