Failed to load the downloaded model locally
(multi-cpr) (base) aaa@U-P2GY409C-2044 main % python _.py
The repository for /Users/aaa/Downloads/models/jina-clip-v2 contains custom code which must be executed to correctly load the model. You can inspect the repository content at https://hf.co//Users/aaa/Downloads/models/jina-clip-v2.
You can avoid this prompt in future by passing the argument `trust_remote_code=True`.
Do you wish to run the custom code? [y/N] y
Could not locate the configuration_clip.py inside jinaai/jina-clip-implementation.
Traceback (most recent call last):
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/urllib3/util/connection.py", line 95, in create_connection
raise err
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/urllib3/util/connection.py", line 85, in create_connection
sock.connect(sa)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 715, in urlopen
httplib_response = self._make_request(
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 404, in _make_request
self._validate_conn(conn)
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1060, in _validate_conn
conn.connect()
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/urllib3/connection.py", line 363, in connect
self.sock = conn = self._new_conn()
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/urllib3/connection.py", line 179, in _new_conn
raise ConnectTimeoutError(
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x15daf7670>, 'Connection to huggingface.co timed out. (connect timeout=10)')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/requests/adapters.py", line 667, in send
resp = conn.urlopen(
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 801, in urlopen
retries = retries.increment(
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/urllib3/util/retry.py", line 594, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /jinaai/jina-clip-implementation/resolve/main/configuration_clip.py (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x15daf7670>, 'Connection to huggingface.co timed out. (connect timeout=10)'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 1376, in _get_metadata_or_catch_error
metadata = get_hf_file_metadata(
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 1296, in get_hf_file_metadata
r = _request_wrapper(
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 277, in _request_wrapper
response = _request_wrapper(
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 300, in _request_wrapper
response = get_session().request(method=method, url=url, **params)
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/huggingface_hub/utils/_http.py", line 93, in send
return super().send(request, *args, **kwargs)
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/requests/adapters.py", line 688, in send
raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /jinaai/jina-clip-implementation/resolve/main/configuration_clip.py (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x15daf7670>, 'Connection to huggingface.co timed out. (connect timeout=10)'))"), '(Request ID: 9bf7941c-3fd9-4b32-bd88-c4bfbfe66a43)')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/transformers/utils/hub.py", line 403, in cached_file
resolved_file = hf_hub_download(
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 862, in hf_hub_download
return _hf_hub_download_to_cache_dir(
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 969, in _hf_hub_download_to_cache_dir
_raise_on_head_call_error(head_call_error, force_download, local_files_only)
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 1487, in _raise_on_head_call_error
raise LocalEntryNotFoundError(
huggingface_hub.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 "_.py", line 119, in <module>
model = AutoModel.from_pretrained('/Users/aaa/Downloads/models/jina-clip-v2')
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/transformers/models/auto/auto_factory.py", line 526, in from_pretrained
config, kwargs = AutoConfig.from_pretrained(
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/transformers/models/auto/configuration_auto.py", line 1026, in from_pretrained
config_class = get_class_from_dynamic_module(
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/transformers/dynamic_module_utils.py", line 540, in get_class_from_dynamic_module
final_module = get_cached_module_file(
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/transformers/dynamic_module_utils.py", line 344, in get_cached_module_file
resolved_module_file = cached_file(
File "/Users/aaa/miniforge3/envs/multi-cpr/lib/python3.8/site-packages/transformers/utils/hub.py", line 446, 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 jinaai/jina-clip-implementation is not the path to a directory containing a file named configuration_clip.py.
Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.
same error...
any solution?
same error...
any solution?
not yet
i also asked almost the same question in this linkhttps://huggingface.co/jinaai/jina-clip-v2/discussions/51#6844228fa26ea79a0c828004
You can also pay attention here.
hi, seems it's a huggingface issue? can you manually copy the file and put it into the cache folder? this is what you want: https://huggingface.co/jinaai/jina-clip-implementation/blob/main/configuration_clip.py
also please be aware the license of the model, it's perfectly fine to use it for testing / experimental / research purpose :)
hi, seems it's a huggingface issue? can you manually copy the file and put it into the cache folder? this is what you want: https://huggingface.co/jinaai/jina-clip-implementation/blob/main/configuration_clip.py
Please see the problem in this link, which is my latest problem: https://huggingface.co/jinaai/jina-clip-v2/discussions/51#6844228fa26ea79a0c828004
Download the content in https://huggingface.co/jinaai/jina-clip-implementation/tree/main to the local folder my_jina_clip and run:
from my_jina_clip.modeling_clip import JinaCLIPModel
model=JinaCLIPModel.from_pretrained("./jina-clip-v2")
Check the model, the structure of the printed JinaCLIPModel is as follows:
JinaCLIPModel(
(text_model): HFTextEncoder(
(transformer): XLMRobertaLoRA(
(roberta): XLMRobertaModel(
(embeddings): XLMRobertaEmbeddings(
(word_embeddings): ParametrizedEmbedding(
250002, 1024, padding_idx=1
(parametrizations): ModuleDict(
(weight): ParametrizationList(
(0): LoRAParametrization()
)
)
)
(token_type_embeddings): ParametrizedEmbedding(
1, 1024
(parametrizations): ModuleDict(
(weight): ParametrizationList(
(0): LoRAParametrization()
)
)
)
)
(emb_drop): Dropout(p=0.1, inplace=False)
(emb_ln): LayerNorm((1024,), eps=1e-05, elementwise_affine=True)
(encoder): XLMRobertaEncoder(
(layers): ModuleList(
(0-23): 24 x Block(
(mixer): MHA(
(rotary_emb): RotaryEmbedding()
(Wqkv): ParametrizedLinearResidual(
in_features=1024, out_features=3072, bias=True
(parametrizations): ModuleDict(
(weight): ParametrizationList(
(0): LoRAParametrization()
)
)
)
(inner_attn): SelfAttention(
(drop): Dropout(p=0.1, inplace=False)
)
(inner_cross_attn): CrossAttention(
(drop): Dropout(p=0.1, inplace=False)
)
(out_proj): ParametrizedLinear(
in_features=1024, out_features=1024, bias=True
(parametrizations): ModuleDict(
(weight): ParametrizationList(
(0): LoRAParametrization()
)
)
)
)
(dropout1): Dropout(p=0.1, inplace=False)
(drop_path1): StochasticDepth(p=0.0, mode=row)
(norm1): LayerNorm((1024,), eps=1e-05, elementwise_affine=True)
(mlp): Mlp(
(fc1): ParametrizedLinear(
in_features=1024, out_features=4096, bias=True
(parametrizations): ModuleDict(
(weight): ParametrizationList(
(0): LoRAParametrization()
)
)
)
(fc2): ParametrizedLinear(
in_features=4096, out_features=1024, bias=True
(parametrizations): ModuleDict(
(weight): ParametrizationList(
(0): LoRAParametrization()
)
)
)
)
(dropout2): Dropout(p=0.1, inplace=False)
(drop_path2): StochasticDepth(p=0.0, mode=row)
(norm2): LayerNorm((1024,), eps=1e-05, elementwise_affine=True)
)
)
)
)
)
(pooler): MeanPooler()
(proj): Identity()
)
(vision_model): EVAVisionTransformer(
(patch_embed): PatchEmbed(
(proj): Conv2d(3, 1024, kernel_size=(14, 14), stride=(14, 14))
)
(pos_drop): Dropout(p=0.0, inplace=False)
(rope): VisionRotaryEmbeddingFast()
(blocks): ModuleList(
(0-23): 24 x Block(
(norm1): LayerNorm((1024,), eps=1e-06, elementwise_affine=True)
(attn): Attention(
(q_proj): Linear(in_features=1024, out_features=1024, bias=False)
(k_proj): Linear(in_features=1024, out_features=1024, bias=False)
(v_proj): Linear(in_features=1024, out_features=1024, bias=False)
(attn_drop): Dropout(p=0.0, inplace=False)
(inner_attn_ln): LayerNorm((1024,), eps=1e-06, elementwise_affine=True)
(proj): Linear(in_features=1024, out_features=1024, bias=True)
(proj_drop): Dropout(p=0.0, inplace=False)
(rope): VisionRotaryEmbeddingFast()
)
(drop_path): Identity()
(norm2): LayerNorm((1024,), eps=1e-06, elementwise_affine=True)
(mlp): SwiGLU(
(w1): Linear(in_features=1024, out_features=2730, bias=True)
(w2): Linear(in_features=1024, out_features=2730, bias=True)
(act): SiLU()
(ffn_ln): LayerNorm((2730,), eps=1e-06, elementwise_affine=True)
(w3): Linear(in_features=2730, out_features=1024, bias=True)
(drop): Dropout(p=0.0, inplace=False)
)
)
)
(norm): LayerNorm((1024,), eps=1e-06, elementwise_affine=True)
(head): Identity()
(patch_dropout): PatchDropout()
)
(visual_projection): Identity()
(text_projection): Identity()
)
But I did not find any definition of the XLMRobertaLoRA model in https://huggingface.co/jinaai/jina-clip-implementation/tree/main, and when loading this model (the part starting from line 134 of the source code hf_model.py), trust_remote_code=True
is still set. So this means that I still cannot use the JinaCLIPModel model offline.
My environment:
python: 3.8.20
transformers: 4.46.3
I only use your model for research and will not use it for any commercial behavior.