jina-ai / jina

☁️ Build multimodal AI applications with cloud-native stack
https://docs.jina.ai
Apache License 2.0
20.87k stars 2.22k forks source link

ContainerPea not handling properly uses_internal overriding entrypoint #943

Closed JoanFM closed 3 years ago

JoanFM commented 3 years ago

Describe the bug When trying to migrate crossmodal search example, I try to change the logic by mantaining inside txt_emb folder a simple config:

!VSETextEncoder
metas:
  py_modules:
    - vocab.py
    - model.py
    - __init__.py

and provide from the outside with the use of uses_internal the file 'yaml/text_encoder.yml:

!VSETextEncoder
metas:
  py_modules:
    - vocab.py
    - model.py
    - __init__.py
requests:
  on:
    IndexRequest:
      - !FilterQL
        with:
          lookups: {'modality': 'text'}
      - !EncodeDriver {}
    SearchRequest:
      - !FilterQL
        with:
          lookups: {'mime_type__contains': 'text'}
      - !EncodeDriver {}

But it does not seem to work in the same way as having the file directly inside the docker by default. in the ENTRYPOINT.

┆Issue is synchronized with this Jira Task by Unito

JoanFM commented 3 years ago

Ok, I think the problem will be where does it find the py_modules

JoanFM commented 3 years ago

Solution is to set the py_modules being aware that inside the container the files would be underworkspace`:

!VSETextEncoder
metas:
  py_modules:
    - workspace/vocab.py
    - workspace/model.py
    - workspace/__init__.py
requests:
  on:
    IndexRequest:
      - !FilterQL
        with:
          lookups: {'modality': 'text'}
      - !EncodeDriver {}
    SearchRequest:
      - !FilterQL
        with:
          lookups: {'mime_type__contains': 'text'}
      - !EncodeDriver {}