Skip to content

Download Weights byModelScope  #24

@YangSun22

Description

@YangSun22

When I follow the link below, I get a request to download clip-vit-large-patch14-336. Should I download it separately offline? And how do I use it after downloading it offline?

https://github.com/Q-Future/Q-Instruct/tree/main/model_zoo#modelscope

from llava.mm_utils import get_model_name_from_path
from llava.eval.run_llava import eval_model
model_path = "/home/yangsun/.cache/modelscope/hub/qfuture/llava_v1.5_7b_qinstruct_preview_v0.1" 
prompt = "Rate the quality of the image. Think step by step."
image_file = "/home/yangsun/LLM_Fusion_result/llava_Q/Q-Instruct-main/fig/sausage.jpg"
args = type('Args', (), {
    "model_path": model_path,
    "model_base": None,
    "model_name": get_model_name_from_path(model_path),
    "query": prompt,
    "conv_mode": None,
    "image_file": image_file,
    "sep": ",",
})()
eval_model(args)
[2024-05-22 20:10:14,064] [INFO] [real_accelerator.py:161:get_accelerator] Setting ds_accelerator to cuda (auto detect)
You are using a model of type llava to instantiate a model of type llava_llama. This is not supported for all configurations of models and can yield errors.
Traceback (most recent call last):
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/urllib3/util/connection.py", line 95, in create_connection
    raise err
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/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/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/urllib3/connectionpool.py", line 715, in urlopen
    httplib_response = self._make_request(
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/urllib3/connectionpool.py", line 404, in _make_request
    self._validate_conn(conn)
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1058, in _validate_conn
    conn.connect()
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/urllib3/connection.py", line 363, in connect
    self.sock = conn = self._new_conn()
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f421d6eb4f0>: 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/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/requests/adapters.py", line 489, in send
    resp = conn.urlopen(
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/urllib3/connectionpool.py", line 799, in urlopen
    retries = retries.increment(
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/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('<urllib3.connection.HTTPSConnection object at 0x7f421d6eb4f0>: 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/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 1261, in hf_hub_download
    metadata = get_hf_file_metadata(
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 119, in _inner_fn
    return fn(*args, **kwargs)
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 1674, in get_hf_file_metadata
    r = _request_wrapper(
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 369, in _request_wrapper
    response = _request_wrapper(
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 392, in _request_wrapper
    response = get_session().request(method=method, url=url, **params)
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/huggingface_hub/utils/_http.py", line 68, in send
    return super().send(request, *args, **kwargs)
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/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: /openai/clip-vit-large-patch14-336/resolve/main/config.json (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f421d6eb4f0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))"), '(Request ID: 0bcf62c8-f497-46a9-af92-597126388abe)')

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

Traceback (most recent call last):
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/transformers/utils/hub.py", line 385, in cached_file
    resolved_file = hf_hub_download(
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 119, in _inner_fn
    return fn(*args, **kwargs)
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/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 "/home/yangsun/LLM_Fusion_result/llava_Q/Q-Instruct-main/eval_scripts/llava_v1.5/eval_generate.py", line 15, in <module>
    eval_model(args)
  File "/home/yangsun/LLM_Fusion_result/llava/llava/eval/run_llava.py", line 55, in eval_model
    tokenizer, model, image_processor, context_len = load_pretrained_model(
  File "/home/yangsun/LLM_Fusion_result/llava/llava/model/builder.py", line 117, in load_pretrained_model
    model = LlavaLlamaForCausalLM.from_pretrained(
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/transformers/modeling_utils.py", line 3594, in from_pretrained
    model = cls(config, *model_args, **model_kwargs)
  File "/home/yangsun/LLM_Fusion_result/llava/llava/model/language_model/llava_llama.py", line 46, in __init__
    self.model = LlavaLlamaModel(config)
  File "/home/yangsun/LLM_Fusion_result/llava/llava/model/language_model/llava_llama.py", line 38, in __init__
    super(LlavaLlamaModel, self).__init__(config)
  File "/home/yangsun/LLM_Fusion_result/llava/llava/model/llava_arch.py", line 35, in __init__
    self.vision_tower = build_vision_tower(config, delay_load=True)
  File "/home/yangsun/LLM_Fusion_result/llava/llava/model/multimodal_encoder/builder.py", line 13, in build_vision_tower
    return CLIPVisionTower(vision_tower, args=vision_tower_cfg, **kwargs)
  File "/home/yangsun/LLM_Fusion_result/llava/llava/model/multimodal_encoder/clip_encoder.py", line 22, in __init__
    self.cfg_only = CLIPVisionConfig.from_pretrained(self.vision_tower_name)
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/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/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/transformers/configuration_utils.py", line 634, in get_config_dict
    config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/transformers/configuration_utils.py", line 689, in _get_config_dict
    resolved_config_file = cached_file(
  File "/home/yangsun/miniconda3/envs/internvl/lib/python3.9/site-packages/transformers/utils/hub.py", line 425, 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'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions