Skip to content

Commit 729963d

Browse files
nv-dmajchrowskinv-kkudrynski
authored andcommitted
[TSPP] 24.03 Release
1 parent 2788e44 commit 729963d

File tree

552 files changed

+11939
-16353
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

552 files changed

+11939
-16353
lines changed

Tools/PyTorch/TimeSeriesPredictionPlatform/.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@
66
.gitignore
77
Dockerfile
88
.dockerignore
9+
/outputs/
10+
/datasets/
11+
/multirun/
12+
/notebooks/

Tools/PyTorch/TimeSeriesPredictionPlatform/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ __pycache__
33
/outputs/
44
*.zip
55
/datasets/*/
6+
/datasets/
7+
/notebooks/

Tools/PyTorch/TimeSeriesPredictionPlatform/Dockerfile

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
1+
# Copyright 2021-2024 NVIDIA CORPORATION
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
#SPDX-License-Identifier: Apache-2.0
2-
ARG FROM_IMAGE_NAME=nvcr.io/nvidia/pytorch:22.04-py3
16+
ARG FROM_IMAGE_NAME=nvcr.io/nvidia/pytorch:22.12-py3
317

418
FROM ${FROM_IMAGE_NAME}
519

@@ -30,26 +44,31 @@ RUN apt-get update && \
3044
rm -rf /var/lib/apt/lists/*
3145

3246

33-
# Install perf_client required library
3447
RUN apt-get update && \
3548
apt-get install -y libb64-dev libb64-0d curl && \
3649
apt-get clean && \
3750
rm -rf /var/lib/apt/lists/*
3851

39-
# Set workdir and python path
4052
WORKDIR /workspace
4153
ENV PYTHONPATH /workspace
4254

55+
RUN rm /usr/lib/libxgboost.so
56+
4357
ADD requirements.txt /workspace/requirements.txt
4458
ADD triton/requirements.txt /workspace/triton/requirements.txt
4559
RUN pip install -r /workspace/requirements.txt
4660
RUN pip install -r /workspace/triton/requirements.txt
4761
RUN pip install nvidia-pyindex
4862
RUN pip install git+https://github.com/NVIDIA/dllogger#egg=dllogger
49-
RUN pip install --no-cache-dir -r requirements.txt -f https://data.dgl.ai/wheels/repo.html
63+
RUN pip install --no-cache-dir -r requirements.txt
64+
RUN pip install dgl==1.0.1 -f https://data.dgl.ai/wheels/cu117/repo.html
5065

51-
# Add model files to workspace
52-
ADD . /workspace
66+
ADD ./hydra_plugins /workspace/hydra_plugins
67+
RUN pip install /workspace/hydra_plugins/hydra_optuna_sweeper/
68+
RUN pip install /workspace/hydra_plugins/hydra_joblib_launcher/
69+
RUN pip install /workspace/hydra_plugins/hydra_multiprocessing_launcher/
70+
RUN pip install /workspace/hydra_plugins/hydra_torchrun_launcher/
71+
RUN cp /workspace/hydra_plugins/optuna_sweeper.py /usr/local/lib/python3.8/dist-packages/hydra/plugins/sweeper.py
5372

54-
RUN pip install -e distributed_launcher
73+
ADD . /workspace
5574
RUN rm -rf examples docker-examples tutorials

Tools/PyTorch/TimeSeriesPredictionPlatform/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2021-2022 NVIDIA Corporation
189+
Copyright [yyyy] [name of copyright owner]
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

Tools/PyTorch/TimeSeriesPredictionPlatform/NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ This repository contains code from https://github.com/rwightman/pytorch-image-mo
190190
same "printed page" as the copyright notice for easier
191191
identification within third-party archives.
192192

193-
Copyright 2021-2022 NVIDIA Corporation
193+
Copyright [yyyy] [name of copyright owner]
194194

195195
Licensed under the Apache License, Version 2.0 (the "License");
196196
you may not use this file except in compliance with the License.

Tools/PyTorch/TimeSeriesPredictionPlatform/README.md

Lines changed: 429 additions & 108 deletions
Large diffs are not rendered by default.

Tools/PyTorch/TimeSeriesPredictionPlatform/callbacks/callbacks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
1+
# Copyright (c) 2021-2024, NVIDIA CORPORATION. All rights reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# SPDX-License-Identifier: Apache-2.0
1516
class Callback(object):
1617
"""
1718
Base class for building new callbacks.

Tools/PyTorch/TimeSeriesPredictionPlatform/callbacks/ctl_callbacks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
1+
# Copyright (c) 2021-2024, NVIDIA CORPORATION. All rights reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# SPDX-License-Identifier: Apache-2.0
1516
import time
1617

1718
import dllogger

Tools/PyTorch/TimeSeriesPredictionPlatform/callbacks/hydra_callbacks.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
1+
# Copyright (c) 2021-2024, NVIDIA CORPORATION. All rights reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -13,26 +13,27 @@
1313
# limitations under the License.
1414

1515
import os
16+
import mlflow
1617
import pandas as pd
1718

1819
from omegaconf import OmegaConf
1920
from hydra.experimental.callback import Callback
2021

2122
from loggers.log_helper import jsonlog_2_df
23+
from mlflow.entities import Metric, Param
2224

2325
class MergeLogs(Callback):
2426
def on_multirun_end(self, config, **kwargs):
2527
OmegaConf.resolve(config)
2628

27-
ALLOWED_KEYS=['timestamp', 'elapsed_time', 'step', 'loss', 'val_loss', 'MAE', 'MSE', 'RMSE', 'P50', 'P90']
29+
ALLOWED_KEYS=['timestamp', 'elapsed_time', 'step', 'loss', 'val_loss', 'MAE', 'MSE', 'RMSE', 'P50', 'P90', 'SMAPE', 'TDI']
2830

2931
dfs = []
3032
for p, sub_dirs, files in os.walk(config.hydra.sweep.dir):
3133
if 'log.json' in files:
3234
path = os.path.join(p, 'log.json')
3335
df = jsonlog_2_df(path, ALLOWED_KEYS)
3436
dfs.append(df)
35-
3637
# Transpose dataframes
3738
plots = {}
3839
for c in dfs[0].columns:
@@ -49,3 +50,15 @@ def on_multirun_end(self, config, **kwargs):
4950
timestamps = (timestamps * 1000).astype(int)
5051
if not timestamps.is_monotonic:
5152
raise ValueError('Timestamps are not monotonic')
53+
54+
metrics = [Metric('_'.join((k,name)), v, timestamp, step)
55+
for k, df in plots.items()
56+
for timestamp, (step, series) in zip(timestamps, df.iterrows())
57+
for name, v in series.items()
58+
]
59+
client = mlflow.tracking.MlflowClient(tracking_uri=config.trainer.config.mlflow_store)
60+
exp = client.get_experiment_by_name(config.trainer.config.get('experiment_name', ''))
61+
run = client.create_run(exp.experiment_id if exp else '0')
62+
for i in range(0, len(metrics), 1000):
63+
client.log_batch(run.info.run_id, metrics=metrics[i:i+1000])
64+
client.set_terminated(run.info.run_id)

Tools/PyTorch/TimeSeriesPredictionPlatform/conf/conf_utils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
1+
# Copyright (c) 2021-2024, NVIDIA CORPORATION. All rights reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -14,8 +14,10 @@
1414

1515
from omegaconf import OmegaConf
1616
from data.data_utils import InputTypes, DataTypes, FeatureSpec
17+
import functools
18+
from hydra.utils import get_method
1719

18-
OmegaConf.register_new_resolver("and", lambda x, y: x and y, use_cache=True)
20+
OmegaConf.register_new_resolver("and", lambda x, y: bool(x and y), use_cache=True)
1921
OmegaConf.register_new_resolver("feature.selector",
2022
lambda x,feat_type,embed_type:
2123
OmegaConf.create([elem for elem in x if elem.feature_type == feat_type and elem.feature_embed_type == embed_type])
@@ -27,10 +29,12 @@
2729
OmegaConf.register_new_resolver("cmp", lambda x, y: x == y)
2830
OmegaConf.register_new_resolver("cont.lower", lambda x, y: y.lower() in x.lower())
2931

30-
# XXX I don't know whether it is the best idea to allow user to sum over nested structure without checks
3132
def sum_nested(*args):
3233
if len(args) == 1 and isinstance(args[0], (int, float)):
3334
return args[0]
3435
return sum(arg if isinstance(arg, (int, float)) else sum_nested(*arg) for arg in args)
3536

3637
OmegaConf.register_new_resolver("sum", sum_nested)
38+
39+
def partial(func, *args, **kwargs):
40+
return functools.partial(get_method(func), *args, **kwargs)

0 commit comments

Comments
 (0)