MachineLearningNotebooks icon indicating copy to clipboard operation
MachineLearningNotebooks copied to clipboard

BUG: HyperDriveStep's allow_reuse param does not work.

Open dataders opened this issue 6 years ago • 28 comments

I made a reproducible example in this branch of a fork of this repo. This is a big time suck for our team as the majority of our pipelines use HyperDriveStep and we always have downstream steps from HyperDrive. https://github.com/swanderz/MachineLearningNotebooks/blob/hyperdrive_allow_reuse/how-to-use-azureml/machine-learning-pipelines/intro-to-pipelines/aml-pipelines-parameter-tuning-with-hyperdrive.ipynb

dataders avatar Jan 17 '20 20:01 dataders

@swanderz I see that you are copying training_files to script_folder, at cell "Copy the training files into the script folder" which would be changing the hash of the source_directory and preventing the reuse. Are you running that everytime?

purnesh42H avatar Jan 21 '20 18:01 purnesh42H

@purnesh42H thanks for jumping on to help out! The copy script magic was just part of the minimum viable reproducible example I used. Here's the steps to reproduce:

  1. Run the whole notebook through
pipeline = Pipeline(workspace=ws, steps=[best_run_step])
pipeline_run = exp.submit(pipeline)
pipeline_run.wait_for_completion()
  1. Submit the pipeline again, with the above cells, changing nothing else.
  2. HyperDriveStep will run again, ignoring allow_reuse.

I'm interested to see what you get on your side!

dataders avatar Jan 21 '20 18:01 dataders

@swanderz for some of the services such as HD or AutoML, they possibly produce similar output with same config but not exactly same afaik. I will confirm with HD team and let you know.

sonnypark avatar Jan 21 '20 22:01 sonnypark

actually regardless of HD produce same output or not allow_reuse needs to skip HD runs so that user can control it. Will check why it didn't work.

sonnypark avatar Jan 21 '20 22:01 sonnypark

@sonnypark I appreciate you also helping me get answers. Can you please run the reprex and see what you get? When I do it, the stdout says something along the lines of hd_step01 will run and generate new outputs and I wait ~12 minutes for the step to complete, which its a lot longer than I would expect if the step is being reused. image

dataders avatar Jan 21 '20 22:01 dataders

Yes "hd_step01 will run and generate new outputs" is what we get when the step is not reused. Will try to repro.

sonnypark avatar Jan 21 '20 22:01 sonnypark

synced with @clmccart 95% chance this is related to #734.

dataders avatar Jan 22 '20 19:01 dataders

#734 is unrelated. In the case of hyperdrive, there is a change in hyperdrive config setting which is preventing the reuse

purnesh42H avatar Jan 23 '20 21:01 purnesh42H

Any update on this?

nemasobhani avatar Feb 07 '20 00:02 nemasobhani

Fix has been checked in and will be available on the next release (which will be next week).

sonnypark avatar Feb 11 '20 18:02 sonnypark

@sonnypark good to hear. in the next release, will the changes in the experimental branch also be included? I'd like to have this issue and #771 fixed in the same release.

dataders avatar Feb 11 '20 19:02 dataders

the experimental branch?

sonnypark avatar Feb 11 '20 20:02 sonnypark

I realized that Experimental release is the different name of Release cut. Yes, the fix has been added to the latest release cut yesterday. AzureML SDK Experimental Release Candidate is 1.1.0a1.dev0 And #771 fix should be in the release too.

sonnypark avatar Feb 11 '20 21:02 sonnypark

@sonnypark @rastala @purnesh42H @sanpil @nemasobhani remember this bug? it's back.... here's the reprex here are the package versions I'm using.

azureml-automl-core                  1.1.5.1
azureml-contrib-notebook             1.1.5.1
azureml-core                         1.1.5.4
azureml-dataprep                     1.3.2
azureml-dataprep-native              14.1.0
azureml-interpret                    1.1.5
azureml-pipeline                     1.1.5
azureml-pipeline-core                1.1.5
azureml-pipeline-steps               1.1.5
azureml-sdk                          1.1.5
azureml-telemetry                    1.1.5.3
azureml-train                        1.1.5
azureml-train-automl-client          1.1.5.1
azureml-train-core                   1.1.5
azureml-train-restclients-hyperdrive 1.1.5
azureml-widgets                      1.1.5

Alt Text

dataders avatar Mar 20 '20 22:03 dataders

@swanderz I can see 'finished' run on the link you posted with new step created without reusing. But I guess you already ran the same notebook before with no changes. Any changes on your packages from the ones which was able to reuse?

Oh I found that you ran the same job twice in the same notebook!

sonnypark avatar Mar 20 '20 23:03 sonnypark

Yeah to prove the bug. I submit the run twice. In the 2nd PipelineRun, we should see that the HyperDriveStep is not re-run... but we don't.

I want to say that the bug does not happen in 1.1.0a1.dev0, but does happen in 1.1.5.1

dataders avatar Mar 20 '20 23:03 dataders

looks strange to me. It looks the second step is reused: Created step get best run [31c67e94][a9842d81-7995-43c1-bb55-df20aa92e1b0], (This step is eligible to reuse a previous run's output) Created step hd_step01 [54aa5211][a10bf668-d90f-44a4-9524-8759d419aa95], (This step will run and generate new outputs)

@swanderz did you actually could see the second run took same amount of time to run the job?

sonnypark avatar Mar 20 '20 23:03 sonnypark

I was able to reuse running the published HyperDriveStep notebook. You can check the run was really reused in portal: image

sonnypark avatar Mar 21 '20 00:03 sonnypark

@sonnypark I appreciate you helping out again. Are you 100% that you have the same environment as me? Can you run pip list | grep 'azureml' and share the results? It is very frustrating that I can't help you to reproduce the error on your end. In our workflows, HyperDriveStep is sporadically reused. @sanpil @yanrez what can I do to determine if a step will be re-used beyond the console stdout and the portal info?

All the PipelineRuns

image

All HyperdriveStepRuns

Here's the StepRuns that corresponds to past 3 HyperDriveStep's that have run. image

1st PipelineRun 62

this is the first time i ran the pipeline in two months. note that for hd_step01:

  • duration is 9m 15s
  • "Reuse" is "No" image

2nd PipelineRun 71

This is a run i submitted immediately after the first. I'm 97% sure I didn't change anything, just submitted again. Note:

  • duration is 10m 28s
  • "Reuse" is again "No" image

3rd PipelineRun 80 (6 hours later)

I submitted this after seeing @sonnypark 's reply. Still didn't re-use... Strange. Note:

  • duration is 8m 57s
  • "Reuse" is again "No" image

4th PipelineRun 89

Now it's working?? Note:

  • duration is 0s
  • "Reuse" is finally "Yes" image

dataders avatar Mar 22 '20 23:03 dataders

Considering you were able to reuse on the 4th run, I suspect either

  1. backend service ended up rerunning even with the same fingerprint for the module hash calculation or
  2. There were some unnoticed changed on 2/3rd run such as path or contents of files. I can take a look at the backend side to see any possible reasons for such. Is there any possibility on your side for such changes you didn't noticed?

sonnypark avatar Mar 23 '20 19:03 sonnypark