-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from san999p/master
Add Tensorflow and PyTorch Training Templates
- Loading branch information
Showing
4 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |