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

Commit

Permalink
[Benchmarking-Py] 1.2.0 - Adding Metric Push to Remote
Browse files Browse the repository at this point in the history
  • Loading branch information
DEKHTIARJonathan committed Aug 1, 2022
1 parent 553c18e commit 0de3370
Show file tree
Hide file tree
Showing 34 changed files with 366 additions and 39 deletions.
11 changes: 11 additions & 0 deletions tftrt/benchmarking-python/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ Description of the change

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

## [1.2.0] - 2022.07.31 - @DEKHTIARJonathan

Setting up the benchmarking suite to allow remote upload and storage of the
metrics and experiments.

Adding arguments:
* `--model_name`: Name of the model being executed.
* `--model_source`: Name of the model's source that originally published the model.
* `--experiment_name`: Name of the experiment being conducted.
* `--upload_metrics_endpoint`: Distant endpoint being used to push metrics to.

## [1.1.0] - 2022.07.25 - @DEKHTIARJonathan

Replacing all `print()` calls by `logging.<level>()` calls
Expand Down
59 changes: 49 additions & 10 deletions tftrt/benchmarking-python/benchmark_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@ def __init__(self):
"generated and used at every iteration."
)

self._parser.add_argument(
"--precision",
type=str,
choices=self.ALLOWED_PRECISION_MODES,
default="FP32",
help="Precision mode to use. FP16 and INT8 modes only works if "
"--use_tftrt is used."
)

# =========================== TF-TRT Flags ========================== #

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

self._parser.add_argument(
"--precision",
type=str,
choices=self.ALLOWED_PRECISION_MODES,
default="FP32",
help="Precision mode to use. FP16 and INT8 modes only works if "
"--use_tftrt is used."
)

self._add_bool_argument(
name="use_dynamic_shape",
default=False,
required=False,
help="Whether to use implicit batch mode or dynamic shape mode."
)

# =========================== DEBUG Flags ========================== #
# =========================== Metric Flags ========================== #

self._parser.add_argument(
"--experiment_name",
type=str,
default=None,
help="Name of the experiment being run, only used for archiving "
"objectives: exports in JSON or CSV."
)

self._parser.add_argument(
"--model_name",
type=str,
required=True,
default=None,
help="Name of the model being benchmarked."
)

self._parser.add_argument(
"--model_source",
type=str,
required=True,
default=None,
help="Source of the model where it was originally published."
)

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

self._parser.add_argument(
"--upload_metrics_endpoint",
type=str,
default=None,
help="If set, the benchmark will upload the metrics in JSON format "
"to the set endpoint using a PUT requests."
)

# =========================== TF Profiling =========================== #

self._parser.add_argument(
"--tf_profile_export_path",
type=str,
Expand All @@ -281,6 +315,8 @@ def __init__(self):
help="If set to True, will add extra information to the TF Profile."
)

# ============================ Debug Flags =========================== #

self._add_bool_argument(
name="debug",
default=False,
Expand Down Expand Up @@ -388,6 +424,9 @@ def _validate_args(self, args):
"doesn't exist or is not a directory"
)

if args.upload_metrics_endpoint is not None:
raise NotImplementedError("This feature is not yet implemented.")

def _post_process_args(self, args):
if args.use_synthetic_data:
# This variable is not used in synthetic data mode.
Expand Down
2 changes: 1 addition & 1 deletion tftrt/benchmarking-python/benchmark_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# The `__version__` number shall be updated everytime core benchmarking files
# are updated.
# Please update CHANGELOG.md with a description of what this version changed.
__version__ = "1.1.0"
__version__ = "1.2.0"


def get_commit_id():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ python ${BASE_DIR}/infer.py \
--calib_data_dir ${DATA_DIR} \
--input_saved_model_dir ${INPUT_SAVED_MODEL_DIR} \
--output_saved_model_dir /tmp/$RANDOM \
--model_name "${MODEL_NAME}" \
--model_source "huggingface" \
--batch_size ${BATCH_SIZE} \
--vocab_size ${VOCAB_SIZE} \
--sequence_length=${SEQ_LEN} \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ python ${BASE_DIR}/infer.py \
--data_dir=${DATA_DIR} \
--calib_data_dir=${DATA_DIR} \
--input_saved_model_dir=${MODEL_DIR} \
--model_name "${MODEL_NAME}" \
--model_source "huggingface" \
--tokenizer_model_dir=${TOKENIZER_DIR} \
--batch_size=${BATCH_SIZE} \
--sequence_length=${SEQ_LEN} \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ python ${BASE_DIR}/infer.py \
--data_dir=${DATA_DIR} \
--calib_data_dir=${DATA_DIR} \
--input_saved_model_dir=${MODEL_DIR} \
--model_name "${MODEL_NAME}" \
--model_source "huggingface" \
--tokenizer_model_dir=${TOKENIZER_DIR}\
--vocab_model_dir=${TOKENIZER_DIR}\
--output_tensors_name=${OUTPUT_TENSOR_NAMES} \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ case ${MODEL_NAME} in
NUM_CLASSES=1000
;;

