jina-ai / serve

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

TypeError("get_embedding() got an unexpected keyword argument 'texts'") #1717

Closed yiouyou closed 3 years ago

yiouyou commented 3 years ago

Describe the bug

Can not load encoder model. The encoder.yml is as below:

!TextPaddlehubEncoder
with:
  model_name: chinese-electra-small
requests:
  on:
    ControlRequest:
      - !ControlReqDriver {}
    [SearchRequest, TrainRequest, IndexRequest]:
      - !EncodeDriver
        with:
          traversal_paths: ['c']

Showed errors: image

Describe how you solve it


Environment

jina 0.9.16

Screenshots

JoanFM commented 3 years ago

Hey @yiouyou , can you add show-exc-info: True to your pod.yml?

And also could you increase or unset the timeout-ready option? disable means setting to -1? I think the error may be due to the encodrr not having enough time to download from the hub and to load the modle in memory.

yiouyou commented 3 years ago

index.yml

!Flow
pods:
  crafter:
    uses: pods/craft.yml
    read_only: true
  encoder:
    uses: pods/encode.yml
    parallel: $JINA_PARALLEL
    timeout_ready: -1
    read_only: true
    show-exc-info: true
  chunk_idx:
    uses: pods/chunk.yml
    shards: $JINA_SHARDS
    separated_workspace: true
  doc_idx:
    uses: pods/doc.yml
    needs: gateway
    show-exc-info: true
  join_all:
    uses: _merge
    needs: [doc_idx, chunk_idx]

The 'chinese-electra-small' model is downloaded and installed successfully, but still errors:

(py37-sz-lyrics) sz@pc:/mnt/d/jina-ai/zh-multires-lyrics-search$ python app.py index
crafter/ZEDRuntime@22376[I]:input tcp://0.0.0.0:33467 (SUB_CONNECT) output tcp://0.0.0.0:40211 (PUSH_CONNECT) control over tcp://0.0.0.0:44727 (PAIR_BIND)
    Sentencizer@22376[I]:post_init may take some time...
    Sentencizer@22376[I]:post_init may take some time takes 0 seconds (0.00s)
    Sentencizer@22376[S]:successfully built Sentencizer from a yaml config
        crafter@22357[S]:ready and listening
encoder/head/ZEDRuntime@22382[I]:input tcp://0.0.0.0:40211 (PULL_BIND) output tcp://0.0.0.0:57115 (ROUTER_BIND) control over tcp://0.0.0.0:38723 (PAIR_BIND)
   BaseExecutor@22382[I]:post_init may take some time...
   BaseExecutor@22382[I]:post_init may take some time takes 0 seconds (0.00s)
   BaseExecutor@22382[S]:successfully built BaseExecutor from a yaml config
   encoder/head@22357[S]:ready and listening
encoder/tail/ZEDRuntime@22388[I]:input tcp://0.0.0.0:40145 (PULL_BIND) output tcp://0.0.0.0:41987 (PUSH_CONNECT) control over tcp://0.0.0.0:54801 (PAIR_BIND)
   BaseExecutor@22388[I]:post_init may take some time...
   BaseExecutor@22388[I]:post_init may take some time takes 0 seconds (0.00s)
   BaseExecutor@22388[S]:successfully built BaseExecutor from a yaml config
   encoder/tail@22357[S]:ready and listening
encoder/1/ZEDRuntime@22394[I]:input tcp://0.0.0.0:57115 (DEALER_CONNECT) output tcp://0.0.0.0:40145 (PUSH_CONNECT) control over tcp://0.0.0.0:38813 (PAIR_BIND)
TextPaddlehubEncoder@22394[I]:post_init may take some time...
[2021-01-17 23:20:01,858] [    INFO] - Installing chinese-electra-small module
Downloading chinese-electra-small
[==================================================] 100.00%
Uncompress /home/sz/.paddlehub/tmp/tmpngv8epd9/chinese-electra-small
[==================================================] 100.00%
[2021-01-17 23:20:06,065] [    INFO] - Successfully installed chinese-electra-small-2.0.0
TextPaddlehubEncoder@22394[I]:post_init may take some time takes 21 seconds (21.24s)
encoder/1/ZEDRuntime@22394[C]:can not load the executor from pods/encode.yml
      encoder/1@22394[E]:
Traceback (most recent call last):
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/runtimes/zmq/zed.py", line 70, in _load_executor
    read_only=self.args.read_only)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/jaml/__init__.py", line 396, in load_config
    return JAML.load(revert_tag_yml, substitute=False)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/jaml/__init__.py", line 85, in load
    r = yaml.load(stream, Loader=JinaLoader)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/yaml/__init__.py", line 114, in load
    return loader.get_single_data()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/yaml/constructor.py", line 51, in get_single_data
    return self.construct_document(node)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/yaml/constructor.py", line 55, in construct_document
    data = self.construct_object(node)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/yaml/constructor.py", line 100, in construct_object
    data = constructor(self, node)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/jaml/__init__.py", line 307, in _from_yaml
    return get_parser(cls, version=data.get('version', None)).parse(cls, data)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/jaml/parsers/executor/legacy.py", line 62, in parse
    obj = cls(**data.get('with', {}), metas=data.get('metas', {}), requests=data.get('requests', {}))
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/executors/__init__.py", line 55, in __call__
    getattr(obj, '_post_init_wrapper', lambda *x: None)(m, r)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/executors/__init__.py", line 144, in _post_init_wrapper
    self.post_init()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/hub/encoders/nlp/TextPaddlehubEncoder/__init__.py", line 35, in post_init
    self.model = hub.Module(name=self.model_name)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/paddlehub/module/module.py", line 102, in __new__
    name=name, version=version, **kwargs)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/paddlehub/module/module.py", line 178, in init_with_name
    return cls.init_with_directory(directory=module_dir[0], **kwargs)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/paddlehub/module/module.py", line 193, in init_with_directory
    _module = importlib.import_module("{}.module".format(basename))
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/sz/.paddlehub/modules/chinese_electra_small/module.py", line 18, in <module>
    import paddle.nn as nn
ModuleNotFoundError: No module named 'paddle.nn'

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

Traceback (most recent call last):
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/peas/__init__.py", line 67, in run
    self.runtime.setup()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/runtimes/zmq/zed.py", line 40, in setup
    self._load_executor()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/runtimes/zmq/zed.py", line 81, in _load_executor
    raise ExecutorFailToLoad from ex
jina.excepts.ExecutorFailToLoad
      encoder/1@22357[C]:fail to start <BasePea(encoder/1, started)> because <jina.peapods.runtimes.zmq.zed.ZEDRuntime object at 0x7f3336b88910> throws some exception, add "--show-exc-info" to see the exception stack in details
Traceback (most recent call last):
  File "app.py", line 83, in <module>
    main()
  File "app.py", line 73, in main
    index()
  File "app.py", line 39, in index
    with f:
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/flow/base.py", line 385, in __enter__
    return self.start()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/flow/base.py", line 418, in start
    self.enter_context(v)
  File "/usr/lib/python3.7/contextlib.py", line 427, in enter_context
    result = _cm_type.__enter__(cm)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/pods/__init__.py", line 208, in __enter__
    return self.start()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/pods/__init__.py", line 199, in start
    self._enter_pea(BasePea(_args))
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/pods/__init__.py", line 205, in _enter_pea
    self.enter_context(pea)
  File "/usr/lib/python3.7/contextlib.py", line 427, in enter_context
    result = _cm_type.__enter__(cm)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/peas/__init__.py", line 175, in __enter__
    return self.start()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/peas/__init__.py", line 117, in start
    raise RuntimeFailToStart
jina.excepts.RuntimeFailToStart
yiouyou commented 3 years ago

requirements.txt

jina[hub,http]==0.9.16
torch==1.7.1
transformers==4.2.0
requests==2.25.1
pytest==6.2.1
paddlehub==2.0.0rc0
paddlepaddle==2.0.0rc1
JoanFM commented 3 years ago

You are missing the module paddle.nn.

yiouyou commented 3 years ago

Once update the upper requirements.txt (paddlehub and paddlepaddle)

The install seems OK now. But when run

curl --request POST -d '{"top_k": 1, "mode": "search",  "data": ["text:这是看电影最糟糕的部分"]}' -H 'Content-Type: application/json' 'http://0.0.0.0:65481/api/search'

it showed errors as below: image

Here is the feedback of 'curl' command

