Skip to content

Commit

Permalink
fixed pipeline, remoted a step (kubeflow#768)
Browse files Browse the repository at this point in the history
  • Loading branch information
omartin2010 authored Apr 8, 2020
1 parent c337d90 commit 1f9e7a5
Show file tree
Hide file tree
Showing 14 changed files with 12 additions and 200 deletions.
4 changes: 0 additions & 4 deletions pipelines/azurepipeline/code/deploy/aksdeploymentconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion pipelines/azurepipeline/code/deploy/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ while getopts "m:n:i:d:s:p:u:r:w:t:b:" option;
esac
done
az login --service-principal --username ${SERVICE_PRINCIPAL_ID} --password ${SERVICE_PRINCIPAL_PASSWORD} -t $TENANT_ID
az ml model deploy -n $MODEL_NAME -m ${MODEL}:1 --ic $INFERENCE_CONFIG --pi ${BASE_PATH}/myprofileresult.json --dc $DEPLOYMENTCONFIG -w $WORKSPACE -g $RESOURCE_GROUP --overwrite -v
az ml model deploy -n $MODEL_NAME -m ${MODEL}:1 --ic $INFERENCE_CONFIG --dc $DEPLOYMENTCONFIG -w $WORKSPACE -g $RESOURCE_GROUP --overwrite -v
31 changes: 5 additions & 26 deletions pipelines/azurepipeline/code/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def tacosandburritos_train(
# preprocess data
operations['preprocess'] = dsl.ContainerOp(
name='preprocess',
image='insert your image here',
image='insert image name:tag',
command=['python'],
arguments=[
'/scripts/data.py',
Expand All @@ -48,7 +48,7 @@ def tacosandburritos_train(
# train
operations['training'] = dsl.ContainerOp(
name='training',
image='insert your image here',
image='insert image name:tag',
command=['python'],
arguments=[
'/scripts/train.py',
Expand All @@ -67,7 +67,7 @@ def tacosandburritos_train(
# register model
operations['register'] = dsl.ContainerOp(
name='register',
image='insert your image here',
image='insert image name:tag',
command=['python'],
arguments=[
'/scripts/register.py',
Expand All @@ -84,30 +84,9 @@ def tacosandburritos_train(
)
operations['register'].after(operations['training'])

operations['profile'] = dsl.ContainerOp(
name='profile',
image='insert your image here',
command=['sh'],
arguments=[
'/scripts/profile.sh',
'-n', profile_name,
'-m', model_name,
'-i', '/scripts/inferenceconfig.json',
'-d', '{"image":"https://www.exploreveg.org/files/2015/05/sofritas-burrito.jpeg"}',
'-t', tenant_id,
'-r', resource_group,
'-w', workspace,
'-s', service_principal_id,
'-p', service_principal_password,
'-u', subscription_id,
'-b', persistent_volume_path
]
)
operations['profile'].after(operations['register'])

operations['deploy'] = dsl.ContainerOp(
name='deploy',
image='insert your image here',
image='insert image name:tag',
command=['sh'],
arguments=[
'/scripts/deploy.sh',
Expand All @@ -124,7 +103,7 @@ def tacosandburritos_train(
'-b', persistent_volume_path
]
)
operations['deploy'].after(operations['profile'])
operations['deploy'].after(operations['register'])
for _, op_1 in operations.items():
op_1.container.set_image_pull_policy("Always")
op_1.add_volume(
Expand Down
2 changes: 1 addition & 1 deletion pipelines/azurepipeline/code/preprocess/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM tensorflow/tensorflow:2.0.0a0-gpu-py3
FROM tensorflow/tensorflow:2.0.0a0-py3

# pip install
COPY requirements.txt /scripts/requirements.txt
Expand Down
12 changes: 0 additions & 12 deletions pipelines/azurepipeline/code/profile/Dockerfile

This file was deleted.

9 changes: 0 additions & 9 deletions pipelines/azurepipeline/code/profile/build.sh

This file was deleted.

19 changes: 0 additions & 19 deletions pipelines/azurepipeline/code/profile/environment.yml

This file was deleted.

10 changes: 0 additions & 10 deletions pipelines/azurepipeline/code/profile/inferenceconfig.json

This file was deleted.

21 changes: 0 additions & 21 deletions pipelines/azurepipeline/code/profile/profile.sh

This file was deleted.

3 changes: 0 additions & 3 deletions pipelines/azurepipeline/code/profile/requirements.txt

This file was deleted.

89 changes: 0 additions & 89 deletions pipelines/azurepipeline/code/profile/score.py

This file was deleted.

4 changes: 2 additions & 2 deletions pipelines/azurepipeline/code/register/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def run(mdl_path, model_name, ws, tgs):
if i == 'service_principal_password':
print('{} => **********'.format(i))
else:
print('{} => {}'.format(i, rgs[i]))
print('{} => {}'.format(i, wsrgs[i]))

with(open(str(params_path), 'r')) as f:
tags = json.load(f)
Expand All @@ -91,7 +91,7 @@ def run(mdl_path, model_name, ws, tgs):
for tag in tags:
print('{} => {}'.format(tag, tags[tag]))

rgs['tags'] = tags
rgs['tgs'] = tags

workspc = get_ws(**wsrgs)
rgs['ws'] = workspc
Expand Down
3 changes: 1 addition & 2 deletions pipelines/azurepipeline/code/training/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
FROM tensorflow/tensorflow:2.0.0a0-gpu-py3
FROM tensorflow/tensorflow:2.0.0a0-py3

# pip install
COPY requirements.txt /scripts/requirements.txt
RUN pip install -r /scripts/requirements.txt

COPY train.py /scripts/train.py

# python train.py -d data/PetImages -e 1 -b 32 -l 0.0001 -o model -f dataset.txt
# will be overwritten by kf pipeline
ENTRYPOINT [ "python", \
"/scripts/train.py", \
Expand Down
3 changes: 2 additions & 1 deletion pipelines/azurepipeline/code/training/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ def run(
# training data
train_data, train_labels = zip(*train)
train_ds = Dataset.zip((Dataset.from_tensor_slices(list(train_data)),
Dataset.from_tensor_slices(list(train_labels)), img_size))
Dataset.from_tensor_slices(list(train_labels)),
Dataset.from_tensor_slices([img_size]*len(train_data))))

train_ds = train_ds.map(map_func=process_image,
num_parallel_calls=5)
Expand Down

0 comments on commit 1f9e7a5

Please sign in to comment.