Skip to content

Commit f00cef1

Browse files
committed
fixup! improve color visibility
1 parent 75bc644 commit f00cef1

2 files changed

Lines changed: 53 additions & 35 deletions

File tree

qa/common/gen_qa_model_repository

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,16 @@
5050
TRITON_MDLS_BASE_SCRIPT_DIR="$(dirname $(readlink -f $0))"
5151
TRITON_MDLS_BASE_SCRIPT_FILE="$(readlink -f $0)"
5252

53-
log_message.info() { local message=$@ ; echo -e "\093[34m$(date +"%Y-%m-%d %H:%M:%S") - [ INFO ] - ${message} \033[0m"; } ;
54-
log_message.status() { local message=$@ ; echo -e "\033[37m$(date +"%Y-%m-%d %H:%M:%S") - [ STATUS ] - ${message} \033[0m"; } ;
55-
log_message.warning() { local message=$@ ; echo -e "\033[33m$(date +"%Y-%m-%d %H:%M:%S") - [ WARNING ] - ${message} \033[0m"; } ;
56-
log_message.error() { local message=$@ ; echo -e "\033[31m$(date +"%Y-%m-%d %H:%M:%S") - [ ERROR ] - ${message} \033[0m"; } ;
53+
COLOR_ERROR="\033[31m"
54+
COLOR_INFO="\033[94m"
55+
COLOR_RESET="\033[0m"
56+
COLOR_STATUS="\033[36m"
57+
COLOR_WARNING="\033[33m"
58+
59+
log_message.info() { local message=$@ ; echo -e "${COLOR_INFO}$(date +"%Y-%m-%d %H:%M:%S") - [ INFO ] - ${message} ${COLOR_RESET}"; } ;
60+
log_message.status() { local message=$@ ; echo -e "${COLOR_STATUS}$(date +"%Y-%m-%d %H:%M:%S") - [ STATUS ] - ${message} ${COLOR_RESET}"; } ;
61+
log_message.warning() { local message=$@ ; echo -e "${COLOR_WARNING}$(date +"%Y-%m-%d %H:%M:%S") - [ WARNING ] - ${message} ${COLOR_RESET}"; } ;
62+
log_message.error() { local message=$@ ; echo -e "${COLOR_ERROR}$(date +"%Y-%m-%d %H:%M:%S") - [ ERROR ] - ${message} ${COLOR_RESET}"; } ;
5763

5864
log_message.status "Changing working directory to the script directory to: " "${TRITON_MDLS_BASE_SCRIPT_DIR}"
5965

