MachineLearningNotebooks icon indicating copy to clipboard operation
MachineLearningNotebooks copied to clipboard

Published pipeline with dataset (name) as PipelineParameter using a ParallelRunStep

Open JanusAsmussen opened this issue 6 years ago • 12 comments

I would like to publish a pipeline which takes as parameter the name of an input dataset. Something along the lines of:

dataset_name = PipelineParameter(name="dataset_name", default_value="input_dataset")
dataset = Dataset.get_by_name(workspace, dataset_name)

parallel_run_step = ParallelRunStep(
    name='parallel_batch_inference',
    models=[model],
    parallel_run_config=parallel_run_config,
    inputs=[dataset.as_named_input('input_dataset')],
    output=output_dir,
    arguments=arguments,
)

A compromise would be to apply the suggestion from #328 where a DataPath is used in conjunction with PipelineParameter as follows:

datapath = DataPath(datastore=def_blob_store, path_on_datastore='input_data/')
datapath_param = PipelineParameter(name="input_data", default_value=datapath)
data_parameter = (datapath_param, DataPathComputeBinding(mode='mount'))

step_ = PythonScriptStep(
    script_name="infer.py",
    arguments=["--input", data_parameter],
    inputs=[data_parameter],
    outputs=[processed_data],    
    compute_target=gpucluster, 
)

However, the ParallelRunStep class does not seem to accept the (PipelineParameter, DataPathCompute) tuple input structure.

How would i go about parametrising the input dataset when using a ParallelRunStep?

JanusAsmussen avatar Jan 24 '20 21:01 JanusAsmussen

Hi @JanusAsmussen, unfortunately, we currently don't support Dataset with PipelineParameter but it is something we are working on adding in the next two months. I will update here once the feature has been shipped.

rongduan-zhu avatar Mar 10 '20 16:03 rongduan-zhu

is there an update on this issue?

I have a scenario where I need to vary the path of the input dataset to ParallelRunStep when calling a published pipeline. I can pass in the subfolder path to the published pipeline using the REST end point, but there does not seem to be a way to affect a change on the input dataset to the step.

failing to achieve this means that the run() method in the entry script is always passed the full minibatch, which leaves it to the entry_script logic to filter through and only process those files under the subfolder.

mutazag avatar Jul 29 '20 15:07 mutazag

@rongduan-zhu do you have any update for this ask?

shbijlan avatar Aug 04 '20 19:08 shbijlan

We have added support for using dataset with pipeline parameter. Please see the example here. We currently only support parameterizing based on the Dataset ID but not from a datastore + path on datastore. We are adding support this month.

rongduan-zhu avatar Aug 04 '20 21:08 rongduan-zhu

@rongduan-zhu does this work for DatabricksStep? I can't seem to make it work and all examples I see use PythonScriptStep.

jarandaf avatar Nov 02 '20 11:11 jarandaf

We have added support for using dataset with pipeline parameter. Please see the example here. We currently only support parameterizing based on the Dataset ID but not from a datastore + path on datastore. We are adding support this month.

@rongduan-zhu I wonder if there is an update on this?

I want to use something like in the documentation here, but using ParallelRunStep instead of PythonScriptStep. For example:

   datapath = DataPath(datastore=datastore, path_on_datastore='input_data')
   data_path_pipeline_param = (PipelineParameter(name="input_data", default_value=datapath),
                               DataPathComputeBinding(mode='mount'))

   train_step = ParallelRunStep(script_name="train.py",
                                 arguments=["--input", data_path_pipeline_param],
                                 inputs=[data_path_pipeline_param],
                                 target=compute_target,
                                 source_directory=project_folder)

wkfong1 avatar Jun 04 '21 16:06 wkfong1

is there any update on this?

parimalak avatar Mar 24 '22 03:03 parimalak

@JanusAsmussen @shbijlan @parimalak Have you tried this approach? https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/machine-learning-pipelines/parallel-run/file-dataset-image-inference-mnist.ipynb

@JanusAsmussen i was able resolve by using

from azureml.core.dataset import Dataset from azureml.data.dataset_consumption_config import DatasetConsumptionConfig from azureml.pipeline.core import PipelineParameter dataset = Dataset.get_by_name(workspace, name='resnet-test') pipeline_param = PipelineParameter(name="input_data", default_value=dataset) input_data_config = DatasetConsumptionConfig("input_data_config", pipeline_param).as_mount()

from azureml.pipeline.steps import ParallelRunStep, ParallelRunConfig parallel_run_step = ParallelRunStep( name="prs-test", parallel_run_config = parallel_run_config, inputs=[ input_data_config ], output=output_dir, allow_reuse=False, )

parimalak avatar Mar 27 '22 22:03 parimalak

Hi @ALPA-Industry-and-Technology and @parimalak,

We stopped using AML due to a number of limitations but thanks for the updates.

JanusAsmussen avatar Mar 28 '22 07:03 JanusAsmussen

@JanusAsmussen Out of genuine interest: Could you name and explain some limitations of AML, please? I am asking for me personally to know about limitations of AML.

@ALPA-Industry-and-Technology

It has been more than 2 years since we did the AML PoC, so the limitations I found back then may very well be resolved by now (This thread is an example of this).

JanusAsmussen avatar Mar 28 '22 08:03 JanusAsmussen