Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About client API searching function #921

Open
kkiskkk opened this issue Jul 4, 2023 · 5 comments
Open

About client API searching function #921

kkiskkk opened this issue Jul 4, 2023 · 5 comments

Comments

@kkiskkk
Copy link

kkiskkk commented Jul 4, 2023

https://clip-as-service.jina.ai/user-guides/client/#searching
Following the example, the result returns an empty list []
instead of the expected: [['she smiled, with pain', ''], [{'value': 0.09604918956756592}, {'value': 0.7994111776351929}]]

@ZiniuYu
Copy link
Member

ZiniuYu commented Jul 4, 2023

Hi, as the tip suggests, do you have a flow with encoder and indexer?

@kkiskkk
Copy link
Author

kkiskkk commented Jul 4, 2023

Like this? I always feel that something is not right.

from clip_client import Client
from docarray import Document

c = Client('grpc://0.0.0.0:51000')

da = [
Document(text='she smiled, with pain'),
Document(uri='kkk.JPG'),
Document(uri='kkk.JPG').load_uri_to_image_tensor(),
Document(blob=open('kkk.JPG', 'rb').read()),
Document(uri='https://clip-as-service.jina.ai/_static/favicon.png'),
Document(
uri='data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7'
),
]

r = c.encode(da)

r = c.index(da)

print(r.summary())

result = c.search(['smile'], limit=2)

print(result['@m', ['text', 'scores__cosine']])

@ZiniuYu
Copy link
Member

ZiniuYu commented Jul 4, 2023

You may learn how to start a search flow with this documentation, and then you may use clip_client to do the searching

@hxgqh
Copy link

hxgqh commented Dec 30, 2023

You may learn how to start a search flow with this documentation, and then you may use clip_client to do the searching

Follow this document, it will fail:

ERROR  indexer/rep-0@73 fail to load file dependency         [12/30/23 08:53:42]
ERROR  indexer/rep-0@73 FileNotFoundError('can not find
       annlite.executor') during 'WorkerRuntime'
       initialization
        add "--quiet-error" to suppress the exception
       details
       Traceback (most recent call last):
         File
       "/usr/local/lib/python3.8/dist-packages/jina/orchest…
       line 89, in run
           runtime = AsyncNewLoopRuntime(
         File
       "/usr/local/lib/python3.8/dist-packages/jina/serve/r…
       line 81, in __init__
           self._loop.run_until_complete(self.async_setup())
         File "/usr/lib/python3.8/asyncio/base_events.py",
       line 616, in run_until_complete
           return future.result()
         File
       "/usr/local/lib/python3.8/dist-packages/jina/serve/r…
       line 255, in async_setup
           self.server = self._get_server()
         File
       "/usr/local/lib/python3.8/dist-packages/jina/serve/r…
       line 181, in _get_server
           return GRPCServer(
         File
       "/usr/local/lib/python3.8/dist-packages/jina/serve/r…
       line 30, in __init__
           super().__init__(**kwargs)
         File
       "/usr/local/lib/python3.8/dist-packages/jina/serve/r…
       line 54, in __init__
           self._request_handler = req_handler or
       self._get_request_handler()
         File
       "/usr/local/lib/python3.8/dist-packages/jina/serve/r…
       line 79, in _get_request_handler
           return self.req_handler_cls(
         File
       "/usr/local/lib/python3.8/dist-packages/jina/serve/r…
       line 127, in __init__
           self._load_executor(
         File
       "/usr/local/lib/python3.8/dist-packages/jina/serve/r…
       line 324, in _load_executor
           self._executor: BaseExecutor =
       BaseExecutor.load_config(
         File
       "/usr/local/lib/python3.8/dist-packages/jina/jaml/__…
       line 742, in load_config
           load_py_modules(
         File
       "/usr/local/lib/python3.8/dist-packages/jina/jaml/he…
       line 285, in load_py_modules
           PathImporter.add_modules(*mod)
         File
       "/usr/local/lib/python3.8/dist-packages/jina/importe…
       line 161, in add_modules
           _path_import(complete_path(m))
         File
       "/usr/local/lib/python3.8/dist-packages/jina/jaml/he…
       line 229, in complete_path
           raise FileNotFoundError(f'can not find {path}')
       FileNotFoundError: can not find annlite.executor
INFO   gateway/rep-0@74 start server bound to 0.0.0.0:51000  [12/30/23 08:53:42]
INFO   encoder/rep-0@72 start server bound to 0.0.0.0:58717  [12/30/23 08:53:50]
ERROR  Flow@ 1 Flow is aborted due to ['indexer'] can not be [12/30/23 08:53:51]
       started.
UserWarning: `docs` annotation must be a type hint, got DocumentArray instead, you should maybe remove the string annotation. Default valueDocumentArray will be used instead. (raised from /usr/local/lib/python3.8/dist-packages/jina/serve/executors/__init__.py:119)
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.8/dist-packages/clip_server/__main__.py", line 25, in <module>
    with f:
  File "/usr/local/lib/python3.8/dist-packages/jina/orchestrate/orchestrator.py", line 14, in __enter__
    return self.start()
  File "/usr/local/lib/python3.8/dist-packages/jina/orchestrate/flow/builder.py", line 33, in arg_wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/jina/orchestrate/flow/base.py", line 1832, in start
    self._wait_until_all_ready()
  File "/usr/local/lib/python3.8/dist-packages/jina/orchestrate/flow/base.py", line 1975, in _wait_until_all_ready
    raise RuntimeFailToStart
jina.excepts.RuntimeFailToStart

@Rusteam
Copy link

Rusteam commented Mar 22, 2024

@hxgqh you need to install annlite package. I had the same issue and resolved it by installing annlite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants