在Azure ML中使用本地计算和Estimator

问题描述 投票:1回答:1

是否可以将本地计算用于TensorFlow估算器?为训练运行配置虚拟机需要花费大量时间,我希望能够在本地尝试一些运行,直到我的配置稳定。

https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/machine-learning/service/how-to-train-tensorflow.md

通过创建一个空的RunConfiguration,可以使用ScriptRunConfig执行此操作。该文档声称可以创建本地ComputeTarget,但缺少有关如何执行此操作的文档:

https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/machine-learning/service/how-to-set-up-training-targets.md#local

本地电脑

创建和附加:无需创建或附加计算目标即可将本地计算机用作培训环境。

配置:将本地计算机用作计算目标时,培训代码将在开发环境中运行。如果该环境已经包含您需要的Python包,请使用用户管理的环境。

[!代码蟒蛇]

azure tensorflow azure-machine-learning-studio
1个回答
1
投票

我直接使用Microsoft docs,而不是GitHub原始页面 - 我注意到后者有时不完整和/或过时。

正如您所怀疑的那样,docs确认您应该创建一个空的RunConfiguration,类似于以下代码(取自上述链接):

from azureml.core.runconfig import RunConfiguration

# Edit a run configuration property on the fly.
run_local = RunConfiguration()

run_local.environment.python.user_managed_dependencies = True


0
投票

使用compute_target =“local”。改编Microsoft docs

script_params = {
    '--num_epochs': 30,
    '--output_dir': './outputs'
}

estimator = PyTorch(source_directory=project_folder, 
                    script_params=script_params,
                    # compute_target=compute_target,
                    compute_target='local',
                    entry_script='pytorch_train.py',
                    use_gpu=True,
                    pip_packages=['pillow==5.4.1'])
© www.soinside.com 2019 - 2024. All rights reserved.