NLP自学习平台 - nlp-automl CLI 命令参考

更新时间:
复制 MD 格式

本文列出 NLP自学习平台 - nlp-automl 在阿里云 CLI 中的可用命令,并提供各命令的语法和参数说明。

前提条件

  • 已安装阿里云 CLI。安装方法请参见安装/更新 CLI。

  • 执行需要身份认证的命令前,请确认已配置阿里云 CLI 凭证,且凭证对应的身份拥有所需权限。配置方法请参见配置与管理身份凭证。

地域与接入点

凭证配置中的默认地域可用 --region <regionId> 覆盖。

未指定接入地址时,CLI 按产品规则尝试解析,需要指定时可按地域和网络类型查看 Endpoint,再使用 --endpoint <endpoint>。

版本信息

属性

值

CLI 版本

3.5.4

API 版本

2019-07-01, 2019-11-11

不同版本的命令和参数通过页签分别展示。执行命令时,请使用对应页签中的语法。

可用命令

单击命令名称,查看命令描述、语法和参数说明。

2019-11-11

预测

命令

说明

CreateAsyncPredict

调用CreateAsyncPredict创建一个异步预测

GetAsyncPredict

调用GetAsyncPredict获取异步预测结果

模型

命令

说明

GetPredictResult

调用GetPredictResult获取模型预测结果

RunPreTrainService

调用预训练模型服务

2019-07-01

命令

说明

AddMTInterveneWord

把待干预的原文和译文添加到ProjectId和PackageId对应的dataSet上

GetPredictDoc

根据调用PredictMTModelByDoc返回的docId,调用该接口,返回预测后的结果

PredictMTModelByDoc

上传文档内容,指定模型进行预测

命令详情

语法逐行列出命令参数:<类型> 是需要替换的值占位符,方括号表示可选参数,# 表示列表项序号;[options] 表示 CLI 通用选项,见“全局选项”。可选对象或列表内标为必填的字段,仅在提供该对象或列表项时必填。完整参数定义见各命令的参数说明。

AddMTInterveneWord

API 版本:2019-07-01

命令描述

把待干预的原文和译文添加到ProjectId和PackageId对应的dataSet上

语法

aliyun nlp-automl AddMTInterveneWord --version 2019-07-01
    --PackageId <string>
    --ProjectId <string>
    --SourceText <string>
    [--TargetText <string>]
    [options]

参数

参数

类型

必填

说明

--PackageId

String

是

词包id

--ProjectId

String

是

项目id

--SourceText

String

是

原文

--TargetText

String

否

译文

CreateAsyncPredict

API 版本:2019-11-11

命令描述

调用CreateAsyncPredict创建一个异步预测

语法

aliyun nlp-automl CreateAsyncPredict --version 2019-11-11
    [--Content <string>]
    [--DetailTag <string>]
    [--FetchContent <string>]
    [--FileContent <string>]
    [--FileType <string>]
    [--FileUrl <string>]
    [--ModelId <int>]
    [--ModelVersion <string>]
    [--ServiceName <string>]
    [--ServiceVersion <string>]
    [--TopK <int>]
    [options]

参数

参数

类型

必填

说明

--Content

String

否

预测内容,最大长度:1024字节

--DetailTag

String

否

文本实体抽取类型模型,是否返回详细抽取结果。可选值:true/false

--FetchContent

String

否

返回预测文本

--FileContent

String

否

文件内容Base64编码

--FileType

String

否

文件类型

--FileUrl

String

否

文件HTTP保存地址

--ModelId

Integer

否

模型ID。根据服务名称和服务版本创建异步预测的时候,此参数不必传;否则必传

--ModelVersion

String

否

要获取的物模型版本号。不传入此参数,则返回已发布的最新版本。根据模型ID调用异步预测接口的时候传此参数

--ServiceName

String

否

服务名称

--ServiceVersion

String

否

服务版本

--TopK

Integer

否

设置返回top结果数量

示例

aliyun nlp-automl CreateAsyncPredict --region cn-hangzhou --FileContent base64_encode_content --TopK 3 --FileUrl 'http://127.0.0.1/example.docx' --FileType 'text,html,pdf,docx,doc' --ServiceName ContractNERPretrain --Content '全国土地利用总体规划' --ServiceVersion V1 --FetchContent true --ModelVersion V1 --ModelId 1 --DetailTag false --version 2019-11-11 --method POST --force

