Skip to content

Commit ccb1902

Browse files
JanuszLstiepan
authored andcommitted
Fix L2 and L3 tests (#5883)
- adds DATA_DIR and IS_TMP_DIR handling to YOLO test script - updates YOLO test paths to use environment variables - fixes EfficientDet test conditional statement - fixes TFRecord index file generation logic test_RN50_data_pipeline.py and test_data_containers.py - fixes exit status in from TL1_python-nvjpeg_test, TL1_ssd_training and TL3_EfficientDet_convergence tests Signed-off-by: Janusz Lisiecki <[email protected]>
1 parent 02aa4c9 commit ccb1902

File tree

7 files changed

+34
-29
lines changed

7 files changed

+34
-29
lines changed

dali/test/python/test_RN50_data_pipeline.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,19 +183,14 @@ def __init__(self, **kwargs):
183183
tfrecord_idx = sorted(glob.glob(kwargs["data_paths"][1]))
184184
if len(tfrecord_idx) == 0:
185185
# generate indices
186-
tfrecord_files = [
187-
os.path.join(tfrecord, f)
188-
for f in os.listdir(tfrecord)
189-
if os.path.isfile(os.path.join(tfrecord, f)) and not f.endswith(".idx")
190-
]
191186
self.temp_dir = tempfile.TemporaryDirectory()
192187
tfrecord_idxs = [
193-
f"{self.temp_dir.name}/{os.path.basename(f)}.idx" for f in tfrecord_files
188+
os.path.join(self.temp_dir.name, f"{os.path.basename(f)}.idx") for f in tfrecord
194189
]
195-
for tfrecord_file, tfrecord_idx_file in zip(tfrecord_files, tfrecord_idxs):
190+
for tfrecord_file, tfrecord_idx_file in zip(tfrecord, tfrecord_idxs):
196191
print(f"Generating index file for {tfrecord_file}")
197192
call(["tfrecord2idx", tfrecord_file, tfrecord_idx_file])
198-
tfrecord_idx = self.temp_dir.name()
193+
tfrecord_idx = tfrecord_idxs
199194
cache_enabled = kwargs["decoder_cache_params"]["cache_enabled"]
200195
self.input = ops.readers.TFRecord(
201196
path=tfrecord,

dali/test/python/test_data_containers.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,14 @@ def __init__(self, batch_size, num_threads, device_id, num_gpus, data_paths, don
101101
tfrecord_idx = sorted(glob.glob(data_paths[1]))
102102
if len(tfrecord_idx) == 0:
103103
# generate indices
104-
tfrecord_files = [
105-
os.path.join(tfrecord, f)
106-
for f in os.listdir(tfrecord)
107-
if os.path.isfile(os.path.join(tfrecord, f)) and not f.endswith(".idx")
108-
]
109104
self.temp_dir = tempfile.TemporaryDirectory()
110105
tfrecord_idxs = [
111-
f"{self.temp_dir.name}/{os.path.basename(f)}.idx" for f in tfrecord_files
106+
os.path.join(self.temp_dir.name, f"{os.path.basename(f)}.idx") for f in tfrecord
112107
]
113-
for tfrecord_file, tfrecord_idx_file in zip(tfrecord_files, tfrecord_idxs):
108+
for tfrecord_file, tfrecord_idx_file in zip(tfrecord, tfrecord_idxs):
114109
print(f"Generating index file for {tfrecord_file}")
115110
call(["tfrecord2idx", tfrecord_file, tfrecord_idx_file])
116-
tfrecord_idx = self.temp_dir.name()
111+
tfrecord_idx = tfrecord_idxs
117112
self.input = ops.readers.TFRecord(
118113
path=tfrecord,
119114
index_path=tfrecord_idx,

qa/TL1_python-nvjpeg_test/test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ do_once() {
88
}
99

1010
test_body() {
11-
export DATA_DIR=/data/coco/coco-2017/coco2017/
11+
export DATA_DIR=/data/coco/coco-2017/coco2017
1212
export IS_TMP_DIR=0
1313
if [ ! -f "/data/coco/coco-2017/coco2017/train2017/000000581929.jpg"] && [ -f "/data/coco/coco-2017/coco2017/train2017.zip"]; then
1414
export DATA_DIR=$(mktemp -d)
@@ -29,7 +29,7 @@ test_body() {
2929
'${DATA_DIR}/annotations/instances_train2017.json'], \
3030
['${DATA_DIR}/val2017', \
3131
'${DATA_DIR}/annotations/instances_val2017.json']]"
32-
((IS_TMP_DIR)) && rm -rf ${DATA_DIR}
32+
((IS_TMP_DIR)) && rm -rf ${DATA_DIR} || true
3333
}
3434

3535
pushd ../..

qa/TL1_ssd_training/test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ target_dir=./docs/examples/use_cases/pytorch/single_stage_detector/
55

66
test_body() {
77
NUM_GPUS=$(nvidia-smi -L | wc -l)
8-
export DATA_DIR=/data/coco/coco-2017/coco2017/
8+
export DATA_DIR=/data/coco/coco-2017/coco2017
99
export IS_TMP_DIR=0
1010
if [ -f "/data/coco/coco-2017/coco2017/train2017.zip" ]; then
1111
apt update && apt install -y unzip
@@ -23,7 +23,7 @@ test_body() {
2323
popd
2424
fi
2525
torchrun --nproc_per_node=${NUM_GPUS} main.py --backbone resnet50 --warmup 300 --bs 256 --eval-batch-size 8 --epochs 4 --data ${DATA_DIR} --data_pipeline dali --target 0.085
26-
((IS_TMP_DIR)) && rm -rf ${DATA_DIR}
26+
((IS_TMP_DIR)) && rm -rf ${DATA_DIR} || true
2727
}
2828

2929
pushd ../..

qa/TL3_EfficientDet_convergence/test_tensorflow.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash -e
22

33
function CLEAN_AND_EXIT {
4+
((IS_TMP_DIR)) && rm -rf ${DATA_DIR}
45
exit $1
56
}
67

@@ -14,9 +15,9 @@ export NCCL_NVLS_ENABLE=0
1415
# workaround for https://github.com/tensorflow/tensorflow/issues/63548
1516
export WRAPT_DISABLE_EXTENSIONS=1
1617

17-
export DATA_DIR=/data/coco/coco-2017/coco2017/
18+
export DATA_DIR=/data/coco/coco-2017/coco2017
1819
export IS_TMP_DIR=0
19-
if [ ! -f "/data/coco/coco-2017/coco2017/train2017/000000581929.jpg"] && [ -f "/data/coco/coco-2017/coco2017/train2017.zip"]; then
20+
if [ ! -f "/data/coco/coco-2017/coco2017/train2017/000000581929.jpg" ] && [ -f "/data/coco/coco-2017/coco2017/train2017.zip" ]; then
2021
export DATA_DIR=$(mktemp -d)
2122
export IS_TMP_DIR=1
2223
cd ${DATA_DIR}
@@ -48,4 +49,3 @@ python train.py
4849
--output_filename out_weights_1.h5 2>&1 | tee $LOG
4950

5051
CLEAN_AND_EXIT ${PIPESTATUS[0]}
51-
((IS_TMP_DIR)) && rm -rf ${DATA_DIR}

qa/TL3_SSD_convergence/test_pytorch.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -o errexit
55
set -o pipefail
66

77
function CLEAN_AND_EXIT {
8-
((IS_TMP_DIR)) && rm -rf ${DATA_DIR}
8+
((IS_TMP_DIR)) && rm -rf ${DATA_DIR} || true
99
exit $1
1010
}
1111

@@ -16,7 +16,7 @@ pip install git+https://github.com/NVIDIA/cocoapi.git#subdirectory=PythonAPI
1616

1717
NUM_GPUS=$(nvidia-smi -L | wc -l)
1818

19-
export DATA_DIR=/data/coco/coco-2017/coco2017/
19+
export DATA_DIR=/data/coco/coco-2017/coco2017
2020
export IS_TMP_DIR=0
2121
if [ -f "/data/coco/coco-2017/coco2017/train2017.zip" ]; then
2222
apt update && apt install -y unzip

qa/TL3_YOLO_convergence/test_tensorflow.sh

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,29 @@ export NCCL_NVLS_ENABLE=0
1616
# workaround for https://github.com/tensorflow/tensorflow/issues/63548
1717
export WRAPT_DISABLE_EXTENSIONS=1
1818

19+
export DATA_DIR=/data/coco/coco-2017/coco2017
20+
export IS_TMP_DIR=0
21+
if [ ! -f "/data/coco/coco-2017/coco2017/train2017/000000581929.jpg" ] && [ -f "/data/coco/coco-2017/coco2017/train2017.zip" ]; then
22+
export DATA_DIR=$(mktemp -d)
23+
export IS_TMP_DIR=1
24+
cd ${DATA_DIR}
25+
cp /data/coco/coco-2017/coco2017/train2017.zip . &
26+
cp /data/coco/coco-2017/coco2017/val2017.zip . &
27+
cp /data/coco/coco-2017/coco2017/annotations_trainval2017.zip . &
28+
wait
29+
unzip -q train2017.zip &
30+
unzip -q val2017.zip &
31+
unzip -q annotations_trainval2017.zip &
32+
fi
33+
1934
python src/main.py train \
20-
/data/coco/coco-2017/coco2017/train2017 \
21-
/data/coco/coco-2017/coco2017/annotations/instances_train2017.json \
35+
${DATA_DIR}/train2017 \
36+
${DATA_DIR}/annotations/instances_train2017.json \
2237
-b 2 -e 1 -s 4000 -o output.h5 \
2338
--learning_rate="1e-3" --pipeline dali-gpu --multigpu --use_mosaic \
2439
--eval_frequency 1 --eval_steps 100 \
25-
--eval_file_root /data/coco/coco-2017/coco2017/val2017 \
26-
--eval_annotations /data/coco/coco-2017/coco2017/annotations/instances_val2017.json 2>&1 | tee $LOG
40+
--eval_file_root ${DATA_DIR}/val2017 \
41+
--eval_annotations ${DATA_DIR}/annotations/instances_val2017.json 2>&1 | tee $LOG
2742

2843

2944
CLEAN_AND_EXIT ${PIPESTATUS[0]}

0 commit comments

Comments
 (0)