{
  "requestId": "13d867a6-593d-11eb-b30f-00155dabdd5c",
  "search": {
    "docs": [
      {
        "id": "3280f48b48b7392e",
        "chunks": [
          {
            "id": "82b820c075397a7f",
            "weight": 1.0,
            "length": 1,
            "mimeType": "text/plain",
            "text": "text:",
            "granularity": 1,
            "parentId": "3280f48b48b7392e",
            "location": [
              0,
              16
            ],
            "contentHash": "7cdd07a5c7f05de3"
          }
        ],
        "weight": 1.0,
        "mimeType": "text/plain",
        "text": "text:\u8fd9\u662f\u770b\u7535\u5f71\u6700\u7cdf\u7cd5\u7684\u90e8\u5206",
        "contentHash": "f61b460fa40edf5c"
      }
    ]
  },
  "status": {
    "code": "ERROR",
    "description": "TypeError(\"get_embedding() got an unexpected keyword argument 'texts'\")"
  },
  "queryset": [
    {
      "name": "SliceQL",
      "parameters": {
        "traversal_paths": [
          "c",
          "r"
        ],
        "priority": 1.0,
        "end": 1.0,
        "start": 0.0
      },
      "priority": 1
    },
    {
      "name": "VectorSearchDriver",
      "parameters": {
        "top_k": 1.0,
        "executor": null,
        "fill_embedding": false,
        "traversal_paths": [
          "r",
          "c"
        ],
        "method": "query",
        "priority": 1.0
      },
      "priority": 1
    }
  ],
  "routes": [
    {
      "pod": "gateway",
      "podId": "aa8fdd10-593c-11eb-b30f-00155dabdd5c",
      "startTime": "2021-01-18T03:27:22.577297Z",
      "endTime": "2021-01-18T03:27:22.612913Z"
    },
    {
      "pod": "chunk_seg/ZEDRuntime",
      "podId": "aa8afd72-593c-11eb-b30f-00155dabdd5c",
      "startTime": "2021-01-18T03:27:22.578396Z",
      "endTime": "2021-01-18T03:27:22.580207Z"
    },
    {
      "pod": "tf_encode/ZEDRuntime",
      "podId": "aa8eb9b2-593c-11eb-b30f-00155dabdd5c",
      "startTime": "2021-01-18T03:27:22.580779Z",
      "endTime": "2021-01-18T03:27:22.581760Z",
      "status": {
        "code": "ERROR",
        "description": "TypeError(\"get_embedding() got an unexpected keyword argument 'texts'\")",
        "exception": {
          "name": "TypeError",
          "args": [
            "get_embedding() got an unexpected keyword argument 'texts'"
          ],
          "stacks": [
            "Traceback (most recent call last):\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/runtimes/zmq/zed.py\", line 167, in _msg_callback\n    self._zmqlet.send_message(self._callback(msg))\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/runtimes/zmq/zed.py\", line 156, in _callback\n    self._pre_hook(msg)._handle(msg)._post_hook(msg)\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/runtimes/zmq/zed.py\", line 149, in _handle\n    self._executor(self.request_type)\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/executors/__init__.py\", line 415, in __call__\n    d()\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/drivers/encode.py\", line 76, in __call__\n    self._traverse_apply(self.docs, *args, **kwargs)\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/drivers/__init__.py\", line 279, in _traverse_apply\n    **kwargs,\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/drivers/__init__.py\", line 292, in _traverse_rec\n    doc.chunks, doc, 'chunks', path[1:], *args, **kwargs\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/drivers/__init__.py\", line 295, in _traverse_rec\n    self._apply_all(docs, parent_doc, parent_edge_type, *args, **kwargs)\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/drivers/encode.py\", line 111, in _apply_all\n    self._apply_batch(docs)\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/drivers/encode.py\", line 87, in _apply_batch\n    embeds = self.exec_fn(contents)\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/executors/decorators.py\", line 245, in arg_wrapper\n    return func(*args, **kwargs)\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/executors/decorators.py\", line 87, in arg_wrapper\n    r = func(self, *args, **kwargs)\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/hub/encoders/nlp/TextPaddlehubEncoder/__init__.py\", line 47, in encode\n    texts=np.atleast_2d(data).reshape(-1, 1).tolist(), use_gpu=self.on_gpu, batch_size=data.shape[0])\n",
            "TypeError: get_embedding() got an unexpected keyword argument 'texts'\n"
          ],
          "executor": "TextPaddlehubEncoder"
        }
      }
    },
    {
      "pod": "chunk_idx/head/ZEDRuntime",
      "podId": "aa8ef1f2-593c-11eb-b30f-00155dabdd5c",
      "startTime": "2021-01-18T03:27:22.600282Z",
      "endTime": "2021-01-18T03:27:22.601462Z"
    },
    {
      "pod": "chunk_idx/2/ZEDRuntime",
      "podId": "aa8f364e-593c-11eb-b30f-00155dabdd5c",
      "startTime": "2021-01-18T03:27:22.602319Z",
      "endTime": "2021-01-18T03:27:22.603526Z"
    },
    {
      "pod": "chunk_idx/3/ZEDRuntime",
      "podId": "aa8f3cb6-593c-11eb-b30f-00155dabdd5c",
      "startTime": "2021-01-18T03:27:22.602329Z",
      "endTime": "2021-01-18T03:27:22.603386Z"
    },
    {
      "pod": "chunk_idx/4/ZEDRuntime",
      "podId": "aa8f44c2-593c-11eb-b30f-00155dabdd5c",
      "startTime": "2021-01-18T03:27:22.602333Z",
      "endTime": "2021-01-18T03:27:22.603507Z"
    },
    {
      "pod": "chunk_idx/1/ZEDRuntime",
      "podId": "aa8f2fa0-593c-11eb-b30f-00155dabdd5c",
      "startTime": "2021-01-18T03:27:22.602609Z",
      "endTime": "2021-01-18T03:27:22.603771Z"
    },
    {
      "pod": "chunk_idx/tail/ZEDRuntime",
      "podId": "aa8ef1f2-593c-11eb-b30f-00155dabdd5c",
      "startTime": "2021-01-18T03:27:22.606307Z",
      "endTime": "2021-01-18T03:27:22.608154Z"
    },
    {
      "pod": "ranker/ZEDRuntime",
      "podId": "aa8f5a48-593c-11eb-b30f-00155dabdd5c",
      "startTime": "2021-01-18T03:27:22.608967Z",
      "endTime": "2021-01-18T03:27:22.610219Z"
    },
    {
      "pod": "doc_idx/ZEDRuntime",
      "podId": "aa8f8b6c-593c-11eb-b30f-00155dabdd5c",
      "startTime": "2021-01-18T03:27:22.610930Z",
      "endTime": "2021-01-18T03:27:22.612107Z"
    },
    {
      "pod": "gateway",
      "podId": "aa8fdd10-593c-11eb-b30f-00155dabdd5c",
      "startTime": "2021-01-18T03:27:22.612896Z"
    }
  ]
}

Any idea about "TypeError("get_embedding() got an unexpected keyword argument 'texts'") " ?

Thanks!

JoanFM commented 3 years ago

Hey @yiouyou ,

may u please add show-exc-info to the Flow.yml for this Pod? therr u will see where it is failing

yiouyou commented 3 years ago

index.yml

!Flow
with:
  show-exc-info: true
pods:
  crafter:
    uses: pods/craft.yml
    read_only: true
  encoder:
    uses: pods/encode.yml
    parallel: $JINA_PARALLEL
    timeout_ready: -1
    read_only: true
  chunk_idx:
    uses: pods/chunk.yml
    shards: $JINA_SHARDS
    separated_workspace: true
  doc_idx:
    uses: pods/doc.yml
    needs: gateway
  join_all:
    uses: _merge
    needs: [doc_idx, chunk_idx]

query.yml

!Flow
with:
  read_only: true  # better add this in the query time
  rest_api: true
  port_expose: $JINA_PORT
  show-exc-info: true
pods:
  chunk_seg:
    uses: pods/craft.yml
    parallel: $JINA_PARALLEL
  tf_encode:
    uses: pods/encode.yml
    parallel: $JINA_PARALLEL
    timeout_ready: -1
  chunk_idx:
    uses: pods/chunk.yml
    shards: $JINA_SHARDS
    separated_workspace: true
    polling: all
    uses_after: pods/chunk_merger.yml
    timeout_ready: -1 # larger timeout as in query time will read all the data
  ranker:
    uses: pods/ranker.yml
  doc_idx:
    uses: pods/doc.yml

Still show errors: image

{
  "requestId": "4f380096-596e-11eb-9ca0-00155dabdd5c",
  "search": {
    "docs": [
      {
        "id": "af66472b6f285f69",
        "chunks": [
          {
            "id": "e5afba2108690219",
            "weight": 1.0,
            "length": 1,
            "mimeType": "text/plain",
            "text": "text:",
            "granularity": 1,
            "parentId": "af66472b6f285f69",
            "location": [
              0,
              16
            ],
            "contentHash": "7cdd07a5c7f05de3"
          }
        ],
        "weight": 1.0,
        "mimeType": "text/plain",
        "text": "text:\u8fd9\u662f\u770b\u7535\u5f71\u6700\u7cdf\u7cd5\u7684\u90e8\u5206",
        "contentHash": "f61b460fa40edf5c"
      }
    ]
  },
  "status": {
    "code": "ERROR",
    "description": "TypeError(\"get_embedding() got an unexpected keyword argument 'texts'\")"
  },
  "queryset": [
    {
      "name": "SliceQL",
      "parameters": {
        "priority": 1.0,
        "end": 1.0,
        "traversal_paths": [
          "c",
          "r"
        ],
        "start": 0.0
      },
      "priority": 1
    },
    {
      "name": "VectorSearchDriver",
      "parameters": {
        "priority": 1.0,
        "executor": null,
        "traversal_paths": [
          "r",
          "c"
        ],
        "fill_embedding": false,
        "method": "query",
        "top_k": 1.0
      },
      "priority": 1
    }
  ],
  "routes": [
    {
      "pod": "gateway",
      "podId": "36e59ecc-596e-11eb-9ca0-00155dabdd5c",
      "startTime": "2021-01-18T09:19:47.528892Z",
      "endTime": "2021-01-18T09:19:47.580028Z"
    },
    {
      "pod": "chunk_seg/ZEDRuntime",
      "podId": "36e0f386-596e-11eb-9ca0-00155dabdd5c",
      "startTime": "2021-01-18T09:19:47.529998Z",
      "endTime": "2021-01-18T09:19:47.531633Z"
    },
    {
      "pod": "tf_encode/ZEDRuntime",
      "podId": "36e478da-596e-11eb-9ca0-00155dabdd5c",
      "startTime": "2021-01-18T09:19:47.532390Z",
      "endTime": "2021-01-18T09:19:47.533462Z",
      "status": {
        "code": "ERROR",
        "description": "TypeError(\"get_embedding() got an unexpected keyword argument 'texts'\")",
        "exception": {
          "name": "TypeError",
          "args": [
            "get_embedding() got an unexpected keyword argument 'texts'"
          ],
          "stacks": [
            "Traceback (most recent call last):\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/runtimes/zmq/zed.py\", line 167, in _msg_callback\n    self._zmqlet.send_message(self._callback(msg))\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/runtimes/zmq/zed.py\", line 156, in _callback\n    self._pre_hook(msg)._handle(msg)._post_hook(msg)\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/runtimes/zmq/zed.py\", line 149, in _handle\n    self._executor(self.request_type)\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/executors/__init__.py\", line 415, in __call__\n    d()\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/drivers/encode.py\", line 76, in __call__\n    self._traverse_apply(self.docs, *args, **kwargs)\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/drivers/__init__.py\", line 279, in _traverse_apply\n    **kwargs,\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/drivers/__init__.py\", line 292, in _traverse_rec\n    doc.chunks, doc, 'chunks', path[1:], *args, **kwargs\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/drivers/__init__.py\", line 295, in _traverse_rec\n    self._apply_all(docs, parent_doc, parent_edge_type, *args, **kwargs)\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/drivers/encode.py\", line 111, in _apply_all\n    self._apply_batch(docs)\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/drivers/encode.py\", line 87, in _apply_batch\n    embeds = self.exec_fn(contents)\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/executors/decorators.py\", line 245, in arg_wrapper\n    return func(*args, **kwargs)\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/executors/decorators.py\", line 87, in arg_wrapper\n    r = func(self, *args, **kwargs)\n",
            "  File \"/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/hub/encoders/nlp/TextPaddlehubEncoder/__init__.py\", line 47, in encode\n    texts=np.atleast_2d(data).reshape(-1, 1).tolist(), use_gpu=self.on_gpu, batch_size=data.shape[0])\n",
            "TypeError: get_embedding() got an unexpected keyword argument 'texts'\n"
          ],
          "executor": "TextPaddlehubEncoder"
        }
      }
    },
    {
      "pod": "chunk_idx/head/ZEDRuntime",
      "podId": "36e4b02a-596e-11eb-9ca0-00155dabdd5c",
      "startTime": "2021-01-18T09:19:47.567684Z",
      "endTime": "2021-01-18T09:19:47.568626Z"
    },
    {
      "pod": "chunk_idx/2/ZEDRuntime",
      "podId": "36e4f86e-596e-11eb-9ca0-00155dabdd5c",
      "startTime": "2021-01-18T09:19:47.569490Z",
      "endTime": "2021-01-18T09:19:47.570797Z"
    },
    {
      "pod": "chunk_idx/1/ZEDRuntime",
      "podId": "36e4f184-596e-11eb-9ca0-00155dabdd5c",
      "startTime": "2021-01-18T09:19:47.569503Z",
      "endTime": "2021-01-18T09:19:47.570747Z"
    },
    {
      "pod": "chunk_idx/3/ZEDRuntime",
      "podId": "36e4fef4-596e-11eb-9ca0-00155dabdd5c",
      "startTime": "2021-01-18T09:19:47.569532Z",
      "endTime": "2021-01-18T09:19:47.570795Z"
    },
    {
      "pod": "chunk_idx/4/ZEDRuntime",
      "podId": "36e50674-596e-11eb-9ca0-00155dabdd5c",
      "startTime": "2021-01-18T09:19:47.569534Z",
      "endTime": "2021-01-18T09:19:47.570857Z"
    },
    {
      "pod": "chunk_idx/tail/ZEDRuntime",
      "podId": "36e4b02a-596e-11eb-9ca0-00155dabdd5c",
      "startTime": "2021-01-18T09:19:47.573071Z",
      "endTime": "2021-01-18T09:19:47.575169Z"
    },
    {
      "pod": "ranker/ZEDRuntime",
      "podId": "36e51902-596e-11eb-9ca0-00155dabdd5c",
      "startTime": "2021-01-18T09:19:47.576163Z",
      "endTime": "2021-01-18T09:19:47.577337Z"
    },
    {
      "pod": "doc_idx/ZEDRuntime",
      "podId": "36e54c10-596e-11eb-9ca0-00155dabdd5c",
      "startTime": "2021-01-18T09:19:47.578239Z",
      "endTime": "2021-01-18T09:19:47.579396Z"
    },
    {
      "pod": "gateway",
      "podId": "36e59ecc-596e-11eb-9ca0-00155dabdd5c",
      "startTime": "2021-01-18T09:19:47.580012Z"
    }
  ]
}
JoanFM commented 3 years ago

Hey can you try the same on an environment with these libraries installed?

paddlepaddle==1.8.5 paddlehub==1.8.3 Pillow==8.1.0 six==1.15.0

yiouyou commented 3 years ago

Tried, no luck yet.

(py37-sz-lyrics) sz@pc:/mnt/d/jina-ai/zh-multires-lyrics-search$ python app.py index
        crafter@6747[I]:starting jina.peapods.runtimes.zmq.zed.ZEDRuntime...
        crafter@6747[I]:input tcp://0.0.0.0:44379 (SUB_CONNECT) output tcp://0.0.0.0:52425 (PUSH_CONNECT) control over tcp://0.0.0.0:56093 (PAIR_BIND)
    Sentencizer@6747[I]:post_init may take some time...
    Sentencizer@6747[I]:post_init may take some time takes 0 seconds (0.00s)
    Sentencizer@6747[S]:successfully built Sentencizer from a yaml config
        crafter@6728[S]:ready and listening
   encoder/head@6754[I]:starting jina.peapods.runtimes.zmq.zed.ZEDRuntime...
   encoder/head@6754[I]:input tcp://0.0.0.0:52425 (PULL_BIND) output tcp://0.0.0.0:56259 (ROUTER_BIND) control over tcp://0.0.0.0:52101 (PAIR_BIND)
   BaseExecutor@6754[I]:post_init may take some time...
   BaseExecutor@6754[I]:post_init may take some time takes 0 seconds (0.00s)
   BaseExecutor@6754[S]:successfully built BaseExecutor from a yaml config
   encoder/head@6728[S]:ready and listening
   encoder/tail@6761[I]:starting jina.peapods.runtimes.zmq.zed.ZEDRuntime...
   encoder/tail@6761[I]:input tcp://0.0.0.0:54677 (PULL_BIND) output tcp://0.0.0.0:35027 (PUSH_CONNECT) control over tcp://0.0.0.0:47707 (PAIR_BIND)
   BaseExecutor@6761[I]:post_init may take some time...
   BaseExecutor@6761[I]:post_init may take some time takes 0 seconds (0.00s)
   BaseExecutor@6761[S]:successfully built BaseExecutor from a yaml config
   encoder/tail@6728[S]:ready and listening
      encoder/1@6768[I]:starting jina.peapods.runtimes.zmq.zed.ZEDRuntime...
      encoder/1@6768[I]:input tcp://0.0.0.0:56259 (DEALER_CONNECT) output tcp://0.0.0.0:54677 (PUSH_CONNECT) control over tcp://0.0.0.0:53061 (PAIR_BIND)
TextPaddlehubEncoder@6768[I]:post_init may take some time...
[2021-01-20 18:05:39,812] [    INFO] - Installing rbt3 module
TextPaddlehubEncoder@6768[I]:post_init may take some time takes 28 seconds (28.18s)
      encoder/1@6768[C]:can not load the executor from pods/encode.yml
      encoder/1@6768[E]:
