我正在使用 Azure ML Python SDK 来构建自定义实验管道。我正在尝试在具有 GPU 的 4 个 VM 集群上并行运行我的表格数据集的训练。我正在关注此链接上提供的文档https://docs.microsoft.com/en-us/python/api/azureml-contrib-pipeline-steps/azureml.contrib.pipeline.steps.parallelrunconfig?view=azure-ml -py
我面临的问题是,无论我设置什么值mini_batch_size
,个人运行都会获得所有行。我正在使用 EntryScript().logger 来检查传递给每个进程的行数。我看到的是,我的数据被 4 个虚拟机处理了 4 次,而不是被分成 4 个部分。我尝试将值设置mini_batch_size
为1KB
, 10KB
, 1MB
,但似乎没有任何区别。
这是我的 ParallelRunConfig 和 ParallelRunStep 代码。任何提示表示赞赏。谢谢
#------------------------------------------------#
# Step 2a - Batch config for parallel processing #
#------------------------------------------------#
from azureml.pipeline.steps import ParallelRunConfig
# python script step for batch processing
dataprep_source_dir = "./src"
entry_point = "batch_process.py"
mini_batch_size = "1KB"
time_out = 300
parallel_run_config = ParallelRunConfig(
environment=custom_env,
entry_script=entry_point,
source_directory=dataprep_source_dir,
output_action="append_row",
mini_batch_size=mini_batch_size,
error_threshold=1,
compute_target=compute_target,
process_count_per_node=1,
node_count=vm_max_count,
run_invocation_timeout=time_out
)
#-------------------------------#
# Step 2b - Run Processing Step #
#-------------------------------#
from azureml.pipeline.core import PipelineData
from azureml.pipeline.steps import PythonScriptStep
from azureml.pipeline.steps import ParallelRunStep
from datetime import datetime
# create upload dataset output for processing
output_datastore_name = processed_set_name
output_datastore = Datastore(workspace, output_datastore_name)
processed_output = PipelineData(name="scores",
datastore=output_datastore,
output_path_on_compute="outputs/")
# pipeline step for parallel processing
parallel_step_name = "batch-process-" + datetime.now().strftime("%Y%m%d%H%M")
process_step = ParallelRunStep(
name=parallel_step_name,
inputs=[data_input],
output=processed_output,
parallel_run_config=parallel_run_config,
allow_reuse=False
)