Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit 90dd316

Browse files
author
DEKHTIARJonathan
committed
[Benchmarking-Py] 1.2.0 - Adding Metric Push to Remote
1 parent 553c18e commit 90dd316

File tree

34 files changed

+366
-39
lines changed

34 files changed

+366
-39
lines changed

tftrt/benchmarking-python/CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ Description of the change
4646

4747
<!-- YOU CAN EDIT FROM HERE -->
4848

49+
## [1.2.0] - 2022.07.31 - @DEKHTIARJonathan
50+
51+
Setting up the benchmarking suite to allow remote upload and storage of the
52+
metrics and experiments.
53+
54+
Adding arguments:
55+
* `--model_name`: Name of the model being executed.
56+
* `--model_source`: Name of the model's source that originally published the model.
57+
* `--experiment_name`: Name of the experiment being conducted.
58+
* `--upload_metrics_endpoint`: Distant endpoint being used to push metrics to.
59+
4960
## [1.1.0] - 2022.07.25 - @DEKHTIARJonathan
5061

5162
Replacing all `print()` calls by `logging.<level>()` calls

tftrt/benchmarking-python/benchmark_args.py

+49-10
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,15 @@ def __init__(self):
175175
"generated and used at every iteration."
176176
)
177177

178+
self._parser.add_argument(
179+
"--precision",
180+
type=str,
181+
choices=self.ALLOWED_PRECISION_MODES,
182+
default="FP32",
183+
help="Precision mode to use. FP16 and INT8 modes only works if "
184+
"--use_tftrt is used."
185+
)
186+
178187
# =========================== TF-TRT Flags ========================== #
179188

180189
self._add_bool_argument(
@@ -232,23 +241,38 @@ def __init__(self):
232241
help="If set to True, TensorRT engines are built before runtime."
233242
)
234243

235-
self._parser.add_argument(
236-
"--precision",
237-
type=str,
238-
choices=self.ALLOWED_PRECISION_MODES,
239-
default="FP32",
240-
help="Precision mode to use. FP16 and INT8 modes only works if "
241-
"--use_tftrt is used."
242-
)
243-
244244
self._add_bool_argument(
245245
name="use_dynamic_shape",
246246
default=False,
247247
required=False,
248248
help="Whether to use implicit batch mode or dynamic shape mode."
249249
)
250250

251-
# =========================== DEBUG Flags ========================== #
251+
# =========================== Metric Flags ========================== #
252+
253+
self._parser.add_argument(
254+
"--experiment_name",
255+
type=str,
256+
default=None,
257+
help="Name of the experiment being run, only used for archiving "
258+
"objectives: exports in JSON or CSV."
259+
)
260+
261+
self._parser.add_argument(
262+
"--model_name",
263+
type=str,
264+
required=True,
265+
default=None,
266+
help="Name of the model being benchmarked."
267+
)
268+
269+
self._parser.add_argument(
270+
"--model_source",
271+
type=str,
272+
required=True,
273+
default=None,
274+
help="Source of the model where it was originally published."
275+
)
252276

253277
self._parser.add_argument(
254278
"--export_metrics_json_path",
@@ -266,6 +290,16 @@ def __init__(self):
266290
"to the set location in CSV format for further processing."
267291
)
268292

293+
self._parser.add_argument(
294+
"--upload_metrics_endpoint",
295+
type=str,
296+
default=None,
297+
help="If set, the benchmark will upload the metrics in JSON format "
298+
"to the set endpoint using a PUT requests."
299+
)
300+
301+
# =========================== TF Profiling =========================== #
302+
269303
self._parser.add_argument(
270304
"--tf_profile_export_path",
271305
type=str,
@@ -281,6 +315,8 @@ def __init__(self):
281315
help="If set to True, will add extra information to the TF Profile."
282316
)
283317

318+
# ============================ Debug Flags =========================== #
319+
284320
self._add_bool_argument(
285321
name="debug",
286322
default=False,
@@ -388,6 +424,9 @@ def _validate_args(self, args):
388424
"doesn't exist or is not a directory"
389425
)
390426

427+
if args.upload_metrics_endpoint is not None:
428+
raise NotImplementedError("This feature is not yet implemented.")
429+
391430
def _post_process_args(self, args):
392431
if args.use_synthetic_data:
393432
# This variable is not used in synthetic data mode.

tftrt/benchmarking-python/benchmark_info.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# The `__version__` number shall be updated everytime core benchmarking files
1111
# are updated.
1212
# Please update CHANGELOG.md with a description of what this version changed.
13-
__version__ = "1.1.0"
13+
__version__ = "1.2.0"
1414

1515

1616
def get_commit_id():

tftrt/benchmarking-python/huggingface/bert/base_run_inference.sh

+2
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ python ${BASE_DIR}/infer.py \
143143
--calib_data_dir ${DATA_DIR} \
144144
--input_saved_model_dir ${INPUT_SAVED_MODEL_DIR} \
145145
--output_saved_model_dir /tmp/$RANDOM \
146+
--model_name "${MODEL_NAME}" \
147+
--model_source "huggingface" \
146148
--batch_size ${BATCH_SIZE} \
147149
--vocab_size ${VOCAB_SIZE} \
148150
--sequence_length=${SEQ_LEN} \

tftrt/benchmarking-python/huggingface/gpt2/base_run_inference.sh

+2
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ python ${BASE_DIR}/infer.py \
105105
--data_dir=${DATA_DIR} \
106106
--calib_data_dir=${DATA_DIR} \
107107
--input_saved_model_dir=${MODEL_DIR} \
108+
--model_name "${MODEL_NAME}" \
109+
--model_source "huggingface" \
108110
--tokenizer_model_dir=${TOKENIZER_DIR} \
109111
--batch_size=${BATCH_SIZE} \
110112
--sequence_length=${SEQ_LEN} \

tftrt/benchmarking-python/huggingface/t5/base_run_inference.sh

+2
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ python ${BASE_DIR}/infer.py \
116116
--data_dir=${DATA_DIR} \
117117
--calib_data_dir=${DATA_DIR} \
118118
--input_saved_model_dir=${MODEL_DIR} \
119+
--model_name "${MODEL_NAME}" \
120+
--model_source "huggingface" \
119121
--tokenizer_model_dir=${TOKENIZER_DIR}\
120122
--vocab_model_dir=${TOKENIZER_DIR}\
121123
--output_tensors_name=${OUTPUT_TENSOR_NAMES} \

tftrt/benchmarking-python/image_classification/base_run_inference.sh

+2-6
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ case ${MODEL_NAME} in
7979
NUM_CLASSES=1000
8080
;;
8181

82-
"resnet50-v1.5_tf1_ngc" )
83-
NUM_CLASSES=1000
84-
OUTPUT_TENSORS_NAME="classes"
85-
PREPROCESS_METHOD="resnet50_v1_5_tf1_ngc"
86-
;;
87-
8882
"resnet50v2_backbone" | "resnet50v2_sparse_backbone" )
8983
INPUT_SIZE=256
9084
OUTPUT_TENSORS_NAME="outputs"
@@ -151,6 +145,8 @@ python ${BASE_DIR}/infer.py \
151145
--calib_data_dir ${DATA_DIR} \
152146
--input_saved_model_dir ${INPUT_SAVED_MODEL_DIR} \
153147
--output_saved_model_dir /tmp/$RANDOM \
148+
--model_name "${MODEL_NAME}" \
149+
--model_source "tf_models_image" \
154150
--input_size ${INPUT_SIZE} \
155151
--preprocess_method ${PREPROCESS_METHOD} \
156152
--num_classes ${NUM_CLASSES} \

tftrt/benchmarking-python/image_classification/infer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __init__(self):
6464
self._parser.add_argument(
6565
'--preprocess_method',
6666
type=str,
67-
choices=['vgg', 'inception', 'resnet50_v1_5_tf1_ngc'],
67+
choices=['vgg', 'inception'],
6868
default='vgg',
6969
help='The image preprocessing method used in dataloading.'
7070
)

tftrt/benchmarking-python/image_classification/models/resnet50-v1.5_tf1_ngc/run_inference.sh

-5
This file was deleted.

tftrt/benchmarking-python/nvidia_examples/bert_tf2/run_inference.sh

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ python ${BASE_DIR}/infer.py \
1010
--data_dir=/data/squad/bert_tf2 \
1111
--calib_data_dir=/data/squad/bert_tf2 \
1212
--input_saved_model_dir=/models/nvidia_examples/bert_tf2 \
13+
--model_name "bert_tf2" \
14+
--model_source "nvidia_examples" \
1315
--batch_size=64 \
1416
--output_tensors_name="end_positions,start_positions" \
1517
--total_max_samples=11000 \

tftrt/benchmarking-python/nvidia_examples/dlrm_tf2/run_inference.sh

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ python ${BASE_DIR}/infer.py \
1010
--data_dir=/data/criteo \
1111
--calib_data_dir=/data/criteo \
1212
--input_saved_model_dir=/models/nvidia_examples/dlrm_tf2 \
13+
--model_name "dlrm_tf2" \
14+
--model_source "nvidia_examples" \
1315
--batch_size=65536 \
1416
--output_tensors_name="output_1" \
1517
--total_max_samples=92000000 \

