Skip to content

Commit 084511e

Browse files
d4l3kfacebook-github-bot
authored andcommitted
kfpint: save tensorboard logs to same location as outputs (#57)
Summary: We currently save tensorboard logs to /tmp in the integration tests. Change it to we save them to remote location with the rest of the outputs. Pull Request resolved: #57 Test Plan: ``` script/kfpint.py pytest ``` http://5ab6bab9-istiosystem-istio-2af2-1926929629.us-west-2.elb.amazonaws.com/_/pipeline/#/runs/details/5ebc75a7-70f9-406b-8803-e36371cefb62 Reviewed By: kiukchung Differential Revision: D29118484 Pulled By: d4l3k fbshipit-source-id: 154e3f9537d73900e60dc47394d0dd858506211a
1 parent 5aed31f commit 084511e

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

examples/apps/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM pytorch/pytorch
22

3-
RUN pip install classy_vision pytorch-lightning fsspec[s3] torch-model-archiver captum
3+
RUN pip install classy_vision pytorch-lightning fsspec[s3] torch-model-archiver captum boto3
44

55
WORKDIR /app
66

examples/apps/lightning_classy_vision/component.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def trainer(
2323
output_path: str,
2424
data_path: str,
2525
load_path: str = "",
26-
log_dir: str = "/logs",
26+
log_path: str = "/logs",
2727
resource: Optional[str] = None,
2828
) -> torchx.AppDef:
2929
"""Runs the example lightning_classy_vision app.
@@ -33,7 +33,7 @@ def trainer(
3333
output_path: output path for model checkpoints (e.g. file:///foo/bar)
3434
load_path: path to load pretrained model from
3535
data_path: path to the data to load
36-
log_dir: path to save tensorboard logs to
36+
log_path: path to save tensorboard logs to
3737
resource: the resources to use
3838
"""
3939
return binary_component(
@@ -44,8 +44,8 @@ def trainer(
4444
output_path,
4545
"--load_path",
4646
load_path,
47-
"--log_dir",
48-
log_dir,
47+
"--log_pat",
48+
log_path,
4949
"--data_path",
5050
data_path,
5151
],

examples/apps/lightning_classy_vision/train.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ def parse_args(argv: List[str]) -> argparse.Namespace:
5353
required=True,
5454
)
5555
parser.add_argument(
56-
"--log_dir", type=str, help="directory to place the logs", default="/tmp"
56+
"--log_path",
57+
type=str,
58+
help="path to place the tensorboard logs",
59+
default="/tmp",
5760
)
5861

5962
return parser.parse_args(argv)
@@ -84,7 +87,7 @@ def main(argv: List[str]) -> None:
8487
model.load_from_checkpoint(checkpoint_path=args.load_path)
8588

8689
logger = TensorBoardLogger(
87-
save_dir=args.log_dir, version=1, name="lightning_logs"
90+
save_dir=args.log_path, version=1, name="lightning_logs"
8891
)
8992

9093
# Initialize a trainer

examples/pipelines/kfp/kfp_pipeline.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
required=True,
6565
)
6666
parser.add_argument(
67-
"--log_dir", type=str, help="directory to place the logs", default="/tmp"
67+
"--log_path", type=str, help="path to place the tensorboard logs", default="/tmp"
6868
)
6969

7070
# %%
@@ -147,8 +147,8 @@
147147
args.output_path,
148148
"--load_path",
149149
args.load_path or "",
150-
"--log_dir",
151-
args.log_dir,
150+
"--log_path",
151+
args.log_path,
152152
"--data_path",
153153
args.data_path,
154154
],

scripts/kfpint.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ def save_spec(path: str, build: BuildInfo) -> None:
187187
root = os.path.join(STORAGE_PATH, id)
188188
data = os.path.join(root, "data")
189189
output = os.path.join(root, "output")
190+
logs = os.path.join(root, "logs")
190191

191192
run(
192193
"examples/pipelines/kfp/kfp_pipeline.py",
@@ -196,6 +197,8 @@ def save_spec(path: str, build: BuildInfo) -> None:
196197
output,
197198
"--image",
198199
examples_image,
200+
"--log_path",
201+
logs,
199202
"--package_path",
200203
path,
201204
"--torchx_image",

0 commit comments

Comments
 (0)