jina-ai / example-video-search

This is an example of search videos using jina
Apache License 2.0
23 stars 2 forks source link

Image encoder is failed to start #7

Closed jyotikhetan closed 2 years ago

jyotikhetan commented 2 years ago

I am trying to run this example.. I tried with different version of jina also..!!! I have given the path dynamically also still it threw the same error.. Please help

⠸ Fetching meta data of SimpleIndexer...  image_encoder@11633[E]:fail to load file dependency
  image_encoder@11633[E]:ExecutorFailToLoad() during <class 'jina.peapods.runtimes.zmq.zed.ZEDRuntime'> initialization
 add "--quiet-error" to suppress the exception details
Traceback (most recent call last):
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/peapods/runtimes/request_handlers/data_request_handler.py", line 85, in _load_executor
    runtime_args=vars(self.args),
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/jaml/__init__.py", line 556, in load_config
    return JAML.load(tag_yml, substitute=False)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/jaml/__init__.py", line 90, in load
    r = yaml.load(stream, Loader=JinaLoader)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/yaml/__init__.py", line 81, in load
    return loader.get_single_data()
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/yaml/constructor.py", line 51, in get_single_data
    return self.construct_document(node)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/yaml/constructor.py", line 55, in construct_document
    data = self.construct_object(node)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/yaml/constructor.py", line 100, in construct_object
    data = constructor(self, node)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/jaml/__init__.py", line 427, in _from_yaml
    return get_parser(cls, version=data.get('version', None)).parse(cls, data)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/jaml/parsers/executor/legacy.py", line 73, in parse
    runtime_args=data.get('runtime_args', {}),
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/executors/decorators.py", line 65, in arg_wrapper
    f = func(self, *args, **kwargs)
  File "/home/jyoti/.jina/hub-packages/3atsazub/executor/audioclip_image.py", line 51, in __init__
    self.model = AudioCLIP(pretrained=model_path).to(device).eval()
  File "/home/jyoti/.jina/hub-packages/3atsazub/executor/audio_clip/model/audioclip.py", line 98, in __init__
    self.load_state_dict(torch.load(self.pretrained, map_location='cpu'), strict=False)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/torch/serialization.py", line 594, in load
    with _open_file_like(f, 'rb') as opened_file:
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/torch/serialization.py", line 230, in _open_file_like
    return _open_file(name_or_buffer, mode)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/torch/serialization.py", line 211, in __init__
    super(_open_file, self).__init__(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: '.cache/AudioCLIP-Full-Training.pt'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/peapods/peas/__init__.py", line 76, in run
    cancel_event=cancel_event,
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/peapods/runtimes/zmq/zed.py", line 52, in __init__
    self._data_request_handler = DataRequestHandler(self.args, self.logger)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/peapods/runtimes/request_handlers/data_request_handler.py", line 68, in __init__
    self._load_executor()
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/peapods/runtimes/request_handlers/data_request_handler.py", line 95, in _load_executor
    raise ExecutorFailToLoad from ex
jina.excepts.ExecutorFailToLoad
UserWarning: 
                executor shadows one of built-in Python module name.
                It is imported as `jinahub.executor`

                Affects:
                - Either, change your code from using `from executor import ...` to `from jinahub.executor import ...`
                - Or, rename executor to another name
                 (raised from /home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/importer.py:197)
UserWarning: 
                executors shadows one of built-in Python module name.
                It is imported as `jinahub.executors`

                Affects:
                - Either, change your code from using `from executors import ...` to `from jinahub.executors import ...`
                - Or, rename executors to another name
                 (raised from /home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/importer.py:197)
UserWarning: 
                executors shadows one of built-in Python module name.
                It is imported as `jinahub.executors`

                Affects:
                - Either, change your code from using `from executors import ...` to `from jinahub.executors import ...`
                - Or, rename executors to another name
                 (raised from /home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/importer.py:197)
⠼ Fetching meta data of SimpleIndexer...  audio_encoder@11693[E]:fail to load file dependency
  audio_encoder@11693[E]:ExecutorFailToLoad() during <class 'jina.peapods.runtimes.zmq.zed.ZEDRuntime'> initialization
 add "--quiet-error" to suppress the exception details
Traceback (most recent call last):
  File "/home/jyoti/.jina/hub-packages/f4d22e1r/executor/audio_clip_encoder.py", line 43, in __init__
    self.model = AudioCLIP(pretrained=model_path).to(device).eval()
  File "/home/jyoti/.jina/hub-packages/f4d22e1r/executor/audio_clip/model/audioclip.py", line 98, in __init__
    self.load_state_dict(torch.load(self.pretrained, map_location='cpu'), strict=False)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/torch/serialization.py", line 594, in load
    with _open_file_like(f, 'rb') as opened_file:
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/torch/serialization.py", line 230, in _open_file_like
    return _open_file(name_or_buffer, mode)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/torch/serialization.py", line 211, in __init__
    super(_open_file, self).__init__(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: 'assets/AudioCLIP-Full-Training.pt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/peapods/runtimes/request_handlers/data_request_handler.py", line 85, in _load_executor
    runtime_args=vars(self.args),
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/jaml/__init__.py", line 556, in load_config
    return JAML.load(tag_yml, substitute=False)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/jaml/__init__.py", line 90, in load
    r = yaml.load(stream, Loader=JinaLoader)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/yaml/__init__.py", line 81, in load
    return loader.get_single_data()
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/yaml/constructor.py", line 51, in get_single_data
    return self.construct_document(node)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/yaml/constructor.py", line 55, in construct_document
    data = self.construct_object(node)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/yaml/constructor.py", line 100, in construct_object
    data = constructor(self, node)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/jaml/__init__.py", line 427, in _from_yaml
    return get_parser(cls, version=data.get('version', None)).parse(cls, data)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/jaml/parsers/executor/legacy.py", line 73, in parse
    runtime_args=data.get('runtime_args', {}),
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/executors/decorators.py", line 65, in arg_wrapper
    f = func(self, *args, **kwargs)
  File "/home/jyoti/.jina/hub-packages/f4d22e1r/executor/audio_clip_encoder.py", line 46, in __init__
    'Please download AudioCLIP model and set the `model_path` argument.'
FileNotFoundError: Please download AudioCLIP model and set the `model_path` argument.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/peapods/peas/__init__.py", line 76, in run
    cancel_event=cancel_event,
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/peapods/runtimes/zmq/zed.py", line 52, in __init__
    self._data_request_handler = DataRequestHandler(self.args, self.logger)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/peapods/runtimes/request_handlers/data_request_handler.py", line 68, in __init__
    self._load_executor()
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/peapods/runtimes/request_handlers/data_request_handler.py", line 95, in _load_executor
    raise ExecutorFailToLoad from ex
jina.excepts.ExecutorFailToLoad
UserWarning: 
                executor shadows one of built-in Python module name.
                It is imported as `jinahub.executor`

                Affects:
                - Either, change your code from using `from executor import ...` to `from jinahub.executor import ...`
                - Or, rename executor to another name
                 (raised from /home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/importer.py:197)
frame_extractor@11581[L]:ready and listening
   image_filter@11581[L]:ready and listening
           Flow@11581[E]:image_encoder:<jina.peapods.pods.Pod object at 0x7f2ebf55ab90> can not be started due to RuntimeFailToStart(), Flow is aborted
        gateway@11581[W]:Pea is being closed before being ready. Most likely some other Pea in the Flow or Pod failed to start
       join_all@11581[W]:Pea is being closed before being ready. Most likely some other Pea in the Flow or Pod failed to start
Traceback (most recent call last):
  File "app.py", line 76, in <module>
    main()
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "app.py", line 58, in main
    with Flow.load_config('index-flow.yml', override_with=override_dict) as f:
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/flow/base.py", line 930, in __enter__
    return self.start()
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/flow/base.py", line 975, in start
    v.wait_start_success()
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/peapods/pods/__init__.py", line 517, in wait_start_success
    p.wait_start_success()
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/peapods/peas/__init__.py", line 266, in wait_start_success
    raise RuntimeFailToStart
jina.excepts.RuntimeFailToStart

Please help.. Thank you

CatStark commented 2 years ago

Hi @jyotikhetan,

Thank you for raising this up. Could it be possible to format the tickets description (cmd+e) to make it easier to read? Thanks a lot.

JoanFM commented 2 years ago

Hello @jyotikhetan ,

The problem is that u do not have a pretrained model downloaded for the AudioCLIP to work. You need to download a pretrained model and use it as model_path parameter. I will soon try to point you to a direction where you can download such a model

JoanFM commented 2 years ago

@jyotikhetan ,

If you follow the steps from the README, u should see that it is expected from you to download a model and a script is provided to help with that.

bash scripts/download_model.sh
jyotikhetan commented 2 years ago

hi @JoanFM
I have downloaded the script & saved in folder models in same project along with bpe_simple_vocab_16e6.txt.gz. I tried giving path dynamically also.. still no luck.!!

JoanFM commented 2 years ago

can u list here the exact steps u are taking? how are u downloading, how are u passing the parameter?

jyotikhetan commented 2 years ago

Followed the same step as readme file

bash scripts/download_model.sh python app.py -m grpc

While running this command, I am getting the error.

JoanFM commented 2 years ago

this script downloads the model under models path, while the executor expects it under assets. You are not changing the argument passed to the executor

JoanFM commented 2 years ago

@jyotikhetan,

Could you please share exactly the changes you made to the flows? It seems that u are loading AudioCLIP as jinahub executor and not as jinahub+docker, is it right?

Also, could you also clarify at which stage do you see the error?

jyotikhetan commented 2 years ago

hi @JoanFM , I have given the model path dynamically this time... & changed the version of the executor, I am using python executor not docker... AudioCLIPTextEncoder/v0.3 SimpleIndexer/v0.1 AudioCLIPEncoder/v0.3

Now it's working..!! Now I am trying to index different videos... !!

Thank you very much for your help..!!

jyotikhetan commented 2 years ago

hi @JoanFM , Still I am getting the error , It was working last time. Please help

image_filter@7666[W]:Pea is being closed before being ready. Most likely some other Pea in the Flow or Pod failed to start
frame_extractor@7666[W]:Pea is being closed before being ready. Most likely some other Pea in the Flow or Pod failed to start
Traceback (most recent call last):
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 98, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1654, in parseString
    raise exc
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1644, in parseString
    loc, tokens = self._parse( instring, 0 )
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3739, in parseImpl
    return self.expr._parse( instring, loc, doActions, callPreParse=False )
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3400, in parseImpl
    loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1406, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 2711, in parseImpl
    raise ParseException(instring, loc, self.errmsg, self)
pkg_resources._vendor.pyparsing.ParseException: Expected W:(abcd...) (at char 0), (line:1, col:1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "app.py", line 76, in <module>
    main()
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "app.py", line 58, in main
    with Flow.load_config('index-flow.yml', override_with=override_dict) as f:
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/flow/base.py", line 1118, in __enter__
    return self.start()
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/flow/base.py", line 1165, in start
    self.enter_context(v)
  File "/usr/lib/python3.7/contextlib.py", line 427, in enter_context
    result = _cm_type.__enter__(cm)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/peapods/pods/__init__.py", line 197, in __enter__
    return self.start()
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/peapods/pods/__init__.py", line 574, in start
    self.enter_context(self.replica_set)
  File "/usr/lib/python3.7/contextlib.py", line 427, in enter_context
    result = _cm_type.__enter__(cm)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/peapods/pods/__init__.py", line 363, in __enter__
    pea = BasePea(_args)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/peapods/peas/__init__.py", line 135, in __init__
    self.runtime_cls = self._get_runtime_cls()
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/peapods/peas/__init__.py", line 427, in _get_runtime_cls
    update_runtime_cls(self.args)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/peapods/peas/helper.py", line 106, in update_runtime_cls
    _args.uses = HubIO(_hub_args).pull()
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/hubble/hubio.py", line 727, in pull
    pkg_path=pkg_dist_path,
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/hubble/hubapi.py", line 182, in install_package_dependencies
    elif not is_requirements_installed(requirements_file, show_warning=True):
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/jina/hubble/helper.py", line 335, in is_requirements_installed
    pkg_resources.require(requirements)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 886, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 728, in resolve
    requirements = list(requirements)[::-1]
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3084, in parse_requirements
    yield Requirement(line)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3094, in __init__
    super(Requirement, self).__init__(requirement_string)
  File "/home/jyoti/jina_video/jin_videoenv/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 102, in __init__
    requirement_string[e.loc : e.loc + 8], e.msg
pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'-f https'": Expected W:(abcd...)

Thank you

JoanFM commented 2 years ago

@mapleeit @numb3r3 could you please take a look at the issue? It seems aomething with HubIO is failing to parse.

@jyotikhetan could you please add to the best level of detail possible the steps needed to reproduce. Also can you please format the past message so that the Traceback looks better?

mapleeit commented 2 years ago

Sure. Joan. I'll check.

So the original error here is Parse error at "'-f https'": Expected W:(abcd...). But I remember that we fixed it before.

Hey @jyotikhetan . Which jina version are you using?

nan-wang commented 2 years ago

@jyotikhetan FYI, I've updated the codes to jina==2.5.4. It should work now.

jyotikhetan commented 2 years ago

hi @nan-wang , Thank you for update...!!works for me too...

JoanFM commented 2 years ago

Closing for now, thanks @jyotikhetan !