fix path in jobs and specs (#143)
* fix path in jobs and specs * add PYTHONPATH hack to both runnable files * ignore E402
This commit is contained in:
Родитель
49e49ae21a
Коммит
a1a36f636e
|
@ -12,6 +12,7 @@ Using your editor, search for those strings to get an idea of how to implement:
|
|||
- MLFLOW : how to implement mlflow reporting of metrics and artifacts
|
||||
- PROFILER : how to implement pytorch profiler
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import logging
|
||||
|
@ -24,16 +25,22 @@ import mlflow
|
|||
# the long list of torch imports
|
||||
import torch
|
||||
|
||||
# fix to AzureML PYTHONPATH
|
||||
ROOT_FOLDER_PATH = os.path.join(os.path.dirname(__file__), "..")
|
||||
if ROOT_FOLDER_PATH not in sys.path:
|
||||
print(f"Adding root folder to PYTHONPATH: {ROOT_FOLDER_PATH}")
|
||||
sys.path.append(ROOT_FOLDER_PATH)
|
||||
|
||||
# internal imports
|
||||
## non-specific helper code
|
||||
from common.profiling import LogTimeBlock, LogDiskIOBlock
|
||||
from common.profiling import LogTimeBlock, LogDiskIOBlock # noqa : E402
|
||||
|
||||
## pytorch generic helping code
|
||||
from pytorch_benchmark.helper.training import PyTorchDistributedModelTrainingSequence
|
||||
from pytorch_benchmark.helper.training import PyTorchDistributedModelTrainingSequence # noqa : E402
|
||||
|
||||
## classification specific code
|
||||
from pytorch_benchmark.classification.model import get_model_metadata, load_model
|
||||
from pytorch_benchmark.classification.io import build_image_datasets
|
||||
from pytorch_benchmark.classification.model import get_model_metadata, load_model # noqa : E402
|
||||
from pytorch_benchmark.classification.io import build_image_datasets # noqa : E402
|
||||
|
||||
SCRIPT_START_TIME = time.time() # just to measure time to start
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ Using your editor, search for those strings to get an idea of how to implement:
|
|||
- DISTRIBUTED : how to implement distributed tensorflow
|
||||
- MLFLOW : how to implement mlflow reporting of metrics and artifacts
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import logging
|
||||
import argparse
|
||||
|
@ -22,16 +24,22 @@ import mlflow
|
|||
import tensorflow as tf
|
||||
from tensorflow import keras
|
||||
|
||||
# fix to AzureML PYTHONPATH
|
||||
ROOT_FOLDER_PATH = os.path.join(os.path.dirname(__file__), "..")
|
||||
if ROOT_FOLDER_PATH not in sys.path:
|
||||
print(f"Adding root folder to PYTHONPATH: {ROOT_FOLDER_PATH}")
|
||||
sys.path.append(ROOT_FOLDER_PATH)
|
||||
|
||||
# internal imports
|
||||
## non-specific helper code
|
||||
from common.profiling import LogTimeBlock, LogDiskIOBlock
|
||||
from common.profiling import LogTimeBlock, LogDiskIOBlock # noqa : E402
|
||||
|
||||
## tensorflow generic helping code
|
||||
from tensorflow_benchmark.helper.training import TensorflowDistributedModelTrainingSequence
|
||||
from tensorflow_benchmark.helper.training import TensorflowDistributedModelTrainingSequence # noqa : E402
|
||||
|
||||
## classification specific code
|
||||
from tensorflow_benchmark.segmentation.model import load_model
|
||||
from tensorflow_benchmark.segmentation.io import ImageAndMaskSequenceDataset
|
||||
from tensorflow_benchmark.segmentation.model import load_model # noqa : E402
|
||||
from tensorflow_benchmark.segmentation.io import ImageAndMaskSequenceDataset # noqa : E402
|
||||
|
||||
|
||||
SCRIPT_START_TIME = time.time() # just to measure time to start
|
||||
|
|
|
@ -104,7 +104,7 @@ code: ../
|
|||
environment: azureml:nvidia_tensorflow:22.02-tf2-py3-mod3
|
||||
|
||||
command: >-
|
||||
python train.py
|
||||
python tensorflow_benchmark/image_segmentation.py
|
||||
--train_images ${{inputs.train_images}}
|
||||
--train_masks ${{inputs.train_masks}}
|
||||
--test_images ${{inputs.test_images}}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
$schema: https://azuremlschemas.azureedge.net/latest/commandJob.schema.json
|
||||
code: ../../components/tensorflow_image_segmentation/
|
||||
code: ../../components/
|
||||
|
||||
display_name: "tf_unet"
|
||||
experiment_name: "tensorflow_unet_pets"
|
||||
|
@ -73,7 +73,7 @@ outputs:
|
|||
###############
|
||||
|
||||
command: >-
|
||||
python train.py
|
||||
python tensorflow_benchmark/image_segmentation.py
|
||||
--train_images ${{inputs.train_images}}
|
||||
--train_masks ${{inputs.train_masks}}
|
||||
--test_images ${{inputs.test_images}}
|
||||
|
|
|
@ -14,12 +14,12 @@ compute: azureml:gpu-cluster
|
|||
|
||||
|
||||
trial:
|
||||
code: ../../components/tensorflow_image_segmentation/
|
||||
code: ../../components/
|
||||
|
||||
### COMMAND ###
|
||||
|
||||
command: >-
|
||||
python train.py
|
||||
python tensorflow_benchmark/image_segmentation.py
|
||||
--train_images ${{inputs.train_images}}
|
||||
--train_masks ${{inputs.train_masks}}
|
||||
--test_images ${{inputs.test_images}}
|
||||
|
|
Загрузка…
Ссылка в новой задаче