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

@sonnypark to my knowledge, nothing changed. Though this could an example of me fundamentally misunderstanding how allow_reuse works and what's entailed. One idea is that I made a Git commit on a file that has nothing to do with the step... would that trigger a new run?

What would help me to debug is:

  • a list of every factor that goes into whether the step will be re-used, and
  • a way for me to do the module hashing locally so I can tell what verify if the step will be reused or not before I submit my two hour pipelines.

dataders avatar Mar 23 '20 19:03 dataders

I think git commit can be a potential change can lead to different fingerprint in that any changes on the source_directory might result in different fingerprint. Since you were able to reuse on 4th run I don't think it is python package related. Afaik, any changes on source_dir including file content changes, path, file name can result in different fingerprint.

sonnypark avatar Mar 23 '20 21:03 sonnypark

I need help manually verifying:

  • are the shapshots/hashes unique from run to run?
  • if so, what is causing the snapshots/hashes to be different? I can't think of anything that's different.

dataders avatar Mar 23 '20 21:03 dataders

Working with Sonny, we're narrowed things down to the following testable hypotheses. Does allow_reuse work for HyperdriveStep if:

  1. I re-submit the exact same pipeline object, after the first PipelineRun completes?
  2. Re-create the pipeline object with line below, then submit again? pipeline = Pipeline(workspace=ws, steps=[best_run_step])
  3. restart my kernel then re-run the notebook?

To test these hypotheses:

  1. clone my fork of MachineLearningNotebooks (I've directly committed the necessary scripts and data)
  2. Ensure the data is in default datastore with the 'mnist' prefix (if not follow the original version of the notebook to do so.)
  3. Ensure you environment matches
  4. add your own config.json
  5. Run the entire notebook (Run->"Run All Cells") to test hypotheses 1&2.
  6. Kernel->Restart Kernel and Run All Cells to test hypothesis 3.

i've updated the reproducible example to ensure that within the notebook no changes are being made to the scripts nor the underlying data.

Again, here's my environment for reference:

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

dataders avatar Mar 24 '20 00:03 dataders

We had a sync up for the issue. I mentioned 3 things I found:

  1. source_directory should not be current directory if notebook is used in the same directory to avoid the change in the source_directory
  2. HDstep uses snapshotId as part of HDConfig which is part of reuse hash calculation.
  3. It turns out snapshot creation has limit on its cache so that even same path provided without any changes results in different snapshotId.

In summary, combination of 2 and 3 above, sometimes HDStep is reused sometimes not depends on creation of snapshot from other steps. So obvious fix on HDStep side is removing snapshotId from the hash calcuation so that reuse doesn't depends on snapshot creation. Since HDStep already checking the contents of the source_dir any changes on source_dir would still be part of reuse hash calculation.

Bug has been created to change it. https://msdata.visualstudio.com/vienna/_queries/edit/674431/?triage=true

sonnypark avatar Mar 25 '20 20:03 sonnypark

bug referenced has been resloved

DebFro avatar Apr 16 '20 22:04 DebFro

@sanpil @sonnypark after some testing, I'm 97% sure the bug is fixed! Thanks for your hard work.

dataders avatar Apr 20 '20 20:04 dataders

Thanks. I am worried about that 3% :)

sanpil avatar Apr 20 '20 21:04 sanpil