添加算法¶
命令: algorithm
算法添加分类两类,本地和远程,用 --help
命令可看到有以下子命令 local
remote
:
anyctl add algorithm --help
Usage: anyctl add algorithm [OPTIONS] COMMAND [ARGS]...
Add local or remote algorithm to local Anylearn project.
Options:
--help Show this message and exit.
Commands:
local Add local algorithm to current project.
remote Add remote algorithm by ID to current project.
添加本地算法¶
命令: local
参数及缩写 |
是否必须 |
默认值 |
说明 |
---|---|---|---|
name |
True |
算法名称 |
|
--dir |
True |
本地算法文件夹(绝对路径) |
|
--entrypoint-training |
True |
启动训练的入口命令 |
|
--output-training |
True |
训练输出模型的相对路径(相对于算法目录) |
使用示例:
anyctl add algorithm local anyctl_algo --dir D:\anyctl-test\resource\cnn --entrypoint-training "python fashion_mnist.py" --output-training anyctl_algo_result
运行后会有以下输出:
[SUCCESS] ADDED #提示算法添加成功
此时我们用 anyctl config ls
查看配置项可以看到算法信息已经有了:
remote:
host:
username:
password:
project:
id:
name: anyctl_project
description: A project created by anylearn ctl.
algorithms:
anyctl_algo:
id:
name: anyctl_algo
description:
visibility: 3
train_params: []
follows_anylearn_norm: false
entrypoint_training: python fashion_mnist.py
output_training: anyctl_algo_result
datasets: {}
path:
algorithm:
anyctl_algo: D:\anyctl-test\resource\cnn
dataset: {}
添加远程算法¶
我们除了添加本地算法以外还可以添加已经上传到后端的算法,只需要知道后端算法ID即可。
命令: remote
参数及缩写 |
是否必须 |
默认值 |
说明 |
---|---|---|---|
id |
True |
远程算法ID |
使用示例:
anyctl add algorithm remote ALGOxxx
如果需要配置远程地址和用户信息请参考 远程地址和用户设置 。
运行后会有以下输出:
[SUCCESS] ADDED #提示算法添加成功
此时我们用 anyctl config ls
查看配置项可以看到远程算法信息已经有了:
...
algorithms:
anyctl_algo:
id:
name: anyctl_algo
description:
visibility: 3
train_params: []
follows_anylearn_norm: false
entrypoint_training: python fashion_mnist.py
output_training: anyctl_algo_result
cli_example_algo: #远程算法信息
id: ALGOxxx
name: cli_example_algo
description: SDK_QUICKSTART
visibility: 3
train_params:
- name: dataset
type: dataset
suggest: 1
- name: dataset
type: dataset
suggest: 1
- name: model_path
alias: ''
description: ''
type: model
suggest: 1
follows_anylearn_norm: false
entrypoint_training: python fashion_mnist.py
output_training: model-output
datasets: {}
path:
algorithm:
anyctl_algo: D:\anyctl-test\resource\cnn
cli_example_algo:
dataset: {}