Compare commits
6 Commits
release_up
...
release_up
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
73afd0ae54 | ||
|
|
388111cedc | ||
|
|
b86191ed7f | ||
|
|
22753486de | ||
|
|
cf1d1dbf01 | ||
|
|
2e45d9800d |
@@ -17,6 +17,7 @@ dependencies:
|
|||||||
- notebook
|
- notebook
|
||||||
- pywin32==227
|
- pywin32==227
|
||||||
- PySocks==1.7.1
|
- PySocks==1.7.1
|
||||||
|
- jsonschema==4.5.1
|
||||||
- conda-forge::pyqt==5.12.3
|
- conda-forge::pyqt==5.12.3
|
||||||
|
|
||||||
- pip:
|
- pip:
|
||||||
|
|||||||
@@ -513,13 +513,7 @@
|
|||||||
"conda_run_config.environment.docker.enabled = True\n",
|
"conda_run_config.environment.docker.enabled = True\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# specify CondaDependencies obj\n",
|
"# specify CondaDependencies obj\n",
|
||||||
"conda_run_config.environment.python.conda_dependencies = (\n",
|
"conda_run_config.environment = automl_run.get_environment()"
|
||||||
" automl_run.get_environment().python.conda_dependencies\n",
|
|
||||||
")\n",
|
|
||||||
"\n",
|
|
||||||
"conda_run_config.environment.python.conda_dependencies.add_pip_package(\n",
|
|
||||||
" \"dotnetcore2==2.1.23\"\n",
|
|
||||||
")"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -648,28 +642,6 @@
|
|||||||
")"
|
")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"cell_type": "markdown",
|
|
||||||
"metadata": {},
|
|
||||||
"source": [
|
|
||||||
"### Create the conda dependencies for setting up the service\n",
|
|
||||||
"We need to create the conda dependencies comprising of the *azureml* packages using the training environment from the *automl_run*."
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"conda_dep = automl_run.get_environment().python.conda_dependencies\n",
|
|
||||||
"\n",
|
|
||||||
"with open(\"myenv.yml\", \"w\") as f:\n",
|
|
||||||
" f.write(conda_dep.serialize_to_string())\n",
|
|
||||||
"with open(\"myenv.yml\", \"r\") as f:\n",
|
|
||||||
" print(f.read())"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@@ -692,7 +664,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"### Deploy the service\n",
|
"### Deploy the service\n",
|
||||||
"In the cell below, we deploy the service using the conda file and the scoring file from the previous steps. "
|
"In the cell below, we deploy the service using the automl training environment and the scoring file from the previous steps. "
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -714,7 +686,7 @@
|
|||||||
" description=\"Get local explanations for Machine test data\",\n",
|
" description=\"Get local explanations for Machine test data\",\n",
|
||||||
")\n",
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"myenv = Environment.from_conda_specification(name=\"myenv\", file_path=\"myenv.yml\")\n",
|
"myenv = automl_run.get_environment()\n",
|
||||||
"inference_config = InferenceConfig(entry_script=\"score_explain.py\", environment=myenv)\n",
|
"inference_config = InferenceConfig(entry_script=\"score_explain.py\", environment=myenv)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Use configs and models generated above\n",
|
"# Use configs and models generated above\n",
|
||||||
|
|||||||
@@ -361,7 +361,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"batch_conda_deps = CondaDependencies.create(python_version=\"3.7\",\n",
|
"batch_conda_deps = CondaDependencies.create(python_version=\"3.7\",\n",
|
||||||
" conda_packages=['pip==20.2.4'],\n",
|
" conda_packages=['pip==20.2.4'],\n",
|
||||||
" pip_packages=[\"tensorflow==1.15.2\", \"pillow\", \n",
|
" pip_packages=[\"tensorflow==1.15.2\", \"pillow\", \"protobuf==3.20.1\",\n",
|
||||||
" \"azureml-core\", \"azureml-dataset-runtime[fuse]\"])\n",
|
" \"azureml-core\", \"azureml-dataset-runtime[fuse]\"])\n",
|
||||||
"batch_env = Environment(name=\"batch_environment\")\n",
|
"batch_env = Environment(name=\"batch_environment\")\n",
|
||||||
"batch_env.python.conda_dependencies = batch_conda_deps\n",
|
"batch_env.python.conda_dependencies = batch_conda_deps\n",
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ RUN pip install azureml-core
|
|||||||
RUN pip install ray==0.8.7
|
RUN pip install ray==0.8.7
|
||||||
RUN pip install ray[rllib,tune,serve]==0.8.7
|
RUN pip install ray[rllib,tune,serve]==0.8.7
|
||||||
RUN pip install tensorflow==1.14.0
|
RUN pip install tensorflow==1.14.0
|
||||||
|
RUN pip install 'msrest<0.7.0'
|
||||||
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get install -y jq
|
RUN apt-get install -y jq
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ RUN pip install gym[atari]==0.19.0
|
|||||||
RUN pip install gym[accept-rom-license]==0.19.0
|
RUN pip install gym[accept-rom-license]==0.19.0
|
||||||
|
|
||||||
# Install pip dependencies
|
# Install pip dependencies
|
||||||
RUN HOROVOD_WITH_TENSORFLOW=1 \
|
RUN pip install 'matplotlib>=3.3,<3.4' \
|
||||||
pip install 'matplotlib>=3.3,<3.4' \
|
|
||||||
'psutil>=5.8,<5.9' \
|
'psutil>=5.8,<5.9' \
|
||||||
'tqdm>=4.59,<4.60' \
|
'tqdm>=4.59,<4.60' \
|
||||||
'pandas>=1.1,<1.2' \
|
'pandas>=1.1,<1.2' \
|
||||||
@@ -70,6 +69,8 @@ RUN pip install --no-cache-dir \
|
|||||||
# This is required for ray 0.8.7
|
# This is required for ray 0.8.7
|
||||||
RUN pip install -U aiohttp==3.7.4
|
RUN pip install -U aiohttp==3.7.4
|
||||||
|
|
||||||
|
RUN pip install 'msrest<0.7.0'
|
||||||
|
|
||||||
# This is needed for mpi to locate libpython
|
# This is needed for mpi to locate libpython
|
||||||
ENV LD_LIBRARY_PATH $AZUREML_CONDA_ENVIRONMENT_PATH/lib:$LD_LIBRARY_PATH
|
ENV LD_LIBRARY_PATH $AZUREML_CONDA_ENVIRONMENT_PATH/lib:$LD_LIBRARY_PATH
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ RUN pip install azureml-dataset-runtime
|
|||||||
RUN pip install ray==0.8.7
|
RUN pip install ray==0.8.7
|
||||||
RUN pip install ray[rllib,tune,serve]==0.8.7
|
RUN pip install ray[rllib,tune,serve]==0.8.7
|
||||||
RUN pip install tensorflow==1.14.0
|
RUN pip install tensorflow==1.14.0
|
||||||
|
RUN pip install 'msrest<0.7.0'
|
||||||
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get install -y jq
|
RUN apt-get install -y jq
|
||||||
|
|||||||
@@ -30,5 +30,9 @@ RUN pip install ray-on-aml==0.1.6 & \
|
|||||||
conda install -y -c conda-forge x264='1!152.20180717' ffmpeg=4.0.2 && \
|
conda install -y -c conda-forge x264='1!152.20180717' ffmpeg=4.0.2 && \
|
||||||
conda install -c anaconda opencv
|
conda install -c anaconda opencv
|
||||||
|
|
||||||
|
RUN pip install protobuf==3.20.0
|
||||||
|
|
||||||
RUN pip install --upgrade ray==0.8.3 \
|
RUN pip install --upgrade ray==0.8.3 \
|
||||||
ray[rllib,dashboard,tune]==0.8.3
|
ray[rllib,dashboard,tune]==0.8.3
|
||||||
|
|
||||||
|
RUN pip install 'msrest<0.7.0'
|
||||||
@@ -28,7 +28,11 @@ RUN cd multiagent-particle-envs && \
|
|||||||
|
|
||||||
RUN pip3 install ray-on-aml==0.1.6
|
RUN pip3 install ray-on-aml==0.1.6
|
||||||
|
|
||||||
|
RUN pip install protobuf==3.20.0
|
||||||
|
|
||||||
RUN pip3 install --upgrade \
|
RUN pip3 install --upgrade \
|
||||||
ray==0.8.7 \
|
ray==0.8.7 \
|
||||||
ray[rllib]==0.8.7 \
|
ray[rllib]==0.8.7 \
|
||||||
ray[tune]==0.8.7
|
ray[tune]==0.8.7
|
||||||
|
|
||||||
|
RUN pip install 'msrest<0.7.0'
|
||||||
@@ -5,17 +5,19 @@ import os
|
|||||||
import argparse
|
import argparse
|
||||||
import datetime
|
import datetime
|
||||||
import time
|
import time
|
||||||
import tensorflow as tf
|
import tensorflow.compat.v1 as tf
|
||||||
from math import ceil
|
from math import ceil
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import sys
|
||||||
import shutil
|
import shutil
|
||||||
from tensorflow.contrib.slim.python.slim.nets import inception_v3
|
import subprocess
|
||||||
|
import tf_slim
|
||||||
|
|
||||||
from azureml.core import Run
|
from azureml.core import Run
|
||||||
from azureml.core.model import Model
|
from azureml.core.model import Model
|
||||||
from azureml.core.dataset import Dataset
|
from azureml.core.dataset import Dataset
|
||||||
|
|
||||||
slim = tf.contrib.slim
|
slim = tf_slim
|
||||||
|
|
||||||
image_size = 299
|
image_size = 299
|
||||||
num_channel = 3
|
num_channel = 3
|
||||||
@@ -32,16 +34,18 @@ def get_class_label_dict(labels_dir):
|
|||||||
|
|
||||||
def init():
|
def init():
|
||||||
global g_tf_sess, probabilities, label_dict, input_images
|
global g_tf_sess, probabilities, label_dict, input_images
|
||||||
|
subprocess.run(["git", "clone", "https://github.com/tensorflow/models/"])
|
||||||
|
sys.path.append("./models/research/slim")
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="Start a tensorflow model serving")
|
parser = argparse.ArgumentParser(description="Start a tensorflow model serving")
|
||||||
parser.add_argument('--model_name', dest="model_name", required=True)
|
parser.add_argument('--model_name', dest="model_name", required=True)
|
||||||
parser.add_argument('--labels_dir', dest="labels_dir", required=True)
|
parser.add_argument('--labels_dir', dest="labels_dir", required=True)
|
||||||
args, _ = parser.parse_known_args()
|
args, _ = parser.parse_known_args()
|
||||||
|
from nets import inception_v3, inception_utils
|
||||||
label_dict = get_class_label_dict(args.labels_dir)
|
label_dict = get_class_label_dict(args.labels_dir)
|
||||||
classes_num = len(label_dict)
|
classes_num = len(label_dict)
|
||||||
|
tf.disable_v2_behavior()
|
||||||
with slim.arg_scope(inception_v3.inception_v3_arg_scope()):
|
with slim.arg_scope(inception_utils.inception_arg_scope()):
|
||||||
input_images = tf.placeholder(tf.float32, [1, image_size, image_size, num_channel])
|
input_images = tf.placeholder(tf.float32, [1, image_size, image_size, num_channel])
|
||||||
logits, _ = inception_v3.inception_v3(input_images,
|
logits, _ = inception_v3.inception_v3(input_images,
|
||||||
num_classes=classes_num,
|
num_classes=classes_num,
|
||||||
|
|||||||
@@ -247,7 +247,7 @@
|
|||||||
" config = AmlCompute.provisioning_configuration(vm_size=\"STANDARD_NC6\",\n",
|
" config = AmlCompute.provisioning_configuration(vm_size=\"STANDARD_NC6\",\n",
|
||||||
" vm_priority=\"lowpriority\", \n",
|
" vm_priority=\"lowpriority\", \n",
|
||||||
" min_nodes=0, \n",
|
" min_nodes=0, \n",
|
||||||
" max_nodes=1)\n",
|
" max_nodes=2)\n",
|
||||||
"\n",
|
"\n",
|
||||||
" compute_target = ComputeTarget.create(workspace=ws, name=compute_name, provisioning_configuration=config)\n",
|
" compute_target = ComputeTarget.create(workspace=ws, name=compute_name, provisioning_configuration=config)\n",
|
||||||
" compute_target.wait_for_completion(show_output=True, min_node_count=None, timeout_in_minutes=20)"
|
" compute_target.wait_for_completion(show_output=True, min_node_count=None, timeout_in_minutes=20)"
|
||||||
@@ -305,9 +305,10 @@
|
|||||||
"from azureml.core.conda_dependencies import CondaDependencies\n",
|
"from azureml.core.conda_dependencies import CondaDependencies\n",
|
||||||
"from azureml.core.runconfig import DEFAULT_GPU_IMAGE\n",
|
"from azureml.core.runconfig import DEFAULT_GPU_IMAGE\n",
|
||||||
"\n",
|
"\n",
|
||||||
"cd = CondaDependencies.create(python_version=\"3.7\",\n",
|
"cd = CondaDependencies.create(python_version=\"3.8\",\n",
|
||||||
" conda_packages=['pip==20.2.4'],\n",
|
" conda_packages=['pip==20.2.4'],\n",
|
||||||
" pip_packages=[\"tensorflow-gpu==1.15.2\",\n",
|
" pip_packages=[\"tensorflow-gpu==2.3.0\",\n",
|
||||||
|
" \"tf_slim==1.1.0\", \"protobuf==3.20.1\",\n",
|
||||||
" \"azureml-core\", \"azureml-dataset-runtime[fuse]\"])\n",
|
" \"azureml-core\", \"azureml-dataset-runtime[fuse]\"])\n",
|
||||||
"\n",
|
"\n",
|
||||||
"env = Environment(name=\"parallelenv\")\n",
|
"env = Environment(name=\"parallelenv\")\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user