InternLM / InternLM/InternLM-XComposer
huggingface的代码示例报错
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 175
- PR merge metrics
- No merged PRs in 30d
Description
这是我的文件结构图,里面已经把模型下载好了

但我用怕跑的时候报这个错误
/home/shf/anaconda3/envs/llama/bin/python /media/shf/sda/code/InternLM-XComposer-main/test.py
You are using a model of type internlmxcomposer2 to instantiate a model of type internlm. This is not supported for all configurations of models and can yield errors.
[2024-03-25 14:12:17,398] [INFO] [real_accelerator.py:158:get_accelerator] Setting ds_accelerator to cuda (auto detect)
Set max length to 4096
Traceback (most recent call last):
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/urllib3/util/connection.py", line 95, in create_connection
raise err
File "/home/shf/anaconda3/envs/llama/lib/python3.8/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 "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/urllib3/connectionpool.py", line 714, in urlopen
httplib_response = self._make_request(
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/urllib3/connectionpool.py", line 403, in _make_request
self._validate_conn(conn)
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1053, in _validate_conn
conn.connect()
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/urllib3/connection.py", line 363, in connect
self.sock = conn = self._new_conn()
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: : 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/shf/anaconda3/envs/llama/lib/python3.8/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/urllib3/connectionpool.py", line 798, in urlopen
retries = retries.increment(
File "/home/shf/anaconda3/envs/llama/lib/python3.8/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: /openai/clip-vit-large-patch14-336/resolve/main/config.json (Caused by NewConnectionError(': 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/shf/anaconda3/envs/llama/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 1261, in hf_hub_download
metadata = get_hf_file_metadata(
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
return fn(*args, **kwargs)
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 1667, in get_hf_file_metadata
r = _request_wrapper(
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 385, in _request_wrapper
response = _request_wrapper(
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 408, in _request_wrapper
response = get_session().request(method=method, url=url, **params)
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/huggingface_hub/utils/_http.py", line 67, in send
return super().send(request, *args, **kwargs)
File "/home/shf/anaconda3/envs/llama/lib/python3.8/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: /openai/clip-vit-large-patch14-336/resolve/main/config.json (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 101] Network is unreachable'))"), '(Request ID: 0f1ae55b-e895-4ed1-af62-de65d803ba20)')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/transformers/utils/hub.py", line 398, in cached_file
resolved_file = hf_hub_download(
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
return fn(*args, **kwargs)
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 1406, 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.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/media/shf/sda/code/InternLM-XComposer-main/test.py", line 7, in
model = AutoModel.from_pretrained('internlm/internlm-xcomposer2-vl-7b',local_files_only=True , trust_remote_code=True).cuda().eval()
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/transformers/models/auto/auto_factory.py", line 556, in from_pretrained
return model_class.from_pretrained(
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/transformers/modeling_utils.py", line 3375, in from_pretrained
model = cls(config, *model_args, **model_kwargs)
File "/home/shf/.cache/huggingface/modules/transformers_modules/internlm-xcomposer2-vl-7b/modeling_internlm_xcomposer2.py", line 67, in __init__
self.vit = build_vision_tower()
File "/home/shf/.cache/huggingface/modules/transformers_modules/internlm-xcomposer2-vl-7b/build_mlp.py", line 11, in build_vision_tower
return CLIPVisionTower(vision_tower)
File "/home/shf/.cache/huggingface/modules/transformers_modules/internlm-xcomposer2-vl-7b/build_mlp.py", line 58, in __init__
self.load_model()
File "/home/shf/.cache/huggingface/modules/transformers_modules/internlm-xcomposer2-vl-7b/build_mlp.py", line 62, in load_model
self.vision_tower = CLIPVisionModel.from_pretrained(
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/transformers/modeling_utils.py", line 2981, in from_pretrained
config, model_kwargs = cls.config_class.from_pretrained(
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/transformers/models/clip/configuration_clip.py", line 251, in from_pretrained
config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/transformers/configuration_utils.py", line 633, in get_config_dict
config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/transformers/configuration_utils.py", line 688, in _get_config_dict
resolved_config_file = cached_file(
File "/home/shf/anaconda3/envs/llama/lib/python3.8/site-packages/transformers/utils/hub.py", line 441, in cached_file
raise EnvironmentError(
OSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like openai/clip-vit-large-patch14-336 is not the path to a directory containing a file named config.json.
Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.
(llama) shf@shf-Z790-UD:/media/shf/sda/code/InternLM-XComposer-main$
请问这是为什么 该如何解决 并让它正常进行推理呢
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.