Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
e40ceb8
packages update
ant0nsc Jul 27, 2021
22d9aff
WIP
ant0nsc Jul 30, 2021
d2cd993
pypi location fixes
ant0nsc Jul 30, 2021
09da2b4
fix type error
ant0nsc Jul 30, 2021
c821deb
latest package version, fixes in runner logic
ant0nsc Jul 31, 2021
94e370a
latest package version
ant0nsc Jul 31, 2021
1f5f7f4
using submodule
ant0nsc Jul 31, 2021
34638bd
update
ant0nsc Jul 31, 2021
dc798e7
rename
ant0nsc Jul 31, 2021
981bbf8
remove code to manipulate arguments
ant0nsc Jul 31, 2021
9307e6b
adding diag
ant0nsc Jul 31, 2021
5a7250b
more diag
ant0nsc Jul 31, 2021
201ec71
cleanup of tags and waiting logic
ant0nsc Jul 31, 2021
289f383
import error
ant0nsc Aug 1, 2021
de47ee2
test fixes
ant0nsc Aug 1, 2021
22a385a
mypy
ant0nsc Aug 1, 2021
e6b1679
update
ant0nsc Aug 1, 2021
b880980
test fixes
ant0nsc Aug 1, 2021
d443c0f
PYTHONPATH for tests
ant0nsc Aug 2, 2021
dc2e71f
fix submit_for_inference
ant0nsc Aug 2, 2021
5c30270
test fixes
ant0nsc Aug 2, 2021
476691c
update and run pytest
ant0nsc Aug 2, 2021
5a1befb
python path
ant0nsc Aug 2, 2021
6177c69
test fixes
ant0nsc Aug 2, 2021
80bf11e
test fixes
ant0nsc Aug 2, 2021
c8b3836
hyperdrive
ant0nsc Aug 2, 2021
659389a
latest hi-ml
ant0nsc Aug 3, 2021
e2223e1
update runconfig
ant0nsc Aug 3, 2021
190cacf
removing dead code
ant0nsc Aug 4, 2021
a7f863c
include hi-ml
ant0nsc Aug 4, 2021
d54a6e1
adding merging
ant0nsc Aug 4, 2021
b1ae643
rename. test fix
ant0nsc Aug 4, 2021
e6221d6
latest
ant0nsc Aug 4, 2021
6fb7aa4
cleanup and fixes
ant0nsc Aug 4, 2021
2f529db
using docker
ant0nsc Aug 4, 2021
8d08531
fix papermill
ant0nsc Aug 4, 2021
4d9952b
import fix
ant0nsc Aug 4, 2021
0d15f04
clean up importing submodules
ant0nsc Aug 5, 2021
6c7a8a5
revert fix papermill
ant0nsc Aug 5, 2021
50ea333
submodule
ant0nsc Aug 5, 2021
9d467e2
test fixes
ant0nsc Aug 5, 2021
6b8f250
import fix
ant0nsc Aug 5, 2021
91fb941
changelog
ant0nsc Aug 5, 2021
8f70725
submodules
ant0nsc Aug 6, 2021
1306198
test passing
ant0nsc Aug 6, 2021
014104d
latest master
ant0nsc Aug 6, 2021
4d2cd8a
better diag
ant0nsc Aug 7, 2021
b7fc99d
comments and test fixes
ant0nsc Aug 7, 2021
97356c5
Allowing llocal devcontainer definitions
Aug 19, 2021
b2fa8d4
Adding hi-ml package from PyPi to environment.yml
Aug 20, 2021
3179b9e
Removing hi-ml submodule
Aug 20, 2021
90faa65
Removing hi-ml submodule from PyCharm configs
Aug 20, 2021
5f51a68
Removing PYTHONPATH hi-ml settings in build pipeln
Aug 20, 2021
def0cd6
Avoiding call to get_workspace for local runs
Aug 20, 2021
148b857
Fix? for test_run_fastmri_container fails
dumbledad Aug 21, 2021
4b947d9
Pinned hi-ml package
Aug 24, 2021
6b79b15
Merge branch 'antonsc/himl' of https://github.com/microsoft/InnerEye-…
Aug 24, 2021
0701709
Temp comment out time-out test
Aug 24, 2021
ab66cc0
Reverting PR build pipeline
Aug 25, 2021
3fd249d
Merge branch 'main' into antonsc/himl
Aug 25, 2021
7fc03c3
Merge branch 'main' into antonsc/himl
Aug 25, 2021
4010a00
Moving to hi-ml 0.1.3
Aug 25, 2021
0b498a8
Removing submodule comments
Aug 25, 2021
24e358f
test_image_files in comment -> image_files
Aug 25, 2021
c7b53d7
Removing TODO comment
Aug 25, 2021
ac3b7e3
Trailing whitespace
Aug 25, 2021
748683d
0.1.3 not there yet
Aug 25, 2021
30014c6
Remove @pytest.mark.skip(reason="")
Aug 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/linting_and_hello_world.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
- uses: actions/checkout@v2
with:
lfs: true
submodules: true

- name: flake8
run: |
Expand Down Expand Up @@ -58,7 +59,8 @@ jobs:
- uses: actions/checkout@v2
with:
lfs: true

submodules: true

- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: InnerEye
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ dmypy.json

# other
.vscode/
.devcontainer/