@@ -129,7 +135,7 @@ cat > $OPENVINOSCRIPT <<EOF
129135
umask 0000
130136
nvidia-smi --query-gpu=compute_cap,compute_mode,driver_version,name,index --format=csv || true
131137
nvidia-smi || true
132-
echo -e "\093[34mGenerating OpenVINO models\033[0m"
138+
echo -e "${COLOR_INFO}Generating OpenVINO models${COLOR_RESET}"
133139
set -e
134140
export DEBIAN_FRONTEND=noninteractive
135141
apt-get update && \
@@ -173,7 +179,7 @@ cat > $ONNXSCRIPT <<EOF
173179
umask 0000
174180
nvidia-smi --query-gpu=compute_cap,compute_mode,driver_version,name,index --format=csv || true
175181
nvidia-smi || true
176-
echo -e "\093[34mGenerating ONNX models\033[0m"
182+
echo -e "${COLOR_INFO}Generating ONNX models${COLOR_RESET}"
177183
set -e
178184
export DEBIAN_FRONTEND=noninteractive
179185
apt-get update && \
@@ -236,7 +242,7 @@ cat > $TORCHSCRIPT <<EOF
236242
umask 0000
237243
nvidia-smi --query-gpu=compute_cap,compute_mode,driver_version,name,index --format=csv || true
238244
nvidia-smi || true
239-
echo -e "\093[34mGenerating PyTorch models\033[0m"
245+
echo -e "${COLOR_INFO}Generating PyTorch models${COLOR_RESET}"
240246
pip3 install onnxscript
241247
set -e
242248
PATH=$PATH:/usr/local/cuda-13.0/bin
@@ -263,7 +269,7 @@ chmod -R 777 $TRITON_MDLS_QA_VARIABLE_SEQUENCE_IMPLICIT_MODEL
263269
python3 $TRITON_MDLS_SRC_DIR/gen_qa_dyna_sequence_models.py --libtorch --models_dir=$TRITON_MDLS_QA_DYNA_SEQUENCE_MODEL
264270
chmod -R 777 $TRITON_MDLS_QA_DYNA_SEQUENCE_MODEL
265271
if [ -z "$MODEL_TYPE" ] || [ "$MODEL_TYPE" != "igpu" ]; then
266-
nvidia-smi --query-gpu=compute_cap | grep -qz 12.1 && echo -e '\033[33m[WARNING]\033[0m Skipping model generation for Torch TensorRT' || python3 $TRITON_MDLS_SRC_DIR/gen_qa_torchtrt_models.py --models_dir=$TRITON_MDLS_QA_TORCHTRT_MODEL
272+
nvidia-smi --query-gpu=compute_cap | grep -qz 12.1 && echo -e '${COLOR_WARNING}[WARNING]${COLOR_RESET} Skipping model generation for Torch TensorRT${COLOR_RESET}' || python3 $TRITON_MDLS_SRC_DIR/gen_qa_torchtrt_models.py --models_dir=$TRITON_MDLS_QA_TORCHTRT_MODEL
267273
chmod -R 777 $TRITON_MDLS_QA_TORCHTRT_MODEL
268274
fi
269275
python3 $TRITON_MDLS_SRC_DIR/gen_qa_ragged_models.py --libtorch --models_dir=$TRITON_MDLS_QA_RAGGED_MODEL
@@ -294,7 +300,7 @@ cat > $TRTSCRIPT <<EOF
294300
umask 0000
295301
nvidia-smi --query-gpu=compute_cap,compute_mode,driver_version,name,index --format=csv || true
296302
nvidia-smi || true
297-
echo -e "\093[34mGenerating TensorRT models\033[0m"
303+
echo -e "${COLOR_INFO}Generating TensorRT models${COLOR_RESET}"
298304
set -e
299305
dpkg -l | grep TensorRT
300306
export TRT_SUPPRESS_DEPRECATION_WARNINGS=1
@@ -330,7 +336,7 @@ python3 $TRITON_MDLS_SRC_DIR/gen_qa_ragged_models.py --tensorrt --models_dir=$TR
330336
chmod -R 777 $TRITON_MDLS_QA_RAGGED_MODEL
331337
python3 $TRITON_MDLS_SRC_DIR/gen_qa_trt_format_models.py --models_dir=$TRITON_MDLS_QA_TRT_FORMAT_MODEL
332338
chmod -R 777 $TRITON_MDLS_QA_TRT_FORMAT_MODEL
333-
nvidia-smi --query-gpu=compute_cap | grep -qz 11.0 && echo -e '\033[33m[WARNING]\033[0m Skipping model generation for data dependent shape' || python3 $TRITON_MDLS_SRC_DIR/gen_qa_trt_data_dependent_shape.py --models_dir=$TRITON_MDLS_QA_TRT_DATA_DEPENDENT_MODEL
339+
nvidia-smi --query-gpu=compute_cap | grep -qz 11.0 && echo -e '${COLOR_WARNING}[WARNING]${COLOR_RESET} Skipping model generation for data dependent shape${COLOR_RESET}' || python3 $TRITON_MDLS_SRC_DIR/gen_qa_trt_data_dependent_shape.py --models_dir=$TRITON_MDLS_QA_TRT_DATA_DEPENDENT_MODEL
334340
chmod -R 777 $TRITON_MDLS_QA_TRT_DATA_DEPENDENT_MODEL
335341
# Make shared library for custom Hardmax plugin.
336342
if [ -d "/usr/src/tensorrt/samples/python/onnx_custom_plugin" ]; then
@@ -371,6 +377,7 @@ if which docker ; then
371377
docker pull $UBUNTU_IMAGE
372378

373379
log_message.status "docker volume: create destination directory on volume"
380+
log_message.info "docker run -v $DOCKER_VOLUME:/mnt -w /mnt/$CI_JOB_ID $UBUNTU_IMAGE mkdir -p gen_srcdir ${TRITON_VERSION}"
374381
docker run \
375382
--rm \
376383
--label RUNNER_ID=$RUNNER_ID \
@@ -380,6 +387,7 @@ if which docker ; then
380387
$UBUNTU_IMAGE \
381388
mkdir -p gen_srcdir ${TRITON_VERSION}
382389

390+
log_message.status "docker volume: create model directories on volume"
383391
docker run \
384392
--rm \
385393
--label RUNNER_ID=$RUNNER_ID \
@@ -415,6 +423,7 @@ if which docker ; then
415423
$TRITON_MDLS_QA_DYNAMIC_BATCH_IMAGE_MODEL
416424

