【已定位bug建议立马修复】Aistudio Notebook 模型部署存在bug
收藏
快速回复
AI Studio平台使用 问答Notebook项目 257 0
【已定位bug建议立马修复】Aistudio Notebook 模型部署存在bug
收藏
快速回复
AI Studio平台使用 问答Notebook项目 257 0

Aistudio Notebook 中的模型部署存在bug。当模型输出是List[Tensor],即多个tensor组成的列表时,会报错`too many values to unpack (expected 1)`。

 

```

start deploy...
get file url from evn
downloading...
extracting...
unzip is /usr/bin/unzip
unzip available
source hook dir:webserver/home/hook/inputhook.py
hook ok
source model dir:webserver/model/outputs/yolov5n.pdmodel
model ok
start server...
[2022-05-04 04:*:*,549.549] server_conf.py [line:*] INFO current config section cpu
[2022-05-04 04:*:*,166.166] executor_manager.py [line:*] INFO device type:cpu executor count:* model dir:{'model': '/home/work/serving/resources/model/'} get executor timeout:*.5s
[2022-05-04 04:*:*,167.167] app_server.py [line:*] INFO start app listen port:* thread pool size:* site root:serving
[2022-05-04 04:*:*,746.746] business_service.py [line:*] ERROR infer exception: too many values to unpack (expected 1)
[2022-05-04 04:*:*,748.748] app_server.py [line:*] INFO request cost:*.29 sec

```

 

主要是

```

[2022-05-04 04:*:*,746.746] business_service.py [line:*] ERROR infer exception: too many values to unpack (expected 1)

```

 

已经定位到 bug问题所在

 

原因如下:
在/home/work/serving/src/business_service.py 中 有一行代码 infer_results, = infer_with_executor_by_dict(model_name, feed) 。此行代码存在bug,该行代码调用了 定义在/home/work/serving/src/infer_service.py 中的infer_with_executor_by_dict函数,该函数的核心是outputs = executor.run(inference_program, feed=feed, fetch_list=fetch_targets, return_numpy=False) 。当 模型的输出 是一个list的时候,`infer_results, ` 这样的解包赋值 会导致`too many values to unpack (expected 1)`报错,建议立马修复。只需要把``infer_results, ` 中的逗号去掉。

例子:在python 中, `a, = [1]`可以赋值,`a, = [1, 2, 3]` 会报错。

建议立马修复。

0
收藏
回复
在@后输入用户全名并按空格结束,可艾特全站任一用户