/InnerEye/ML/src/aml_config
*.exe
Expand Down
3 changes: 2 additions & 1 deletion .idea/runConfigurations/Template__Run_ML_on_AzureML.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/runConfigurations/pytest_all_simple_tests.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs that run in AzureML.
- ([#533](https://github.com/microsoft/InnerEye-DeepLearning/pull/533)) Better defaults for inference on ensemble children.
- ([#536](https://github.com/microsoft/InnerEye-DeepLearning/pull/536)) Inference will not run on the validation set by default, this can be turned on
via the `--inference_on_val_set` flag.
- ([#548](https://github.com/microsoft/InnerEye-DeepLearning/pull/548)) Many Azure-related functions have been moved
out of the toolbox, into the separate hi-ml Python package.
- ([#502](https://github.com/microsoft/InnerEye-DeepLearning/pull/502)) Renamed command line option 'perform_training_set_inference' to 'inference_on_train_set'. Replaced command line option 'perform_validation_and_test_set_inference' with the pair of options 'inference_on_val_set' and 'inference_on_test_set'.
- ([#496](https://github.com/microsoft/InnerEye-DeepLearning/pull/496)) All plots are now saved as PNG, rather than JPG.
- ([#497](https://github.com/microsoft/InnerEye-DeepLearning/pull/497)) Reducing the size of the code snapshot that
Expand Down
72 changes: 2 additions & 70 deletions InnerEye/Azure/azure_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,17 @@

import getpass
import logging
import sys
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Union

import param
from azureml.core import Dataset, Datastore, Run, ScriptRunConfig, Workspace
from azureml.core import Run, ScriptRunConfig, Workspace
from azureml.core.authentication import InteractiveLoginAuthentication, ServicePrincipalAuthentication
from azureml.data import FileDataset
from azureml.data.dataset_consumption_config import DatasetConsumptionConfig
from azureml.train.hyperdrive import HyperDriveConfig
from git import Repo

from InnerEye.Azure.azure_util import fetch_run, is_offline_run_context, remove_arg
from InnerEye.Azure.azure_util import fetch_run, is_offline_run_context
from InnerEye.Azure.secrets_handling import SecretsHandling, read_all_settings
from InnerEye.Common import fixed_paths
from InnerEye.Common.generic_parsing import GenericConfig
Expand Down Expand Up @@ -240,64 +237,6 @@ def fetch_run(self, run_recovery_id: str) -> Run:
"""
return fetch_run(workspace=self.get_workspace(), run_recovery_id=run_recovery_id)

def get_or_create_dataset(self, azure_dataset_id: str) -> FileDataset:
"""
Looks in the AzureML datastore for a dataset of the given name. If there is no such dataset, a dataset is
created and registered, assuming that the files are in a folder that has the same name as the dataset.
For example, if azure_dataset_id is 'foo', then the 'foo' dataset should be pointing to the folder
<container_root>/datasets/foo/
"""
if not self.azureml_datastore:
raise ValueError("No value set for 'azureml_datastore' (name of the datastore in the AzureML workspace)")
if not azure_dataset_id:
raise ValueError("No dataset ID provided.")
workspace = self.get_workspace()
logging.info(f"Retrieving datastore '{self.azureml_datastore}' from AzureML workspace {workspace.name}")
datastore = Datastore.get(workspace, self.azureml_datastore)
try:
logging.info(f"Trying to retrieve AzureML Dataset '{azure_dataset_id}'")
azureml_dataset = Dataset.get_by_name(workspace, name=azure_dataset_id)
logging.info("Dataset found.")
except:
logging.info(f"Dataset does not yet exist, creating a new one from data in folder '{azure_dataset_id}'")
# Ensure that there is a / at the end of the file path, otherwise folder that share a prefix could create
# trouble (for example, folders foo and foo_bar exist, and I'm trying to create a dataset from "foo")
azureml_dataset = Dataset.File.from_files(path=(datastore, azure_dataset_id + "/"))
logging.info("Registering the dataset for future use.")
azureml_dataset.register(workspace, name=azure_dataset_id)
return azureml_dataset

def get_dataset_consumption(self,
azure_dataset_id: str,
dataset_index: int,
mountpoint: str) -> DatasetConsumptionConfig:
"""
Creates a configuration for using an AzureML dataset inside of an AzureML run. This will make the AzureML
dataset with given name available as a named input, using INPUT_DATA_KEY as the key.
:param mountpoint: The path at which the dataset should be made available.
:param azure_dataset_id: The name of the dataset in blob storage to be used for this run. This can be an empty
string to not use any datasets.
:param dataset_index: suffix for the dataset name, dataset name will be set to INPUT_DATA_KEY_idx
"""
status = f"Dataset {azure_dataset_id} (index {dataset_index}) will be "
azureml_dataset = self.get_or_create_dataset(azure_dataset_id=azure_dataset_id)
if not azureml_dataset:
raise ValueError(f"AzureML dataset {azure_dataset_id} could not be found or created.")
named_input = azureml_dataset.as_named_input(f"{INPUT_DATA_KEY}_{dataset_index}")
path_on_compute = mountpoint or None
if self.use_dataset_mount:
status += "mounted at "
result = named_input.as_mount(path_on_compute)
else:
status += "downloaded to "
result = named_input.as_download(path_on_compute)
if path_on_compute:
status += f"{path_on_compute}."
else:
status += "a randomly chosen folder."
logging.info(status)
return result


@dataclass
class SourceConfig:
Expand All @@ -313,13 +252,6 @@ class SourceConfig:
upload_timeout_seconds: int = 36000
environment_variables: Optional[Dict[str, str]] = None

def set_script_params_except_submit_flag(self) -> None:
"""
Populates the script_param field of the present object from the arguments in sys.argv, with the exception
of the "azureml" flag.
"""
self.script_params = remove_arg(AZURECONFIG_SUBMIT_TO_AZUREML, sys.argv[1:])


@dataclass
class ParserResult:
Expand Down
Loading