Skip to content

Commit

Permalink
Merge pull request #5 from san999p/master
Browse files Browse the repository at this point in the history
Add Tensorflow and PyTorch Training Templates
  • Loading branch information
rushtehrani authored May 27, 2020
2 parents 164103d + 5bc49fb commit 4a36c4d
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 0 deletions.
Empty file.
74 changes: 74 additions & 0 deletions workflows/pytorch-mnist-training/template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
entrypoint: main
arguments:
parameters:
- name: source
value: https://github.com/onepanelio/pytorch-examples.git
- name: command
value: "python mnist/main.py --epochs=1"
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 2Gi
- metadata:
name: output
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 2Gi
templates:
- name: main
dag:
tasks:
- name: train-model
template: pytorch
- name: notify-in-slack
dependencies: [train-model]
template: slack-notify-success
arguments:
parameters:
- name: status
value: "{{tasks.train-model.status}}"
artifacts:
- name: metrics
from: "{{tasks.train-model.outputs.artifacts.sys-metrics}}"
- name: pytorch
inputs:
artifacts:
- name: src
path: /mnt/src
git:
repo: "{{workflow.parameters.source}}"
outputs:
artifacts:
- name: model
path: /mnt/output
optional: true
archive:
none: {}
container:
image: pytorch/pytorch:latest
command: [sh,-c]
args: ["{{workflow.parameters.command}}"]
workingDir: /mnt/src
volumeMounts:
- name: data
mountPath: /mnt/data
- name: output
mountPath: /mnt/output
- name: slack-notify-success
container:
image: technosophos/slack-notify
command: [sh,-c]
args: ['SLACK_USERNAME=Worker SLACK_TITLE="{{workflow.name}} {{inputs.parameters.status}}" SLACK_ICON=https://www.gravatar.com/avatar/5c4478592fe00878f62f0027be59c1bd SLACK_MESSAGE=$(cat /tmp/metrics.json)} ./slack-notify']
inputs:
parameters:
- name: status
artifacts:
- name: metrics
path: /tmp/metrics.json
optional: true
3 changes: 3 additions & 0 deletions workflows/tensorflow-mnist-training/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Tensorflow sample training template

This is a sample template which uses Tensorflow example available on Github to train a sample model on MNIST dataset.
74 changes: 74 additions & 0 deletions workflows/tensorflow-mnist-training/template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
entrypoint: main
arguments:
parameters:
- name: source
value: https://github.com/onepanelio/tensorflow-examples.git
- name: command
value: "python mnist/main.py --epochs=5"
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 2Gi
- metadata:
name: output
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 2Gi
templates:
- name: main
dag:
tasks:
- name: train-model
template: pytorch
- name: notify-in-slack
dependencies: [train-model]
template: slack-notify-success
arguments:
parameters:
- name: status
value: "{{tasks.train-model.status}}"
artifacts:
- name: metrics
from: "{{tasks.train-model.outputs.artifacts.sys-metrics}}"
- name: pytorch
inputs:
artifacts:
- name: src
path: /mnt/src
git:
repo: "{{workflow.parameters.source}}"
outputs:
artifacts:
- name: model
path: /mnt/output
optional: true
archive:
none: {}
container:
image: tensorflow/tensorflow:latest
command: [sh,-c]
args: ["{{workflow.parameters.command}}"]
workingDir: /mnt/src
volumeMounts:
- name: data
mountPath: /mnt/data
- name: output
mountPath: /mnt/output
- name: slack-notify-success
container:
image: technosophos/slack-notify
command: [sh,-c]
args: ['SLACK_USERNAME=Worker SLACK_TITLE="{{workflow.name}} {{inputs.parameters.status}}" SLACK_ICON=https://www.gravatar.com/avatar/5c4478592fe00878f62f0027be59c1bd SLACK_MESSAGE=$(cat /tmp/metrics.json)} ./slack-notify']
inputs:
parameters:
- name: status
artifacts:
- name: metrics
path: /tmp/metrics.json
optional: true

0 comments on commit 4a36c4d

Please sign in to comment.