jina-ai / clip-as-service

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

An exception when executing "python -m clip_server" #937

Closed sawsam closed 1 year ago

sawsam commented 1 year ago

INFO gateway/rep-0@32304 start server bound to 127.0.0.1:51000 [10/30/23 10:55:09] 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 C:\Python311\Lib\site-packages\jina\serve\executors__init.py:267) CRITI… clip_t/rep-0@23436 can not load the executor from {"jtype": "CLIPEncoder", "metas": {"py_modules": ["clip_server.executors.clip_torch"]}} [10/30/23 10:55:12] ERROR clip_t/rep-0@23436 TypeError("VisionTransformer.init() got an unexpected keyword argument 'global_average_pool'") during 'WorkerRuntime' initialization add "--quiet-error" to suppress the exception details Traceback (most recent call last): File "C:\Python311\Lib\site-packages\jina\serve\executors\run.py", line 140, in run runtime = AsyncNewLoopRuntime( ^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\jina\serve\runtimes\asyncio.py", line 92, in init self._loop.run_until_complete(self.async_setup()) File "C:\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\jina\serve\runtimes\asyncio.py", line 309, in async_setup self.server = self._get_server() ^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\jina\serve\runtimes\asyncio.py", line 214, in _get_server return GRPCServer( ^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\jina\serve\runtimes\servers\grpc.py", line 34, in init super().init(kwargs) File "C:\Python311\Lib\site-packages\jina\serve\runtimes\servers__init.py", line 63, in init ] = (req_handler or self._get_request_handler()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\jina\serve\runtimes\servers__init.py", line 88, in _get_request_handler return self.req_handler_cls( ^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\jina\serve\runtimes\worker\request_handling.py", line 139, in init__ self._load_executor( File "C:\Python311\Lib\site-packages\jina\serve\runtimes\worker\request_handling.py", line 374, in _load_executor self._executor: BaseExecutor = BaseExecutor.load_config( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\jina\jaml__init.py", line 792, in load_config obj = JAML.load(tag_yml, substitute=False, runtime_args=runtime_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\jina\jaml\init__.py", line 174, in load r = yaml.load(stream, Loader=get_jina_loader_with_runtime(runtime_args)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\yaml\init.py", line 81, in load return loader.get_single_data() ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\yaml\constructor.py", line 51, in get_single_data return self.construct_document(node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\yaml\constructor.py", line 55, in construct_document data = self.construct_object(node) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\yaml\constructor.py", line 100, in construct_object data = constructor(self, node) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\jina\jaml\init__.py", line 582, in _from_yaml return get_parser(cls, version=data.get('version', None)).parse( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\jina\jaml\parsers\executor\legacy.py", line 46, in parse obj = cls( ^^^^ File "C:\Python311\Lib\site-packages\jina\serve\executors\decorators.py", line 58, in arg_wrapper f = func(self, *args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\jina\serve\helper.py", line 73, in arg_wrapper f = func(self, args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\clip_server\executors\clip_torch.py", line 91, in init__ self._model = CLIPModel( ^^^^^^^^^^ File "C:\Python311\Lib\site-packages\clip_server\model\openclip_model.py", line 38, in init self._model = load_openai_model( ^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\clip_server\model\model.py", line 477, in load_openai_model model = build_model_from_openai_state_dict( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\clip_server\model\model.py", line 413, in build_model_from_openai_state_dict model = CLIP( ^^^^^ File "C:\Python311\Lib\site-packages\clip_server\model\model.py", line 281, in init self.visual = _build_vision_tower( ^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\clip_server\model\model.py", line 193, in _build_vision_tower visual = VisionTransformer( ^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\clip_server\model\model.py", line 83, in init super().init( TypeError: VisionTransformer.init() got an unexpected keyword argument 'global_average_pool' ERROR Flow@13032 An exception occurred: [10/30/23 10:55:12] ERROR Flow@13032 Flow is aborted due to ['clip_t'] can not be started. WARNI… gateway/rep-0@13032 Pod was forced to close after 1 second. Graceful closing is not available on Windows. [10/30/23 10:55:13] Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Python311\Lib\site-packages\clip_server__main.py", line 25, in with f: File "C:\Python311\Lib\site-packages\jina\orchestrate\orchestrator.py", line 14, in enter__ return self.start() ^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\jina\orchestrate\flow\builder.py", line 33, in arg_wrapper return func(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\jina\orchestrate\flow\base.py", line 1846, in start self._wait_until_all_ready() File "C:\Python311\Lib\site-packages\jina\orchestrate\flow\base.py", line 2012, in _wait_until_all_ready raise RuntimeFailToStart jina.excepts.RuntimeFailToStart

michelpromonet commented 1 year ago

Hi,

It seems that downgrading open-clip-torch allow to run clip_server

pip install open-clip-torch==2.22.0

Best Regards, Michel.

sawsam commented 1 year ago

it works, thank you very much!