-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
tensorboard_component.yaml
58 lines (56 loc) · 2.12 KB
/
tensorboard_component.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env/python3
# Copyright (c) Facebook, Inc. and its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Create Tensorboard visualization
description: |
Pre-creates Tensorboard visualization for a given Log dir URI.
This way the Tensorboard can be viewed before the training completes.
The output Log dir URI should be passed to a trainer component that will write Tensorboard logs to that directory.
inputs:
- {name: Log dir URI, description: 'Tensorboard log path'}
- {name: Image, default: '', description: 'Tensorboard docker image'}
- {name: Pod Template Spec, default: 'null', description: 'Pod template specification'}
outputs:
- {name: Log dir URI, description: 'Tensorboard log output'}
- {name: MLPipeline UI Metadata, description: 'MLPipeline UI Metadata output'}
implementation:
container:
image: public.ecr.aws/pytorch-samples/alpine:latest
command:
- sh
- -ex
- -c
- |
log_dir="$0"
output_log_dir_path="$1"
output_metadata_path="$2"
pod_template_spec="$3"
image="$4"
mkdir -p "$(dirname "$output_log_dir_path")"
mkdir -p "$(dirname "$output_metadata_path")"
echo "$log_dir" > "$output_log_dir_path"
echo '
{
"outputs" : [{
"type": "tensorboard",
"source": "'"$log_dir"'",
"image": "'"$image"'",
"pod_template_spec": '"$pod_template_spec"'
}]
}
' >"$output_metadata_path"
- {inputValue: Log dir URI}
- {outputPath: Log dir URI}
- {outputPath: MLPipeline UI Metadata}
- {inputValue: Pod Template Spec}
- {inputValue: Image}