Traceback (most recent call last):
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/runtimes/zmq/zed.py", line 70, in _load_executor
    read_only=self.args.read_only)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/jaml/__init__.py", line 393, in load_config
    return JAML.load(revert_tag_yml, substitute=False)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/jaml/__init__.py", line 85, in load
    r = yaml.load(stream, Loader=JinaLoader)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/yaml/__init__.py", line 114, in load
    return loader.get_single_data()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/yaml/constructor.py", line 51, in get_single_data
    return self.construct_document(node)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/yaml/constructor.py", line 55, in construct_document
    data = self.construct_object(node)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/yaml/constructor.py", line 100, in construct_object
    data = constructor(self, node)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/jaml/__init__.py", line 307, in _from_yaml
    return get_parser(cls, version=data.get('version', None)).parse(cls, data)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/jaml/parsers/executor/legacy.py", line 62, in parse
    obj = cls(**data.get('with', {}), metas=data.get('metas', {}), requests=data.get('requests', {}))
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/executors/__init__.py", line 55, in __call__
    getattr(obj, '_post_init_wrapper', lambda *x: None)(m, r)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/executors/__init__.py", line 144, in _post_init_wrapper
    self.post_init()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/hub/encoders/nlp/TextPaddlehubEncoder/__init__.py", line 35, in post_init
    self.model = hub.Module(name=self.model_name)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/paddlehub/module/module.py", line 102, in __new__
    name=name, version=version, **kwargs)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/paddlehub/module/module.py", line 171, in init_with_name
    module_name=name, module_version=version, extra=extra)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/paddlehub/module/manager.py", line 127, in install_module
    self.all_modules(update=True)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/paddlehub/module/manager.py", line 105, in all_modules
    valid, info = self.check_module_valid(sub_dir_path)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/paddlehub/module/manager.py", line 72, in check_module_valid
    "{}.module".format(basename))
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/sz/.paddlehub/modules/chinese_electra_small/module.py", line 18, in <module>
    import paddle.nn as nn
ModuleNotFoundError: No module named 'paddle.nn'

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

Traceback (most recent call last):
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/peas/__init__.py", line 66, in run
    self.runtime.setup()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/runtimes/zmq/zed.py", line 40, in setup
    self._load_executor()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/runtimes/zmq/zed.py", line 81, in _load_executor
    raise ExecutorFailToLoad from ex
jina.excepts.ExecutorFailToLoad
      encoder/1@6728[C]:fail to start <BasePea(encoder/1, started)> because <jina.peapods.runtimes.zmq.zed.ZEDRuntime object at 0x7f4dabef4650> throws some exception, add "--show-exc-info" to see the exception stack in details
Traceback (most recent call last):
  File "app.py", line 83, in <module>
    main()
  File "app.py", line 73, in main
    index()
  File "app.py", line 39, in index
    with f:
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/flow/base.py", line 399, in __enter__
    return self.start()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/flow/base.py", line 432, in start
    self.enter_context(v)
  File "/usr/lib/python3.7/contextlib.py", line 427, in enter_context
    result = _cm_type.__enter__(cm)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/pods/__init__.py", line 209, in __enter__
    return self.start()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/pods/__init__.py", line 200, in start
    self._enter_pea(BasePea(_args))
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/pods/__init__.py", line 206, in _enter_pea
    self.enter_context(pea)
  File "/usr/lib/python3.7/contextlib.py", line 427, in enter_context
    result = _cm_type.__enter__(cm)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/peas/__init__.py", line 174, in __enter__
    return self.start()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/peas/__init__.py", line 116, in start
    raise RuntimeFailToStart
jina.excepts.RuntimeFailToStart
JoanFM commented 3 years ago

Module paddle.nn is missing

yiouyou commented 3 years ago

image

JoanFM commented 3 years ago

It seems paddle was not installed

yiouyou commented 3 years ago

Still

(py37-sz-lyrics) sz@pc:/mnt/d/jina-ai/zh-multires-lyrics-search$ python app.py index
        crafter@6981[I]:starting jina.peapods.runtimes.zmq.zed.ZEDRuntime...
        crafter@6981[I]:input tcp://0.0.0.0:58447 (SUB_CONNECT) output tcp://0.0.0.0:56915 (PUSH_CONNECT) control over tcp://0.0.0.0:57835 (PAIR_BIND)
    Sentencizer@6981[I]:post_init may take some time...
    Sentencizer@6981[I]:post_init may take some time takes 0 seconds (0.00s)
    Sentencizer@6981[S]:successfully built Sentencizer from a yaml config
        crafter@6962[S]:ready and listening
   encoder/head@6989[I]:starting jina.peapods.runtimes.zmq.zed.ZEDRuntime...
   encoder/head@6989[I]:input tcp://0.0.0.0:56915 (PULL_BIND) output tcp://0.0.0.0:54717 (ROUTER_BIND) control over tcp://0.0.0.0:37123 (PAIR_BIND)
   BaseExecutor@6989[I]:post_init may take some time...
   BaseExecutor@6989[I]:post_init may take some time takes 0 seconds (0.00s)
   BaseExecutor@6989[S]:successfully built BaseExecutor from a yaml config
   encoder/head@6962[S]:ready and listening
   encoder/tail@6996[I]:starting jina.peapods.runtimes.zmq.zed.ZEDRuntime...
   encoder/tail@6996[I]:input tcp://0.0.0.0:44441 (PULL_BIND) output tcp://0.0.0.0:39707 (PUSH_CONNECT) control over tcp://0.0.0.0:56319 (PAIR_BIND)
   BaseExecutor@6996[I]:post_init may take some time...
   BaseExecutor@6996[I]:post_init may take some time takes 0 seconds (0.00s)
   BaseExecutor@6996[S]:successfully built BaseExecutor from a yaml config
   encoder/tail@6962[S]:ready and listening
      encoder/1@7003[I]:starting jina.peapods.runtimes.zmq.zed.ZEDRuntime...
      encoder/1@7003[I]:input tcp://0.0.0.0:54717 (DEALER_CONNECT) output tcp://0.0.0.0:44441 (PUSH_CONNECT) control over tcp://0.0.0.0:49841 (PAIR_BIND)
TextPaddlehubEncoder@7003[I]:post_init may take some time...
TextPaddlehubEncoder@7003[I]:post_init may take some time takes 8 seconds (8.44s)
      encoder/1@7003[C]:can not load the executor from pods/encode.yml
      encoder/1@7003[E]:
Traceback (most recent call last):
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/runtimes/zmq/zed.py", line 70, in _load_executor
    read_only=self.args.read_only)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/jaml/__init__.py", line 393, in load_config
    return JAML.load(revert_tag_yml, substitute=False)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/jaml/__init__.py", line 85, in load
    r = yaml.load(stream, Loader=JinaLoader)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/yaml/__init__.py", line 114, in load
    return loader.get_single_data()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/yaml/constructor.py", line 51, in get_single_data
    return self.construct_document(node)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/yaml/constructor.py", line 55, in construct_document
    data = self.construct_object(node)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/yaml/constructor.py", line 100, in construct_object
    data = constructor(self, node)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/jaml/__init__.py", line 307, in _from_yaml
    return get_parser(cls, version=data.get('version', None)).parse(cls, data)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/jaml/parsers/executor/legacy.py", line 62, in parse
    obj = cls(**data.get('with', {}), metas=data.get('metas', {}), requests=data.get('requests', {}))
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/executors/__init__.py", line 55, in __call__
    getattr(obj, '_post_init_wrapper', lambda *x: None)(m, r)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/executors/__init__.py", line 144, in _post_init_wrapper
    self.post_init()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/hub/encoders/nlp/TextPaddlehubEncoder/__init__.py", line 34, in post_init
    import paddlehub as hub
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/paddlehub/__init__.py", line 27, in <module>
    from . import module
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/paddlehub/module/__init__.py", line 16, in <module>
    from . import module
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/paddlehub/module/module.py", line 29, in <module>
    import paddle.fluid as fluid
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/paddle/fluid/__init__.py", line 51, in <module>
    from . import io
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/paddle/fluid/io.py", line 46, in <module>
    batch = paddle.batch
AttributeError: module 'paddle' has no attribute 'batch'

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

Traceback (most recent call last):
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/peas/__init__.py", line 66, in run
    self.runtime.setup()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/runtimes/zmq/zed.py", line 40, in setup
    self._load_executor()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/runtimes/zmq/zed.py", line 81, in _load_executor
    raise ExecutorFailToLoad from ex
jina.excepts.ExecutorFailToLoad
      encoder/1@6962[C]:fail to start <BasePea(encoder/1, started)> because <jina.peapods.runtimes.zmq.zed.ZEDRuntime object at 0x7f9ea38c3e10> throws some exception, add "--show-exc-info" to see the exception stack in details
Traceback (most recent call last):
  File "app.py", line 83, in <module>
    main()
  File "app.py", line 73, in main
    index()
  File "app.py", line 39, in index
    with f:
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/flow/base.py", line 399, in __enter__
    return self.start()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/flow/base.py", line 432, in start
    self.enter_context(v)
  File "/usr/lib/python3.7/contextlib.py", line 427, in enter_context
    result = _cm_type.__enter__(cm)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/pods/__init__.py", line 209, in __enter__
    return self.start()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/pods/__init__.py", line 200, in start
    self._enter_pea(BasePea(_args))
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/pods/__init__.py", line 206, in _enter_pea
    self.enter_context(pea)
  File "/usr/lib/python3.7/contextlib.py", line 427, in enter_context
    result = _cm_type.__enter__(cm)
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/peas/__init__.py", line 174, in __enter__
    return self.start()
  File "/mnt/d/py37-sz-lyrics/lib/python3.7/site-packages/jina/peapods/peas/__init__.py", line 116, in start
    raise RuntimeFailToStart
jina.excepts.RuntimeFailToStart
nan-wang commented 3 years ago

hi, @yiouyou The issue seems to be due to the fact that the chinese-electra-small is released under paddlepaddle==2.0rc1 but the TextPaddlehubEncoder is developed under paddlepaddle==1.8.5.

reference: https://github.com/PaddlePaddle/Paddle/issues/29749

I've tried ernie_tiny and the following code snipet works. We need to adapt the TextPaddlehubEncoder to paddlepaddle==2.0rc1 to make it work.

from jina import Document, Flow

f = Flow(show_exc_info=True).add(uses='paddle_encoder.yml')

doc = Document()
chunk = Document(text='你好')
doc.chunks.add(chunk)

with f:
    f.index([doc], on_done=print)

with paddle_encoder.yml as below

!TextPaddlehubEncoder
with:
  model_name: ernie_tiny
requests:
  on:
    ControlRequest:
      - !ControlReqDriver {}
    [SearchRequest, TrainRequest, IndexRequest]:
      - !EncodeDriver
        with:
          traversal_paths: ['c']

tested with

paddlehub                     1.8.3
paddlepaddle                  1.8.5

outputs are listed as below

/Users/nanwang/.pyenv/versions/3.7.5/bin/python3 /Users/nanwang/Codes/jina-ai/jina/toys/toy5.py
           pod0@10330[I]:starting jina.peapods.runtimes.zmq.zed.ZEDRuntime...
           pod0@10330[I]:input tcp://0.0.0.0:59246 (PULL_BIND) output tcp://0.0.0.0:59247 (PUSH_BIND) control over tcp://0.0.0.0:59245 (PAIR_BIND)
TextPaddlehubEncoder@10330[I]:post_init may take some time...
/Users/nanwang/.pyenv/versions/3.7.5/lib/python3.7/site-packages/pandas/compat/__init__.py:85: UserWarning: Could not import the lzma module. Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError.
  warnings.warn(msg)