GetAsyncPredict

API 版本:2019-11-11

命令描述

调用GetAsyncPredict获取异步预测结果

语法

aliyun nlp-automl GetAsyncPredict --version 2019-11-11
    --AsyncPredictId <int>
    [options]

参数

参数

类型

必填

说明

--AsyncPredictId

Integer

是

异步预测ID,通过调用CreateAsyncPredict接口获取

示例

aliyun nlp-automl GetAsyncPredict --region cn-hangzhou --AsyncPredictId 1629 --version 2019-11-11 --force

GetPredictDoc

API 版本:2019-07-01

命令描述

根据调用PredictMTModelByDoc返回的docId,调用该接口,返回预测后的结果

语法

aliyun nlp-automl GetPredictDoc --version 2019-07-01
    --DocId <int>
    [--Product <string>]
    [options]

参数

参数

类型

必填

说明

--DocId

Integer

是

文档id

--Product

String

否

产品code

GetPredictResult

API 版本:2019-11-11

命令描述

调用GetPredictResult获取模型预测结果

语法

aliyun nlp-automl GetPredictResult --version 2019-11-11
    --Content <string>
    [--DetailTag <string>]
    --ModelId <int>
    --ModelVersion <string>
    [--TopK <int>]
    [options]

参数

参数

类型

必填

说明

--Content

String

是

预测结果,格式为json字符串

--DetailTag

String

否

标签类型

  • 约束:

    • 允许值:["false", "true"]

--ModelId

Integer

是

模型id

--ModelVersion

String

是

模型版本

  • 约束:

    • 允许值:["V1", "V2"]

--TopK

Integer

否

0表示未开始预测,1表示已开始预测

示例

aliyun nlp-automl GetPredictResult --region cn-hangzhou --Content 'example-string' --ModelId 1 --version 2019-11-11 --method POST --force

PredictMTModelByDoc

API 版本:2019-07-01

命令描述

上传文档内容,指定模型进行预测

语法

aliyun nlp-automl PredictMTModelByDoc --version 2019-07-01
    --FileContent <string>
    --FileType <string>
    --ModelId <int>
    --ModelVersion <string>
    [--NeedXLIFF <bool>]
    [options]

参数

参数

类型

必填

说明

--FileContent

String

是

文件数据内容,文件内容需进过base64编码

--FileType

String

是

文件类型

--ModelId

Integer

是

模型id

--ModelVersion

String

是

模型版本

--NeedXLIFF

Boolean

否

是否需要xliff信息

RunPreTrainService

API 版本:2019-11-11

命令描述

调用预训练模型服务

语法

aliyun nlp-automl RunPreTrainService --version 2019-11-11
    --PredictContent <string>
    --ServiceName <string>
    [--ServiceVersion <string>]
    [options]

参数

参数

类型

必填

说明

--PredictContent

String

是

预测输入

--ServiceName

String

是

服务名称

--ServiceVersion

String

否

服务版本

示例

aliyun nlp-automl RunPreTrainService --region cn-hangzhou --PredictContent '{"input":{"content":"这件衣服真好看","domain":"clothing"}}' --ServiceName ReviewAnalysis --version 2019-11-11 --method POST --force

全局选项

以下为 CLI 通用选项,各选项的适用范围以说明为准。

选项

说明

--cli-dry-run

使用 --cli-dry-run 在执行校验后以人类可读格式输出请求详情,跳过实际运行

--cli-input-json

使用 --cli-input-json foo.json 从 JSON 对象读取产品 API 参数,命令行显式参数覆盖文件值

--cli-output

设置宿主 CLI Help、本地错误和更新检查的输出格式(json)

--cli-query

使用 --cli-query <jmespath> 通过 JMESPath 表达式过滤输出结果

--cli-sign-version

短横线命令的 OpenAPI 签名版本:当前仅支持 v4;设为空值可清空并恢复默认签名(aliyun configure set 可写入 Profile)

--language

使用 --language [en|zh] 来指定语言

--output -o

使用 --output cols=Field1,Field1 [rows=jmesPath] 使用表格方式打印输出

--profile -p

使用 --profile <profileName> 指定操作的配置集

--region

使用 --region <regionId> 来指定访问大区

--version --api-version

使用 --version <YYYY-MM-DD> 来指定访问的API版本

--yes -y

跳过安全策略的确认提示(用于非交互式/Agent 场景)