417425
log_message.status "docker container: create container $DOCKER_VOLUME_CONTAINER"
426+
log_message.info "docker create --name $DOCKER_VOLUME_CONTAINER -v $DOCKER_VOLUME:/mnt -w /mnt/$CI_JOB_ID $UBUNTU_IMAGE"
418427
docker create \
419428
--label RUNNER_ID=$RUNNER_ID \
420429
--label PROJECT_NAME=$PROJECT_NAME \
@@ -429,6 +438,7 @@ if which docker ; then
429438
if [[ "aarch64" != $(uname -m) ]] ; then
430439

431440
log_message.status "docker run: $OPENVINOSCRIPT"
441+
log_message.info "docker run $DOCKER_GPU_ARGS -v $DOCKER_VOLUME:/mnt $UBUNTU_IMAGE bash -e $TRITON_MDLS_SRC_DIR/$OPENVINOSCRIPT"
432442
docker run \
433443
--rm \
434444
--label RUNNER_ID=$RUNNER_ID \
@@ -437,7 +447,7 @@ if which docker ; then
437447
-v $DOCKER_VOLUME:/mnt \
438448
-t \
439449
$UBUNTU_IMAGE \
440-
bash -xe $TRITON_MDLS_SRC_DIR/$OPENVINOSCRIPT
450+
bash -e $TRITON_MDLS_SRC_DIR/$OPENVINOSCRIPT
441451

442452
exit_code=$?
443453

@@ -450,6 +460,7 @@ if which docker ; then
450460
fi # [[ "aarch64" != $(uname -m) ]]
451461

452462
log_message.status "docker run: $ONNXSCRIPT"
463+
log_message.info "docker run $DOCKER_GPU_ARGS -v $DOCKER_VOLUME:/mnt $UBUNTU_IMAGE bash -e $TRITON_MDLS_SRC_DIR/$ONNXSCRIPT"
453464
docker run \
454465
--rm \
455466
--label RUNNER_ID=$RUNNER_ID \
@@ -458,7 +469,7 @@ if which docker ; then
458469
-v $DOCKER_VOLUME:/mnt \
459470
-t \
460471
$UBUNTU_IMAGE \
461-
bash -xe $TRITON_MDLS_SRC_DIR/$ONNXSCRIPT
472+
bash -e $TRITON_MDLS_SRC_DIR/$ONNXSCRIPT
462473

463474
exit_code=$?
464475

@@ -470,9 +481,11 @@ if which docker ; then
470481
fi
471482

472483
log_message.status "docker pull: $PYTORCH_IMAGE"
484+
log_message.info "docker pull $PYTORCH_IMAGE"
473485
docker pull $PYTORCH_IMAGE
474486

475487
log_message.status "docker run: $TORCHSCRIPT"
488+
log_message.info "docker run $DOCKER_GPU_ARGS -v $DOCKER_VOLUME:/mnt $PYTORCH_IMAGE bash -e $TRITON_MDLS_SRC_DIR/$TORCHSCRIPT"
476489
docker run \
477490
--rm \
478491
--label RUNNER_ID=$RUNNER_ID \
@@ -481,7 +494,7 @@ if which docker ; then
481494
-v $DOCKER_VOLUME:/mnt \
482495
-t \
483496
$PYTORCH_IMAGE \
484-
bash -xe $TRITON_MDLS_SRC_DIR/$TORCHSCRIPT
497+
bash -e $TRITON_MDLS_SRC_DIR/$TORCHSCRIPT
485498

486499
exit_code=$?
487500

@@ -497,6 +510,7 @@ if which docker ; then
497510
docker pull $TENSORRT_IMAGE
498511

499512
log_message.status "docker run: $TRTSCRIPT"
513+
log_message.info "docker run $DOCKER_GPU_ARGS -v $DOCKER_VOLUME:/mnt $TENSORRT_IMAGE bash -e $TRITON_MDLS_SRC_DIR/$TRTSCRIPT"
500514
docker run \
501515
--rm \
502516
--label RUNNER_ID=$RUNNER_ID \
@@ -506,7 +520,7 @@ if which docker ; then
506520
-t \
507521
-e TRT_VERBOSE \
508522
$TENSORRT_IMAGE \
509-
bash -xe $TRITON_MDLS_SRC_DIR/$TRTSCRIPT
523+
bash -e $TRITON_MDLS_SRC_DIR/$TRTSCRIPT
510524

511525
exit_code=$?
512526

qa/common/gen_qa_models.py

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
np_dtype_string = np.dtype(object)
4646
from typing import List, Tuple
4747

48+
_color_green = "\033[32m"
49+
_color_magenta = "\033[35m"
50+
_color_reset = "\033[0m"
51+
4852

