Repository: microsoft/hi-ml

Issue:
Many warnings are shown in the training logs of histo pipelines.
We can hardly read the training logs of histopathology pipelines because of some azure dependency warnings.

```text
Failure while loading azureml_run_type_providers. Failed to load entrypoint automl = azureml.train.automl.run:AutoMLRun._from_run_dto with exception (msal-extensions 1.0.0 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('msal-extensions~=0.3.0'), {'azure-identity'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.scriptrun = azureml.core.script_run:ScriptRun._from_run_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.PipelineRun = azureml.pipeline.core.run:PipelineRun._from_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.ReusedStepRun = azureml.pipeline.core.run:StepRun._from_reused_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.StepRun = azureml.pipeline.core.run:StepRun._from_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint hyperdrive = azureml.train.hyperdrive:HyperDriveRun._from_run_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint automl = azureml.train.automl.run:AutoMLRun._from_run_dto with exception (msal-extensions 1.0.0 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('msal-extensions~=0.3.0'), {'azure-identity'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.scriptrun = azureml.core.script_run:ScriptRun._from_run_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.PipelineRun = azureml.pipeline.core.run:PipelineRun._from_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.ReusedStepRun = azureml.pipeline.core.run:StepRun._from_reused_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.StepRun = azureml.pipeline.core.run:StepRun._from_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint hyperdrive = azureml.train.hyperdrive:HyperDriveRun._from_run_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint automl = azureml.train.automl.run:AutoMLRun._from_run_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.scriptrun = azureml.core.script_run:ScriptRun._from_run_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.PipelineRun = azureml.pipeline.core.run:PipelineRun._from_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.ReusedStepRun = azureml.pipeline.core.run:StepRun._from_reused_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.StepRun = azureml.pipeline.core.run:StepRun._from_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint hyperdrive = azureml.train.hyperdrive:HyperDriveRun._from_run_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint automl = azureml.train.automl.run:AutoMLRun._from_run_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.scriptrun = azureml.core.script_run:ScriptRun._from_run_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.PipelineRun = azureml.pipeline.core.run:PipelineRun._from_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.ReusedStepRun = azureml.pipeline.core.run:StepRun._from_reused_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.StepRun = azureml.pipeline.core.run:StepRun._from_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint hyperdrive = azureml.train.hyperdrive:HyperDriveRun._from_run_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint automl = azureml.train.automl.run:AutoMLRun._from_run_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.scriptrun = azureml.core.script_run:ScriptRun._from_run_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.PipelineRun = azureml.pipeline.core.run:PipelineRun._from_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.ReusedStepRun = azureml.pipeline.core.run:StepRun._from_reused_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.StepRun = azureml.pipeline.core.run:StepRun._from_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint hyperdrive = azureml.train.hyperdrive:HyperDriveRun._from_run_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint automl = azureml.train.automl.run:AutoMLRun._from_run_dto with exception (msal-extensions 1.0.0 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('msal-extensions~=0.3.0'), {'azure-identity'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.scriptrun = azureml.core.script_run:ScriptRun._from_run_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.PipelineRun = azureml.pipeline.core.run:PipelineRun._from_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.ReusedStepRun = azureml.pipeline.core.run:StepRun._from_reused_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint azureml.StepRun = azureml.pipeline.core.run:StepRun._from_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
Failure while loading azureml_run_type_providers. Failed to load entrypoint hyperdrive = azureml.train.hyperdrive:HyperDriveRun._from_run_dto with exception (azure-core 1.22.1 (/azureml-envs/azureml_ad828c522843e7a07e5ccbe50abb28a8/lib/python3.7/site-packages), Requirement.parse('azure-core<2.0.0,>=1.23.0'), {'azure-mgmt-core'}).
```


Discussion:

Resolving patch:
diff --git a/hi-ml-histopathology/src/histopathology/utils/tiles_selection_utils.py b/hi-ml-histopathology/src/histopathology/utils/tiles_selection_utils.py
--- a/hi-ml-histopathology/src/histopathology/utils/tiles_selection_utils.py
+++ b/hi-ml-histopathology/src/histopathology/utils/tiles_selection_utils.py
@@ -67,7 +67,6 @@ def update_selected_tiles(self, tiles: Tensor, attn_scores: Tensor, num_top_tile
         :param attn_scores: A tensor of attention scores assigned by the deepmil model to tiles of shape (n_tiles, 1).
         :param num_top_tiles: The number of tiles to select as top and bottom tiles.
         """
-        print("attn_scores.shape", attn_scores.shape)
         num_top_tiles = min(num_top_tiles, len(attn_scores))
 
         _, top_k_indices = torch.topk(attn_scores, k=num_top_tiles, largest=True, sorted=True)
@@ -167,7 +166,6 @@ def update_slides_selection(self, batch: Dict[SlideOrTileKey, Any], results: Dic
                 label = results[ResultsKey.TRUE_LABEL][i].item()
                 probs_gt_label = results[ResultsKey.CLASS_PROBS][:, label][i].item()
                 tiles = batch[SlideKey.IMAGE][i]
-                print("results[ResultsKey.BAG_ATTN][i].shape", results[ResultsKey.BAG_ATTN][i].shape)
                 attn_scores = results[ResultsKey.BAG_ATTN][i].squeeze(0)
                 pred_label = results[ResultsKey.PRED_LABEL][i].item()
                 self._update_label_slides(


Test patch: