ReinforcementLearningConfiguration 类

表示针对 Azure 机器学习计算目标的强化学习运行配置。

ReinforcementLearningConfiguration 对象封装在试验中提交强化学习运行所必需的信息。 它包括有关执行实验运行的头、辅助角色和计算目标的信息。

继承
azureml._base_sdk_common.abstract_run_config_element._AbstractRunConfigElement
ReinforcementLearningConfiguration

构造函数

ReinforcementLearningConfiguration(head_configuration, worker_configuration, max_run_duration_seconds=None, cluster_coordination_timeout_seconds=None, source_directory=None, _path=None, _name=None, framework=None)

参数

head_configuration
必需

头配置。

worker_configuration
WorkerConfiguration
必需

辅助角色配置。

max_run_duration_seconds
int
必需

运行所允许的最长时间,以秒为单位。 如果时间超过此值,Azure 机器学习会尝试自动取消作业。

cluster_coordination_timeout_seconds
int
必需

作业在排队状态过后可以花费在启动上的最长时间,以秒为单位。

source_directory
str
必需

包含头运行的代码或配置的目录。

framework
RLFramework
必需

要在试验中使用的业务流程框架。 默认值为 Ray 版本 0.8.0

方法

load

从磁盘上文件加载以前保存的强化学习运行配置文件。

如果 path 指向某文件,则从该文件加载 ReinforcementLearningConfiguration。

如果 path 指向某目录(应该为项目目录),则从 path/.azureml/name or path/aml_config/name 加载 ReinforcementLearningConfiguration<><><><>。

save

将 ReinforcementLearningConfiguration 保存到磁盘上的文件。

引发 UserErrorException 的情况:

  • 无法用指定名称保存 ReinforcementLearningConfiguration。

  • 未指定 name 参数。

  • 没有 path 参数无效。

如果 path 的格式为 dir_path/file_name,其中 dir_path 是有效目录,则 ReinforcementLearningConfiguration 的保存位置为 dir_path/file_name<><><><><>。

如果 path 指向某目录(应该为项目目录),则 ReinforcementLearningConfiguration 保存在 path/.azureml/name or path/aml_config/name<><><><>。

在手动编辑配置或与 CLI 共享配置时,此方法非常有用。

load

从磁盘上文件加载以前保存的强化学习运行配置文件。

如果 path 指向某文件,则从该文件加载 ReinforcementLearningConfiguration。

如果 path 指向某目录(应该为项目目录),则从 path/.azureml/name or path/aml_config/name 加载 ReinforcementLearningConfiguration<><><><>。

static load(path=None, name=None)

参数

path
str
默认值: None

用户为运行配置选择根目录。 通常,这是 Git 存储库或 Python 项目根目录。 为实现后向兼容性,还将从 .azureml 或 aml_config子目录中加载配置。 如果文件不在这些目录中,则从指定路径加载该文件。 路径默认为当前工作目录(如果未提供)。

name
str
默认值: None

配置文件名称。

返回

强化学习运行配置对象。

返回类型

save

将 ReinforcementLearningConfiguration 保存到磁盘上的文件。

引发 UserErrorException 的情况:

  • 无法用指定名称保存 ReinforcementLearningConfiguration。

  • 未指定 name 参数。

  • 没有 path 参数无效。

如果 path 的格式为 dir_path/file_name,其中 dir_path 是有效目录,则 ReinforcementLearningConfiguration 的保存位置为 dir_path/file_name<><><><><>。

如果 path 指向某目录(应该为项目目录),则 ReinforcementLearningConfiguration 保存在 path/.azureml/name or path/aml_config/name<><><><>。

在手动编辑配置或与 CLI 共享配置时,此方法非常有用。

save(path=None, name=None, separate_environment_yaml=False)

参数

separate_environment_yaml
bool
默认值: False

指示是否保存 Conda 环境配置。 如果为 True,则 Conda 环境配置将保存到名为 environment.yml 的 YAML 文件中。

path
str
默认值: None

用户为运行配置选择根目录。 通常,这是 Git 存储库或 Python 项目根目录。 配置将保存到名为 .azureml 的子目录中。

name
str
默认值: None

[必需] 配置文件名。

返回类型