4953
def create_plan_dynamic_rf_modelfile(
5054
models_dir,
@@ -348,7 +352,7 @@ def create_plan_dynamic_modelfile(
348352
output0_dtype,
349353
output1_dtype,
350354
)
351-
print(f"\033[32mCreating model {model_name}\033[0m")
355+
print(f"{_color_green}Creating model {model_name}{_color_reset}")
352356
if min_dim != 1 or max_dim != 32:
353357
model_name = "{}-{}-{}".format(model_name, min_dim, max_dim)
354358

@@ -468,7 +472,7 @@ def create_plan_fixed_rf_modelfile(
468472
output0_dtype,
469473
output1_dtype,
470474
)
471-
print(f"\033[32mCreating model {model_name}\033[0m")
475+
print(f"{_color_green}Creating model {model_name}{_color_reset}")
472476
model_version_dir = models_dir + "/" + model_name + "/" + str(model_version)
473477

474478
try:
@@ -556,7 +560,7 @@ def create_plan_fixed_modelfile(
556560
output0_dtype,
557561
output1_dtype,
558562
)
559-
print(f"\033[32mCreating model {model_name}\033[0m")
563+
print(f"{_color_green}Creating model {model_name}{_color_reset}")
560564
model_version_dir = models_dir + "/" + model_name + "/" + str(model_version)
561565

562566
try:
@@ -729,7 +733,7 @@ def create_plan_modelconfig(
729733
output0_dtype,
730734
output1_dtype,
731735
)
732-
print(f"\033[32mCreating config for {model_name}\033[0m")
736+
print(f"{_color_green}Creating config for {model_name}{_color_reset}")
733737
if min_dim != 1 or max_dim != 32:
734738
model_name = "{}-{}-{}".format(model_name, min_dim, max_dim)
735739

@@ -883,7 +887,7 @@ def create_onnx_modelfile(
883887
output0_dtype,
884888
output1_dtype,
885889
)
886-
print(f"\033[32mCreating model {model_name}\033[0m")
890+
print(f"{_color_green}Creating model {model_name}{_color_reset}")
887891
model_version_dir = models_dir + "/" + model_name + "/" + str(model_version)
888892

889893
batch_dim = [] if max_batch == 0 else [None]
@@ -989,7 +993,7 @@ def create_onnx_modelconfig(
989993
output0_dtype,
990994
output1_dtype,
991995
)
992-
print(f"\033[32mCreating config for {model_name}\033[0m")
996+
print(f"{_color_green}Creating config for {model_name}{_color_reset}")
993997
config_dir = models_dir + "/" + model_name
994998

995999
# [TODO] move create_general_modelconfig() out of emu as it is general
@@ -1054,7 +1058,7 @@ def create_libtorch_modelfile(
10541058
output0_dtype,
10551059
output1_dtype,
10561060
)
1057-
print(f"\033[32mCreating model {model_name}\033[0m")
1061+
print(f"{_color_green}Creating model {model_name}{_color_reset}")
10581062
# handle for -1 (when variable) since can't create tensor with shape of [-1]
10591063
input_shape = [abs(ips) for ips in input_shape]
10601064

@@ -1319,7 +1323,7 @@ def create_libtorch_pt2_modelfile(
13191323
output0_dtype,
13201324
output1_dtype,
13211325
)
1322-
print(f"\033[32mCreating model {model_name}\033[0m")
1326+
print(f"{_color_green}Creating model {model_name}{_color_reset}")
13231327
# handle for -1 (when variable) since can't create tensor with shape of [-1]
13241328
input_shape = [abs(ips) for ips in input_shape]
13251329

@@ -1375,7 +1379,7 @@ def create_torch_aoti_modelfile(
13751379
output0_dtype,
13761380
output1_dtype,
13771381
)
1378-
print(f"\033[32mCreating model {model_name}\033[0m")
1382+
print(f"{_color_green}Creating model {model_name}{_color_reset}")
13791383
# handle for -1 (when variable) since can't create tensor with shape of [-1]
13801384
input_shape = [abs(ips) for ips in input_shape]
13811385

@@ -1446,7 +1450,7 @@ def create_libtorch_modelconfig(
14461450
output0_dtype,
14471451
output1_dtype,
14481452
)
1449-
print(f"\033[32mCreating config for {model_name}\033[0m")
1453+
print(f"{_color_green}Creating config for {model_name}{_color_reset}")
14501454
config_dir = models_dir + "/" + model_name
14511455
config = """
14521456
backend: "pytorch"
@@ -1548,7 +1552,7 @@ def create_libtorch_pt2_modelconfig(
15481552
output0_dtype,
15491553
output1_dtype,
15501554
)
1551-
print(f"\033[32mCreating config for {model_name}\033[0m")
1555+
print(f"{_color_green}Creating config for {model_name}{_color_reset}")
15521556
config_dir = models_dir + "/" + model_name
15531557
config = """
15541558
backend: "pytorch"
@@ -1652,7 +1656,7 @@ def create_torch_aoti_modelconfig(
16521656
output0_dtype,
16531657
output1_dtype,
16541658
)
1655-
print(f"\033[32mCreating config for {model_name}\033[0m")
1659+
print(f"{_color_green}Creating config for {model_name}{_color_reset}")
16561660
config_dir = models_dir + "/" + model_name
16571661
config = """
16581662
backend: "pytorch"
@@ -1742,7 +1746,7 @@ def create_openvino_modelfile(
17421746
output0_dtype,
17431747
output1_dtype,
17441748
)
1745-
print(f"\033[32mCreating model {model_name}\033[0m")
1749+
print(f"{_color_green}Creating model {model_name}{_color_reset}")
17461750
model_version_dir = models_dir + "/" + model_name + "/" + str(model_version)
17471751

17481752
in0 = ov.opset1.parameter(
@@ -1807,7 +1811,7 @@ def create_openvino_modelconfig(
18071811
output0_dtype,
18081812
output1_dtype,
18091813
)
1810-
print(f"\033[32mCreating config for {model_name}\033[0m")
1814+
print(f"{_color_green}Creating config for {model_name}{_color_reset}")
18111815
config_dir = models_dir + "/" + model_name
18121816

18131817
# platform is empty and backend is 'openvino' for openvino model
@@ -1881,7 +1885,7 @@ def create_models(
18811885
):
18821886
model_version = 1
18831887
if FLAGS.tensorrt:
1884-
print("\033[35mTensorRT model generation requested\033[0m")
1888+
print(f"{_color_magenta}TensorRT model generation requested{_color_reset}")
18851889
# max-batch 8
18861890
suffix = ()
18871891
if (
@@ -1972,7 +1976,7 @@ def create_models(
19721976
)
19731977

19741978
if FLAGS.onnx:
1975-
print("\033[35mONNX model generation requested\033[0m")
1979+
print(f"{_color_magenta}ONNX model generation requested{_color_reset}")
19761980
# max-batch 8
19771981
create_onnx_modelconfig(
19781982
models_dir,
@@ -2025,7 +2029,7 @@ def create_models(
20252029
)
20262030

20272031
if FLAGS.libtorch:
2028-
print("\033[35mPyTorch: PT model generation requested\033[0m")
2032+
print(f"{_color_magenta}PyTorch: PT model generation requested{_color_reset}")
20292033
# max-batch 8
20302034
create_libtorch_modelconfig(
20312035
models_dir,
@@ -2078,7 +2082,7 @@ def create_models(
20782082
)
20792083

20802084
if FLAGS.libtorch_pt2:
2081-
print("\033[35mPyTorch: PT2 model generation requested\033[0m")
2085+
print(f"{_color_magenta}PyTorch: PT2 model generation requested{_color_reset}")
20822086
create_libtorch_pt2_modelconfig(
20832087
models_dir,
20842088
0,
@@ -2105,7 +2109,7 @@ def create_models(
21052109
)
21062110

21072111
if FLAGS.torch_aoti:
2108-
print("\033[35mPyTorch: AOTI model generation requested\033[0m")
2112+
print(f"{_color_magenta}PyTorch: AOTI model generation requested{_color_reset}")
21092113
# max-batch 8
21102114
create_torch_aoti_modelconfig(
21112115
models_dir,
@@ -2133,7 +2137,7 @@ def create_models(
21332137
)
21342138

21352139
if FLAGS.openvino:
2136-
print("\033[35mOpenVINO model generation requested\033[0m")
2140+
print(f"{_color_magenta}OpenVINO model generation requested{_color_reset}")
21372141
# max-batch 8
21382142
create_openvino_modelconfig(
21392143
models_dir,
@@ -2186,7 +2190,7 @@ def create_models(
21862190
)
21872191

21882192
if FLAGS.ensemble:
2189-
print("\033[35mEnsemble model generation requested\033[0m")
2193+
print(f"{_color_magenta}Ensemble model generation requested{_color_reset}")
21902194
for pair in emu.platform_types_and_validation():
21912195
if not pair[1](
21922196
input_dtype,

0 commit comments

Comments
 (0)