"resnet50-v1.5_tf1_ngc" )
NUM_CLASSES=1000
OUTPUT_TENSORS_NAME="classes"
PREPROCESS_METHOD="resnet50_v1_5_tf1_ngc"
;;

"resnet50v2_backbone" | "resnet50v2_sparse_backbone" )
INPUT_SIZE=256
OUTPUT_TENSORS_NAME="outputs"
Expand Down Expand Up @@ -151,6 +145,8 @@ python ${BASE_DIR}/infer.py \
--calib_data_dir ${DATA_DIR} \
--input_saved_model_dir ${INPUT_SAVED_MODEL_DIR} \
--output_saved_model_dir /tmp/$RANDOM \
--model_name "${MODEL_NAME}" \
--model_source "tf_models_image" \
--input_size ${INPUT_SIZE} \
--preprocess_method ${PREPROCESS_METHOD} \
--num_classes ${NUM_CLASSES} \
Expand Down
2 changes: 1 addition & 1 deletion tftrt/benchmarking-python/image_classification/infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(self):
self._parser.add_argument(
'--preprocess_method',
type=str,
choices=['vgg', 'inception', 'resnet50_v1_5_tf1_ngc'],
choices=['vgg', 'inception'],
default='vgg',
help='The image preprocessing method used in dataloading.'
)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ python ${BASE_DIR}/infer.py \
--data_dir=/data/squad/bert_tf2 \
--calib_data_dir=/data/squad/bert_tf2 \
--input_saved_model_dir=/models/nvidia_examples/bert_tf2 \
--model_name "bert_tf2" \
--model_source "nvidia_examples" \
--batch_size=64 \
--output_tensors_name="end_positions,start_positions" \
--total_max_samples=11000 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ python ${BASE_DIR}/infer.py \
--data_dir=/data/criteo \
--calib_data_dir=/data/criteo \
--input_saved_model_dir=/models/nvidia_examples/dlrm_tf2 \
--model_name "dlrm_tf2" \
--model_source "nvidia_examples" \
--batch_size=65536 \
--output_tensors_name="output_1" \
--total_max_samples=92000000 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ python ${BASE_DIR}/infer.py \
--calib_data_dir=/data/imagenet \
--input_saved_model_dir=/models/nvidia_examples/efficientnet_v1_B0_tf2 \
--batch_size=128 \
--model_name "efficientnet_v1_B0_tf2" \
--model_source "nvidia_examples" \
--output_tensors_name="output_1" \
--total_max_samples=55000 \
--input_size=224 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ python ${BASE_DIR}/infer.py \
--data_dir=/data/imagenet \
--calib_data_dir=/data/imagenet \
--input_saved_model_dir=/models/nvidia_examples/efficientnet_v1_B4_tf2 \
--model_name "efficientnet_v1_B4_tf2" \
--model_source "nvidia_examples" \
--batch_size=128 \
--output_tensors_name="output_1" \
--total_max_samples=55000 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ python ${BASE_DIR}/infer.py \
--data_dir=/data/imagenet \
--calib_data_dir=/data/imagenet \
--input_saved_model_dir=/models/nvidia_examples/efficientnet_v2_tf2 \
--model_name "efficientnet_v2_tf2" \
--model_source "nvidia_examples" \
--batch_size=128 \
--output_tensors_name="output_1" \
--total_max_samples=55000 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ python ${BASE_DIR}/infer.py \
--data_dir=/data/squad/electra \
--calib_data_dir=/data/squad/electra \
--input_saved_model_dir=/models/nvidia_examples/electra_tf2 \
--model_name "electra_tf2" \
--model_source "nvidia_examples" \
--batch_size=64 \
--do_lower_case \
--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" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ python ${BASE_DIR}/infer.py \
--data_dir=/data/coco2017/tfrecord \
--calib_data_dir=/data/coco2017/tfrecord \
--input_saved_model_dir=/models/nvidia_examples/mrcnn_tf2 \
--model_name "mrcnn_tf2" \
--model_source "nvidia_examples" \
--batch_size=8 \
--output_tensors_name="detection_boxes,detection_classes,detection_scores,image_info,num_detections,source_ids" \
--total_max_samples=5200 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ python ${BASE_DIR}/infer.py \
--data_dir=/data/msd_task01/numpy_2d_bigger_tf2 \
--calib_data_dir=/data/msd_task01/numpy_2d_bigger_tf2 \
--input_saved_model_dir=/models/nvidia_examples/nnunet2d_tf2 \
--model_name "nnunet2d_tf2" \
--model_source "nvidia_examples" \
--batch_size=1 \
--num_image_slices=32 \
--output_tensors_name="output_1" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ python ${BASE_DIR}/infer.py \
--data_dir=/data/msd_task01/numpy_3d_bigger_tf2 \
--calib_data_dir=/data/msd_task01/numpy_3d_bigger_tf2 \
--input_saved_model_dir=/models/nvidia_examples/nnunet3d_tf2 \
--model_name "nnunet3d_tf2" \
--model_source "nvidia_examples" \
--batch_size=1 \
--output_tensors_name="output_1" \
--total_max_samples=500 \
Expand Down
Loading

0 comments on commit 0de3370

Please sign in to comment.