[2021-01-21 23:03:53,999] [    INFO] - Installing ernie_tiny module
[2021-01-21 23:03:54,005] [    INFO] - Module ernie_tiny already installed in /Users/nanwang/.paddlehub/modules/ernie_tiny
TextPaddlehubEncoder@10330[I]:post_init may take some time takes 5 seconds (5.55s)
TextPaddlehubEncoder@10330[S]:successfully built TextPaddlehubEncoder from a yaml config
           pod0@10325[S]:ready and listening
        gateway@10337[I]:starting jina.peapods.runtimes.asyncio.grpc.GRPCRuntime...
        gateway@10337[S]:GRPCRuntime is listening at: 0.0.0.0:59252
        gateway@10325[S]:ready and listening
           Flow@10325[I]:2 Pods (i.e. 2 Peas) are running in this Flow
           Flow@10325[S]:🎉 Flow is ready to use, accepting gRPC request
           Flow@10325[I]:
    🖥️ Local access:    tcp://0.0.0.0:59252
    🔒 Private network:  tcp://192.168.31.175:59252
    🌐 Public address:   tcp://112.118.42.123:59252
         Client@10325[S]:connected to the gateway at 0.0.0.0:59252!
index |█                   | 📃      0 ⏱️ 0.0s 🐎 0.0/s      0      batchindex ...            gateway@10337[I]:input tcp://0.0.0.0:59247 (PULL_CONNECT) output tcp://0.0.0.0:59246 (PUSH_CONNECT) control over ipc:///var/folders/gw/d7zfntgd7z56bytfb2w662ww0000gn/T/tmphnbgmckf (PAIR_BIND)
        gateway@10337[I]:prefetching 50 requests...
        gateway@10337[W]:if this takes too long, you may want to take smaller "--prefetch" or ask client to reduce "--request-size"
        gateway@10337[I]:prefetching 50 requests takes 0 seconds (0.00s)
        gateway@10337[I]:send: 1 recv: 0 pending: 1
           pod0@10330[I]:recv IndexRequest  from gateway▸pod0/ZEDRuntime▸⚐
[2021-01-21 23:04:02,795] [    INFO] - Dataset is None or it has not any labels, label map = {}
[2021-01-21 23:04:06,247] [    INFO] - Checkpoint dir: ckpt_20210121230406
!!! The CPU_NUM is not specified, you should set CPU_NUM in the environment variable list.
CPU_NUM indicates that how many CPUPlace are used in the current task.
And if this parameter are set as N (equal to the number of physical CPU core) the program may be faster.

export CPU_NUM=4 # for example, set CPU_NUM as number of physical CPU core which is 4.

!!! The default number of CPU_NUM=1.
[2021-01-21 23:04:06,346] [ WARNING] - PaddleHub v1.8 has deprecated the reader and feed_list parameters in the nlp Task. We provided an easier usage, in which you can use your tokenizer to preprocess dataset and run task in a clear flow. New demo see https://github.com/PaddlePaddle/PaddleHub/blob/release/v1.8/demo/text_classification/text_cls.py
[2021-01-21 23:04:06,347] [    INFO] - PaddleHub predict start
[2021-01-21 23:04:06,347] [    INFO] - Load the best model from ckpt_20210121230406/best_model
/Users/nanwang/.pyenv/versions/3.7.5/lib/python3.7/site-packages/paddle/fluid/executor.py:1093: UserWarning: There are no operators in the program to be executed. If you pass Program manually, please use fluid.program_guard to ensure the current Program is being used.
  warnings.warn(error_info)
[2021-01-21 23:04:06,599] [    INFO] - Try loading checkpoint from ckpt_20210121230406/ckpt.meta
[2021-01-21 23:04:06,599] [    INFO] - PaddleHub model checkpoint not found, start from scratch...
           pod0@10330[I]:#sent: 0 #recv: 1 sent_size: 0 Bytes recv_size: 393 Bytes
<jina.types.request.Response object at 0x11aa01bd0>
        gateway@10337[I]:#sent: 1 #recv: 1 sent_size: 462 Bytes recv_size: 4.5 KB
index |█                   | 📃    100 ⏱️ 8.8s 🐎 11.4/s      1      batch    8 seconds (8.78s)
    ✅ done in ⏱ 8 seconds 🐎 11.4/s
[2021-01-21 23:04:09,884] [    INFO] - PaddleHub predict finished.
        gateway@10325[S]:terminated
           pod0@10330[I]:recv ControlRequest  from ctl▸pod0/ZEDRuntime▸⚐
           pod0@10330[I]:#sent: 2 #recv: 2 sent_size: 4.8 KB recv_size: 531 Bytes
           pod0@10330[I]:no update since 2021-01-21 23:03:50, will not save. If you really want to save it, call "touch()" before "save()" to force saving
           pod0@10325[S]:terminated
           Flow@10325[S]:flow is closed and all resources are released, current build level is 0

Process finished with exit code 0
nan-wang commented 3 years ago

The situation is a bit tricky because not all the models in the paddlehub support paddlepaddle==2.0rc1.

yiouyou commented 3 years ago

@nan-wang In this case, what's the best useable chinese model with paddlehub? Is paddlehub the only chinese language model engine supported by Jina? Thanks!

nan-wang commented 3 years ago

@nan-wang In this case, what's the best useable chinese model with paddlehub? Is paddlehub the only chinese language model engine supported by Jina? Thanks!

the best highly depends on your specific use case. Does Ernie already meet your requirement? As the pretrained models for Chinese, you can try the models from huggingface as well. Jina supports huggingfacetransformers. Here is a full list of the models for Chinese. https://huggingface.co/models?filter=zh

jina-bot commented 3 years ago

This issue is stale because it has been open 20 days with no activity. Remove stale label or comment or this will be closed in 4 days