PKU-YuanGroup / Chat-UniVi

[CVPR 2024 Highlight🔥] Chat-UniVi: Unified Visual Representation Empowers Large Language Models with Image and Video Understanding
https://arxiv.org/abs/2311.08046
Apache License 2.0
755 stars 41 forks source link

Failed to run main_demo_7B.py #28

Closed wegigabyteinsn closed 5 months ago

wegigabyteinsn commented 5 months ago

Traceback (most recent call last): File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/urllib3/connection.py", line 198, in _new_conn sock = connection.create_connection( File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/urllib3/util/connection.py", line 85, in create_connection raise err File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/urllib3/util/connection.py", line 73, in create_connection sock.connect(sa) OSError: [Errno 101] Network is unreachable

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

Traceback (most recent call last): File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/urllib3/connectionpool.py", line 793, in urlopen response = self._make_request( File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/urllib3/connectionpool.py", line 491, in _make_request raise new_e File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/urllib3/connectionpool.py", line 467, in _make_request self._validate_conn(conn) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1099, in _validate_conn conn.connect() File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/urllib3/connection.py", line 616, in connect self.sock = sock = self._new_conn() File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/urllib3/connection.py", line 213, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f1660c21ff0>: Failed to establish a new connection: [Errno 101] Network is unreachable

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

Traceback (most recent call last): File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/requests/adapters.py", line 486, in send resp = conn.urlopen( File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/urllib3/connectionpool.py", line 847, in urlopen retries = retries.increment( File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/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: /Chat-UniVi/Chat-UniVi/resolve/main/config.json (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f1660c21ff0>: 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/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1261, in hf_hub_download metadata = get_hf_file_metadata( File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 119, in _inner_fn return fn(args, kwargs) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1674, in get_hf_file_metadata r = _request_wrapper( File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 369, in _request_wrapper response = _request_wrapper( File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 392, in _request_wrapper response = get_session().request(method=method, url=url, params) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, send_kwargs) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, kwargs) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/huggingface_hub/utils/_http.py", line 68, in send return super().send(request, args, **kwargs) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/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: /Chat-UniVi/Chat-UniVi/resolve/main/config.json (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f1660c21ff0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))"), '(Request ID: 03e8848e-8e3a-4d15-a588-283f20594441)')

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

Traceback (most recent call last): File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/transformers/utils/hub.py", line 417, in cached_file resolved_file = hf_hub_download( File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 119, in _inner_fn return fn(*args, **kwargs) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/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.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/ubuntu22/anaconda3/envs/chatunivi/bin/uvicorn", line 8, in sys.exit(main()) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/click/core.py", line 783, in invoke return __callback(args, kwargs) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/uvicorn/main.py", line 409, in main run( File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/uvicorn/main.py", line 575, in run server.run() File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run return asyncio.run(self.serve(sockets=sockets)) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/uvicorn/server.py", line 69, in serve await self._serve(sockets) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/uvicorn/server.py", line 76, in _serve config.load() File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/uvicorn/config.py", line 433, in load self.loaded_app = import_from_string(self.app) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/uvicorn/importer.py", line 19, in import_from_string module = importlib.import_module(module_str) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/home/ubuntu22/chat/main_demo_7B.py", line 119, in handler = Chat(model_path, conv_mode=conv_mode) File "/home/ubuntu22/chat/ChatUniVi/demo.py", line 16, in init self.tokenizer, self.model, self.image_processor, context_len = load_pretrained_model(model_path, None, model_name="ChatUniVi") File "/home/ubuntu22/chat/ChatUniVi/model/builder.py", line 74, in load_pretrained_model tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/transformers/models/auto/tokenization_auto.py", line 667, in from_pretrained config = AutoConfig.from_pretrained( File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 983, in from_pretrained config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, kwargs) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/transformers/configuration_utils.py", line 617, in get_config_dict config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs) File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/transformers/configuration_utils.py", line 672, in _get_config_dict resolved_config_file = cached_file( File "/home/ubuntu22/anaconda3/envs/chatunivi/lib/python3.10/site-packages/transformers/utils/hub.py", line 452, 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 Chat-UniVi/Chat-UniVi 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'

jpthu17 commented 5 months ago

The error appears to be a network connection problem.

Here is an approach to download the model and run the demo using the huggingface mirror website:

(1) Download models

pip install -U huggingface_hub
export HF_ENDPOINT=https://hf-mirror.com

# For our model
huggingface-cli download --resume-download --local-dir-use-symlinks False Chat-UniVi/Chat-UniVi --local-dir ${your path}/Chat-UniVi

# For CLIP
huggingface-cli download --resume-download --local-dir-use-symlinks False openai/clip-vit-large-patch14 --local-dir ${your path}/clip-vit-large-patch14

(2) Modify model paths

(3) Run the demo

CUDA_VISIBLE_DEVICES=0 uvicorn main_demo_7B:app --host 0.0.0.0 --port 8888