tftrt/benchmarking-python/nvidia_examples/efficientnet_v1_B0_tf2/run_inference.sh

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ python ${BASE_DIR}/infer.py \
1212
--calib_data_dir=/data/imagenet \
1313
--input_saved_model_dir=/models/nvidia_examples/efficientnet_v1_B0_tf2 \
1414
--batch_size=128 \
15+
--model_name "efficientnet_v1_B0_tf2" \
16+
--model_source "nvidia_examples" \
1517
--output_tensors_name="output_1" \
1618
--total_max_samples=55000 \
1719
--input_size=224 \

tftrt/benchmarking-python/nvidia_examples/efficientnet_v1_B4_tf2/run_inference.sh

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ python ${BASE_DIR}/infer.py \
1111
--data_dir=/data/imagenet \
1212
--calib_data_dir=/data/imagenet \
1313
--input_saved_model_dir=/models/nvidia_examples/efficientnet_v1_B4_tf2 \
14+
--model_name "efficientnet_v1_B4_tf2" \
15+
--model_source "nvidia_examples" \
1416
--batch_size=128 \
1517
--output_tensors_name="output_1" \
1618
--total_max_samples=55000 \

tftrt/benchmarking-python/nvidia_examples/efficientnet_v2_tf2/run_inference.sh

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ python ${BASE_DIR}/infer.py \
1111
--data_dir=/data/imagenet \
1212
--calib_data_dir=/data/imagenet \
1313
--input_saved_model_dir=/models/nvidia_examples/efficientnet_v2_tf2 \
14+
--model_name "efficientnet_v2_tf2" \
15+
--model_source "nvidia_examples" \
1416
--batch_size=128 \
1517
--output_tensors_name="output_1" \
1618
--total_max_samples=55000 \

tftrt/benchmarking-python/nvidia_examples/electra_tf2/run_inference.sh

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ python ${BASE_DIR}/infer.py \
1010
--data_dir=/data/squad/electra \
1111
--calib_data_dir=/data/squad/electra \
1212
--input_saved_model_dir=/models/nvidia_examples/electra_tf2 \
13+
--model_name "electra_tf2" \
14+
--model_source "nvidia_examples" \
1315
--batch_size=64 \
1416
--do_lower_case \
1517
--output_tensors_name="tf_electra_for_question_answering,tf_electra_for_question_answering_1,tf_electra_for_question_answering_2,tf_electra_for_question_answering_3,tf_electra_for_question_answering_4" \

tftrt/benchmarking-python/nvidia_examples/mrcnn_tf2/run_inference.sh

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ python ${BASE_DIR}/infer.py \
1717
--data_dir=/data/coco2017/tfrecord \
1818
--calib_data_dir=/data/coco2017/tfrecord \
1919
--input_saved_model_dir=/models/nvidia_examples/mrcnn_tf2 \
20+
--model_name "mrcnn_tf2" \
21+
--model_source "nvidia_examples" \
2022
--batch_size=8 \
2123
--output_tensors_name="detection_boxes,detection_classes,detection_scores,image_info,num_detections,source_ids" \
2224
--total_max_samples=5200 \

tftrt/benchmarking-python/nvidia_examples/nnunet2d_tf2/run_inference.sh

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ python ${BASE_DIR}/infer.py \
1010
--data_dir=/data/msd_task01/numpy_2d_bigger_tf2 \
1111
--calib_data_dir=/data/msd_task01/numpy_2d_bigger_tf2 \
1212
--input_saved_model_dir=/models/nvidia_examples/nnunet2d_tf2 \
13+
--model_name "nnunet2d_tf2" \
14+
--model_source "nvidia_examples" \
1315
--batch_size=1 \
1416
--num_image_slices=32 \
1517
--output_tensors_name="output_1" \

tftrt/benchmarking-python/nvidia_examples/nnunet3d_tf2/run_inference.sh

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ python ${BASE_DIR}/infer.py \
1010
--data_dir=/data/msd_task01/numpy_3d_bigger_tf2 \
1111
--calib_data_dir=/data/msd_task01/numpy_3d_bigger_tf2 \
1212
--input_saved_model_dir=/models/nvidia_examples/nnunet3d_tf2 \
13+
--model_name "nnunet3d_tf2" \
14+
--model_source "nvidia_examples" \
1315
--batch_size=1 \
1416
--output_tensors_name="output_1" \
1517
--total_max_samples=500 \

0 commit comments

Comments
 (0)