Add deploy for UIE#2307
Conversation
ZeyuChen
left a comment
There was a problem hiding this comment.
体现下切换schema不需要更换predictor的代码吧 不然会以为一个schema一个predictor。另外就taskflow的版本应该可以做到内置高性能predictor
| args.schema = schema | ||
| predictor = UIEPredictor(args) | ||
|
|
||
| outputs = predictor.predict(text) |
There was a problem hiding this comment.
新增Taskflow内置高性能predictor的版本,部署脚本加上了predictor切换schema的代码示例
| self._custom_model = False | ||
| self._param_updated = False | ||
| self._num_threads = self.kwargs[ | ||
| 'num_threads'] if 'num_threads' in self.kwargs else cpu_count() |
There was a problem hiding this comment.
这块是一定要把CPU打满了,打满最终的机器有啥影响吗?
There was a problem hiding this comment.
如沟通,已修改为当前CPU的实际物理核数
| import paddle2onnx | ||
| from onnxconverter_common import float16 | ||
| self._predictor_type = 'onnxruntime' | ||
| except: |
There was a problem hiding this comment.
这里的提示安装有个问题,onnxruntime和onnxruntime-gpu版本如何解决冲突?同时onnxruntime-gpu是不是通过conda安装更好
| self._static_params_file) | ||
| self._prepare_static_mode() | ||
| else: | ||
| self._prepare_onnx_mode() |
There was a problem hiding this comment.
这里是不是这个开关目前只是对UIE打卡了,因为不是所有的模型都能paddle2onnx吧
There was a problem hiding this comment.
目前onnxruntime的predictor只对UIE有效,其他任务目前默认走PaddleInference
| #### 可配置参数说明 | ||
|
|
||
| * `num_threads`:配置CPU的线程数,默认为CPU的最大线程数。 | ||
| * `infer_precision`:选择模型精度,默认为`fp32`,可选有`fp16`和`fp32`。`fp16`推理速度更快,如果选择`fp16`,请先确保机器正确安装NVIDIA相关驱动和基础软件,确保CUDA>=11.2,CuDNN>=8.2,初次使用需按照提示安装相关依赖。 |
There was a problem hiding this comment.
这块有个疑问,如果是用conda安装飞桨cuda 11.2的版本的paddle的时候,这个时候适配的cudnn的版本是啥版本了?
There was a problem hiding this comment.
已修改为conda安装paddle对应的cudnn版本,已验证可以正常使用
| @@ -0,0 +1,84 @@ | |||
| # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. | |||
| import paddle | ||
| import paddle2onnx | ||
| import onnxruntime as ort | ||
| from multiprocessing import cpu_count |
|
|
||
| #### 可配置参数说明 | ||
|
|
||
| * `num_threads`:配置CPU的线程数,默认为CPU的逻辑核数/2。 |
There was a problem hiding this comment.
如沟通,已移除num_threads,默认使用最优配置
| #### 可配置参数说明 | ||
|
|
||
| * `num_threads`:配置CPU的线程数,默认为CPU的逻辑核数/2。 | ||
| * `infer_precision`:选择模型精度,默认为`fp32`,可选有`fp16`和`fp32`。`fp16`推理速度更快,如果选择`fp16`,请先确保机器正确安装NVIDIA相关驱动和基础软件,确保CUDA>=11.2,CuDNN>=8.1.1,初次使用需按照提示安装相关依赖。 |
There was a problem hiding this comment.
FP16更重要的要硬件支持,而不只是CUDA cuDNN。
CuDNN -> cuDNN,要保持和原NV标准写法一致
There was a problem hiding this comment.
内部使用get_device_capability这个api获取gpu架构信息,自动识别是否支持fp16然后自动开启,不需要暴露给用户。
包括num_threads这些taskflow都不要暴露,自动选择最优的配置来做。
There was a problem hiding this comment.
done, thx
已补充硬件支持相关说明
PR types
New features
PR changes
APIs
Description
Add deploy for UIE