[Model] Upgrade uie (#458)

* Upgrade uie c++ implement

* upgrade python UIEModel inherit FastDeployModel

* Add schema language support; Skip infer when no prompts

* Adjust the schema language arg pos

* Add schema_language for python and cpp

* update pybind for uie

* Fix the args of uie

* Add SchemaLanguage
This commit is contained in:
Jack Zhou
2022-10-30 17:04:05 +08:00
committed by GitHub
parent d70b6c99df
commit ee2c6136fc
8 changed files with 128 additions and 66 deletions

View File

@@ -411,20 +411,24 @@ UIEModel(
const std::vector<std::string>& schema,
const fastdeploy::RuntimeOption& custom_option =
fastdeploy::RuntimeOption(),
const fastdeploy::ModelFormat& model_format = fastdeploy::ModelFormat::PADDLE);
const fastdeploy::ModelFormat& model_format = fastdeploy::ModelFormat::PADDLE,
SchemaLanguage schema_language = SchemaLanguage::ZH);
UIEModel(
const std::string& model_file, const std::string& params_file,
const std::string& vocab_file, float position_prob, size_t max_length,
const SchemaNode& schema, const fastdeploy::RuntimeOption& custom_option =
fastdeploy::RuntimeOption(),
const fastdeploy::ModelFormat& model_format = fastdeploy::ModelFormat::PADDLE);
const fastdeploy::ModelFormat& model_format = fastdeploy::ModelFormat::PADDLE,
SchemaLanguage schema_language = SchemaLanguage::ZH);
UIEModel(
const std::string& model_file, const std::string& params_file,
const std::string& vocab_file, float position_prob, size_t max_length,
const std::vector<SchemaNode>& schema,
const fastdeploy::RuntimeOption& custom_option =
fastdeploy::RuntimeOption(),
const fastdeploy::ModelFormat& model_format = fastdeploy::ModelFormat::PADDLE);
const fastdeploy::ModelFormat& model_format =
fastdeploy::ModelFormat::PADDLE,
SchemaLanguage schema_language = SchemaLanguage::ZH);
```
UIE模型加载和初始化其中model_file, params_file为训练模型导出的Paddle inference文件具体请参考其文档说明[模型导出](https://github.com/PaddlePaddle/PaddleNLP/blob/develop/model_zoo/uie/README.md#%E6%A8%A1%E5%9E%8B%E9%83%A8%E7%BD%B2)。
@@ -439,6 +443,7 @@ UIE模型加载和初始化其中model_file, params_file为训练模型导出
> * **schema**(list(SchemaNode) | SchemaNode | list(str)): 抽取任务的目标模式。
> * **runtime_option**(RuntimeOption): 后端推理配置默认为None即采用默认配置
> * **model_format**(ModelFormat): 模型格式默认为Paddle格式
> * **schema_language** (SchemaLanguage): Schema 语言默认为ZH中文目前支持的语言种类包括ZH中文EN英文
#### SetSchema函数