!37929 modidy converter acl param offline

Merge pull request !37929 from zhengyuanhua/br1
This commit is contained in:
i-robot 2022-07-13 06:33:23 +00:00 committed by Gitee
commit f1fcbb729f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 31 additions and 33 deletions

View File

@ -59,6 +59,18 @@ mindspore_lite.Converter
- **RuntimeError** - 当 `model_file` 不是""时, `model_file` 文件路径不存在。
- **RuntimeError** - 当 `config_file` 不是""时, `config_file` 文件路径不存在。
.. py:method:: converter()
执行转换将第三方模型转换为MindSpore模型。
**异常:**
- **RuntimeError** - 转换模型失败。
.. py:method:: get_config_info()
获取转换的配置信息。
.. py:method:: set_config_info(section, config_info)
设置转换时的配置信息。
@ -83,15 +95,3 @@ mindspore_lite.Converter
- **TypeError** - `section` 不是str类型。
- **TypeError** - `config_info` 不是dict类型。
.. py:method:: get_config_info()
获取转换的配置信息。
.. py:method:: converter()
执行转换将第三方模型转换为MindSpore模型。
**异常:**
- **RuntimeError** - 转换模型失败。

View File

@ -229,29 +229,28 @@ class Converter:
Set config info for converter.
Args:
section (str): The category of the configuration parameter.
Set the individual parameters of the configFile together with config_info.
e.g. for section = "common_quant_param", config_info = {"quant_type":"WEIGHT_QUANT"}. Default: "".
For the configuration parameters related to post training quantization, please refer to
`quantization <https://www.mindspore.cn/lite/docs/en/master/use/post_training_quantization.html>`_.
For the configuration parameters related to extension, please refer to
`extension <https://www.mindspore.cn/lite/docs/en/master/use/nnie.html#extension-configuration>`_.
Set the individual parameters of the configFile together with config_info.
e.g. for section = "common_quant_param", config_info = {"quant_type":"WEIGHT_QUANT"}. Default: None.
For the configuration parameters related to post training quantization, please refer to
`quantization <https://www.mindspore.cn/lite/docs/en/master/use/post_training_quantization.html>`_.
For the configuration parameters related to extension, please refer to
`extension <https://www.mindspore.cn/lite/docs/en/master/use/nnie.html#extension-configuration>`_.
- "common_quant_param": Common quantization parameter. One of configuration for quantization.
- "mixed_bit_weight_quant_param": Mixed bit weight quantization parameter.
One of configuration for quantization.
- "full_quant_param": Full quantization parameter. One of configuration for quantization.
- "data_preprocess_param": Data preprocess parameter. One of configuration for quantization.
- "registry": Extension configuration parameter. One of configuration for extension.
- "common_quant_param": Common quantization parameter. One of configuration parameters for quantization.
- "mixed_bit_weight_quant_param": Mixed bit weight quantization parameter.
One of configuration parameters for quantization.
- "full_quant_param": Full quantization parameter. One of configuration parameters for quantization.
- "data_preprocess_param": Data preprocess parameter. One of configuration parameters for quantization.
- "registry": Extension configuration parameter. One of configuration parameters for extension.
config_info (dict{str, str}): List of configuration parameters.
Set the individual parameters of the configFile together with section.
e.g. for section = "common_quant_param", config_info = {"quant_type":"WEIGHT_QUANT"}. Default: None.
For the configuration parameters related to post training quantization, please refer to
`quantization <https://www.mindspore.cn/lite/docs/en/master/use/post_training_quantization.html>`_.
For the configuration parameters related to extension, please refer to
`extension <https://www.mindspore.cn/lite/docs/en/master/use/nnie.html#extension-configuration>`_.
Set the individual parameters of the configFile together with section.
e.g. for section = "common_quant_param", config_info = {"quant_type":"WEIGHT_QUANT"}. Default: None.
For the configuration parameters related to post training quantization, please refer to
`quantization <https://www.mindspore.cn/lite/docs/en/master/use/post_training_quantization.html>`_.
For the configuration parameters related to extension, please refer to
`extension <https://www.mindspore.cn/lite/docs/en/master/use/nnie.html#extension-configuration>`_.
Raises:
TypeError: `section` is not a str.

View File

@ -149,8 +149,6 @@ schema::MetaGraphT *ConverterImpl::Convert(const std::shared_ptr<ConverterPara>
}
param->aclModelOptionCfgParam.om_file_path = param->output_file;
param->aclModelOptionCfgParam.offline = true;
if (!param->config_file.empty() || !param->config_param.empty()) {
auto ret = InitConfigParam(param);
if (ret != RET_OK) {
@ -531,6 +529,7 @@ std::string ConverterImpl::GetStrFromConfigFile(const std::string &file, const s
int RunConverter(const std::shared_ptr<ConverterPara> &param, void **model_data, size_t *data_size, bool not_save) {
mindspore::common_log_init();
param->aclModelOptionCfgParam.offline = !not_save;
ConverterImpl converter_impl;
auto meta_graph = converter_impl.Convert(param);
NotSupportOp::GetInstance()->PrintOps();