Last active
April 3, 2023 12:06
-
-
Save alexcg1/d0f1300b2432d57ae6e7b8efc890798b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`. | |
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages (raised from /mnt/data/work/repos/scene-alexcg/env/lib/python3.10/site-packages/pkg_resources/__init__.py:2804) | |
DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google.logging')`. | |
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages (raised from /mnt/data/work/repos/scene-alexcg/env/lib/python3.10/site-packages/pkg_resources/__init__.py:2804) | |
DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`. | |
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages (raised from /mnt/data/work/repos/scene-alexcg/env/lib/python3.10/site-packages/pkg_resources/__init__.py:2309) | |
DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`. | |
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages (raised from /mnt/data/work/repos/scene-alexcg/env/lib/python3.10/site-packages/pkg_resources/__init__.py:2804) | |
Traceback (most recent call last): | |
File "/mnt/data/work/repos/scene-alexcg/clip_test.py", line 25, in <module> | |
describe_image() | |
File "/mnt/data/work/repos/scene-alexcg/clip_test.py", line 12, in describe_image | |
docs = client.post( | |
File "/mnt/data/work/repos/scene-alexcg/env/lib/python3.10/site-packages/jina/clients/mixin.py", line 281, in post | |
return run_async( | |
File "/mnt/data/work/repos/scene-alexcg/env/lib/python3.10/site-packages/jina/helper.py", line 1334, in run_async | |
return asyncio.run(func(*args, **kwargs)) | |
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run | |
return loop.run_until_complete(main) | |
File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete | |
return future.result() | |
File "/mnt/data/work/repos/scene-alexcg/env/lib/python3.10/site-packages/jina/clients/mixin.py", line 271, in _get_results | |
async for resp in c._get_results(*args, **kwargs): | |
File "/mnt/data/work/repos/scene-alexcg/env/lib/python3.10/site-packages/jina/clients/base/grpc.py", line 236, in _get_results | |
async for resp in self._stream_rpc( | |
File "/mnt/data/work/repos/scene-alexcg/env/lib/python3.10/site-packages/jina/clients/base/grpc.py", line 88, in _stream_rpc | |
callback_exec( | |
File "/mnt/data/work/repos/scene-alexcg/env/lib/python3.10/site-packages/jina/clients/helper.py", line 81, in callback_exec | |
raise BadServer(response.header) | |
jina.excepts.BadServer: request_id: "906309916016400abb3b3e182bedd856" | |
status { | |
code: ERROR | |
description: "FileNotFoundError(\'`input/mona_lisa.jpg` is not a URL or a valid local path\')" | |
exception { | |
name: "FileNotFoundError" | |
args: "`input/mona_lisa.jpg` is not a URL or a valid local path" | |
stacks: "Traceback (most recent call last):\n" | |
stacks: " File \"/usr/local/lib/python3.8/dist-packages/jina/serve/runtimes/worker/__init__.py\", line 269, in process_data\n result = await self._request_handler.handle(\n" | |
stacks: " File \"/usr/local/lib/python3.8/dist-packages/jina/serve/runtimes/worker/request_handling.py\", line 434, in handle\n return_data = await self._executor.__acall__(\n" | |
stacks: " File \"/usr/local/lib/python3.8/dist-packages/jina/serve/executors/__init__.py\", line 447, in __acall__\n return await self.__acall_endpoint__(req_endpoint, **kwargs)\n" | |
stacks: " File \"/usr/local/lib/python3.8/dist-packages/jina/serve/executors/__init__.py\", line 499, in __acall_endpoint__\n return await exec_func(\n" | |
stacks: " File \"/usr/local/lib/python3.8/dist-packages/jina/serve/executors/__init__.py\", line 464, in exec_func\n return await get_or_reuse_loop().run_in_executor(\n" | |
stacks: " File \"/usr/lib/python3.8/concurrent/futures/thread.py\", line 57, in run\n result = self.fn(*self.args, **self.kwargs)\n" | |
stacks: " File \"/usr/local/lib/python3.8/dist-packages/jina/serve/executors/decorators.py\", line 191, in arg_wrapper\n return fn(executor_instance, *args, **kwargs)\n" | |
stacks: " File \"/workspace/blip2/qformer_encoder.py\", line 131, in encode\n for minibatch, inputs in docs.map_batch(\n" | |
stacks: " File \"/usr/local/lib/python3.8/dist-packages/docarray/array/mixins/parallel.py\", line 305, in map_batch\n for x in track(\n" | |
stacks: " File \"/usr/local/lib/python3.8/dist-packages/rich/progress.py\", line 168, in track\n yield from progress.track(\n" | |
stacks: " File \"/usr/local/lib/python3.8/dist-packages/rich/progress.py\", line 1210, in track\n for value in sequence:\n" | |
stacks: " File \"/usr/lib/python3.8/multiprocessing/pool.py\", line 868, in next\n raise value\n" | |
stacks: " File \"/usr/lib/python3.8/multiprocessing/pool.py\", line 125, in worker\n result = (True, func(*args, **kwds))\n" | |
stacks: " File \"/workspace/blip2/qformer_encoder.py\", line 118, in _preproc_images\n return preproc_image(\n" | |
stacks: " File \"/workspace/blip2/helper.py\", line 34, in preproc_image\n image = Image.open(io.BytesIO(d.load_uri_to_blob().blob)).convert(\'RGB\')\n" | |
stacks: " File \"/usr/local/lib/python3.8/dist-packages/docarray/document/mixins/blob.py\", line 19, in load_uri_to_blob\n self.blob = _uri_to_blob(self.uri, **kwargs)\n" | |
stacks: " File \"/usr/local/lib/python3.8/dist-packages/docarray/document/mixins/helper.py\", line 24, in _uri_to_blob\n raise FileNotFoundError(f\'`{uri}` is not a URL or a valid local path\')\n" | |
stacks: "FileNotFoundError: `input/animal_grid_3x3.jpg` is not a URL or a valid local path\n" | |
executor: "QFormerEncoder" | |
} | |
} | |
exec_endpoint: "/vqa" | |
target_executor: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from dotenv import load_dotenv | |
from jina import Client, Document | |
load_dotenv() | |
def describe_image(): | |
client = Client(host='grpcs://fast-bonefish-6614861437-grpc.wolf.jina.ai') | |
docs = client.post( | |
on='/vqa', | |
inputs=[ | |
Document( | |
uri='animal_grid_3x3.jpg', | |
tags={'prompt': ''}, | |
) | |
], | |
metadata=(('authorization', os.getenv('JINA_TOKEN')),), | |
) | |
return docs[0].tags['response'] | |
describe_image() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment