jina-ai / clip-as-service

🏄 Scalable embedding, reasoning, ranking for images and sentences with CLIP
https://clip-as-service.jina.ai
Other
12.44k stars 2.07k forks source link

Error when using Client.encode() on a docarray created from the amazon-berkeley-objects-dataset #879

Open devinzli opened 1 year ago

devinzli commented 1 year ago

Here is the trace. `Traceback (most recent call last): File "C:\Python\Python37\lib\site-packages\jina\clients\helper.py", line 47, in _arg_wrapper return func(*args, **kwargs) File "C:\Python\Python37\lib\site-packages\clip_client\client.py", line 169, in _gather_result results[r[:, 'id']][:, attribute] = r[:, attribute] File "C:\Python\Python37\lib\site-packages\docarray\array\mixins\getitem.py", line 102, in getitem elif isinstance(index[0], bool): IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File ".\main.py", line 15, in encoded_docarray = clt.encode(doc_array, show_progress=True) File "C:\Python\Python37\lib\site-packages\clip_client\client.py", line 336, in encode parameters=parameters, File "C:\Python\Python37\lib\site-packages\jina\clients\mixin.py", line 288, in post kwargs, File "C:\Python\Python37\lib\site-packages\jina\helper.py", line 1342, in run_async return future.result() File "C:\Python\Python37\lib\site-packages\jina\clients\mixin.py", line 264, in _get_results async for resp in c._get_results(*args, *kwargs): return future.result() File "C:\Python\Python37\lib\site-packages\jina\clients\mixin.py", line 264, in _get_results async for resp in c._get_results(args, kwargs): File "C:\Python\Python37\lib\site-packages\jina\clients\base\grpc.py", line 146, in _get_results logger=self.logger, File "C:\Python\Python37\lib\site-packages\jina\clients\helper.py", line 83, in callback_exec _safe_callback(on_done, continue_on_error, logger)(response) File "C:\Python\Python37\lib\site-packages\jina\clients\helper.py", line 49, in _arg_wrapper err_msg = f'uncaught exception in callback {func.name}(): {ex!r}' AttributeError: 'functools.partial' object has no attribute 'name'`

ZiniuYu commented 1 year ago

Hi, what's your reproducible script? Please make sure the input is valid and complete.

devinzli commented 1 year ago

This is what I did.

from docarray import DocumentArray, Document from clip_client import Client import numpy as np

doc_array = DocumentArray.pull('amazon-berkeley-objects-dataset', show_progress=True) clt = Client('grpcs://api.clip.jina.ai:2096', credential={'Authorization': 'insert-authorization-code'}) encoded_docarray = clt.encode(doc_array, show_progress=True)

ZiniuYu commented 1 year ago

@devinzli Hi, we improved our services over the past weeks. Can you try again?

amarbakir commented 2 months ago

I ran into the exact problem described in the original post (IndexError + AttributeError). Our jina pip dependency was not pinned, and a Dockerfile rebuild ended up pulling a new version and mysteriously breaking everything one morning. Rollbacks didn't help

What ultimately worked was this combination of dependencies

clip-client==0.8.3
clip-retrieval==2.37.0
jina==3.24.0

Hope this helps others! If there are any questions let me know 🙏