diff --git a/InnerEye/Azure/azure_util.py b/InnerEye/Azure/azure_util.py index c361af861..856c9f747 100644 --- a/InnerEye/Azure/azure_util.py +++ b/InnerEye/Azure/azure_util.py @@ -251,7 +251,7 @@ def strip_prefix(string: str, prefix: str) -> str: :return: Input string with prefix removed. """ if string.startswith(prefix): - return string[len(prefix) :] + return string[len(prefix):] return string @@ -331,7 +331,7 @@ def download_run_outputs_by_prefix( # (120sec timeout for all files). for file in run.get_file_names(): if file.startswith(prefix_str): - target_path = file[len(prefix_str) :] + target_path = file[len(prefix_str):] if target_path.startswith("/"): target_path = target_path[1:] logging.info(f"Downloading {file}") @@ -403,11 +403,3 @@ def step_up_directories(path: Path) -> Generator[Path, None, None]: if parent == path: break path = parent - - -def get_default_azure_config_json_path() -> Path: - """ - Gets the path to the project's default Azure config JSON file. - """ - azure_config_json_path = fixed_paths.repository_root_directory() / "config.json" - return azure_config_json_path diff --git a/InnerEye/ML/configs/histo_configs/classification/DeepSMILEPanda.py b/InnerEye/ML/configs/histo_configs/classification/DeepSMILEPanda.py index 1ebeaeaa5..17f61921f 100644 --- a/InnerEye/ML/configs/histo_configs/classification/DeepSMILEPanda.py +++ b/InnerEye/ML/configs/histo_configs/classification/DeepSMILEPanda.py @@ -8,11 +8,14 @@ import os from monai.transforms import Compose from pytorch_lightning.callbacks.model_checkpoint import ModelCheckpoint + +from health_azure.utils import CheckpointDownloader +from health_azure.utils import get_workspace +from health_ml.networks.layers.attention_layers import GatedAttentionLayer from InnerEye.Common import fixed_paths from InnerEye.ML.Histopathology.datamodules.panda_module import PandaTilesDataModule -from InnerEye.Azure.azure_util import get_default_azure_config_json_path from InnerEye.ML.Histopathology.datasets.panda_tiles_dataset import PandaTilesDataset -from health_ml.networks.layers.attention_layers import GatedAttentionLayer + from InnerEye.ML.Histopathology.models.transforms import ( EncodeTilesBatchd, LoadTilesBatchd, @@ -25,7 +28,6 @@ ) from InnerEye.ML.configs.histo_configs.classification.BaseMIL import BaseMIL from InnerEye.ML.configs.histo_configs.run_ids import innereye_ssl_checkpoint -from health_azure.utils import CheckpointDownloader class DeepSMILEPanda(BaseMIL): @@ -75,7 +77,7 @@ def cache_dir(self) -> Path: def setup(self) -> None: if self.encoder_type == InnerEyeSSLEncoder.__name__: self.downloader = CheckpointDownloader( - azure_config_json_path=get_default_azure_config_json_path(), + azure_config_json_path=get_workspace(), run_recovery_id=innereye_ssl_checkpoint, checkpoint_filename="last.ckpt", download_dir="outputs/",