From dd3af2456f203844f2c7bded1cefc28ea4b8d790 Mon Sep 17 00:00:00 2001 From: Dheeraj Peri Date: Wed, 17 Aug 2022 15:24:04 -0700 Subject: [PATCH 1/2] chore: Fix data loader issues and nox file paths Signed-off-by: Dheeraj Peri --- examples/int8/training/vgg16/export_qat.py | 2 +- noxfile.py | 6 +++--- py/torch_tensorrt/ptq.py | 2 +- tests/py/ptq/test_ptq_trt_calibrator.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/int8/training/vgg16/export_qat.py b/examples/int8/training/vgg16/export_qat.py index af881c5642..72974d1f4d 100644 --- a/examples/int8/training/vgg16/export_qat.py +++ b/examples/int8/training/vgg16/export_qat.py @@ -81,7 +81,7 @@ def test(model, dataloader, crit): quant_nn.TensorQuantizer.use_fb_fake_quant = True with torch.no_grad(): data = iter(testing_dataloader) - images, _ = data.next() + images, _ = next(data) jit_model = torch.jit.trace(model, images.to("cuda")) torch.jit.save(jit_model, "trained_vgg16_qat.jit.pt") diff --git a/noxfile.py b/noxfile.py index 41926b5ee1..193a384706 100644 --- a/noxfile.py +++ b/noxfile.py @@ -268,8 +268,8 @@ def run_trt_compatibility_tests(session): copy_model(session) session.chdir(os.path.join(TOP_DIR, "tests/py")) tests = [ - "test_trt_intercompatibility.py", - "test_ptq_trt_calibrator.py", + "integrations/test_trt_intercompatibility.py", + #"ptq/test_ptq_trt_calibrator.py", ] for test in tests: if USE_HOST_DEPS: @@ -295,7 +295,7 @@ def run_multi_gpu_tests(session): print("Running multi GPU tests") session.chdir(os.path.join(TOP_DIR, "tests/py")) tests = [ - "test_multi_gpu.py", + "hw/test_multi_gpu.py", ] for test in tests: if USE_HOST_DEPS: diff --git a/py/torch_tensorrt/ptq.py b/py/torch_tensorrt/ptq.py index 326f35f942..3beb2f2327 100644 --- a/py/torch_tensorrt/ptq.py +++ b/py/torch_tensorrt/ptq.py @@ -28,7 +28,7 @@ def get_batch(self, names): if self.current_batch_idx + self.batch_size > len(self.data_loader.dataset): return None - batch = self.dataset_iterator.next() + batch = next(self.dataset_iterator) self.current_batch_idx += self.batch_size inputs_gpu = [] if isinstance(batch, list): diff --git a/tests/py/ptq/test_ptq_trt_calibrator.py b/tests/py/ptq/test_ptq_trt_calibrator.py index bda117d3a5..93596c895d 100644 --- a/tests/py/ptq/test_ptq_trt_calibrator.py +++ b/tests/py/ptq/test_ptq_trt_calibrator.py @@ -75,7 +75,7 @@ def get_batch(self, names): ): return None - batch = self.dataset_iterator.next() + batch = next(self.dataset_iterator) self.current_batch_idx += self.batch_size # Treat the first element as input and others as targets. if isinstance(batch, list): From 3b45c801c39fc14bb8a50536cc31dcec6c022527 Mon Sep 17 00:00:00 2001 From: Dheeraj Peri Date: Thu, 8 Sep 2022 10:49:53 -0700 Subject: [PATCH 2/2] chore: Linter fixes Signed-off-by: Dheeraj Peri --- noxfile.py | 2 +- tests/core/conversion/converters/test_select.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index 193a384706..1a8246e18e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -269,7 +269,7 @@ def run_trt_compatibility_tests(session): session.chdir(os.path.join(TOP_DIR, "tests/py")) tests = [ "integrations/test_trt_intercompatibility.py", - #"ptq/test_ptq_trt_calibrator.py", + # "ptq/test_ptq_trt_calibrator.py", ] for test in tests: if USE_HOST_DEPS: diff --git a/tests/core/conversion/converters/test_select.cpp b/tests/core/conversion/converters/test_select.cpp index d77fa37d40..e9405c0155 100644 --- a/tests/core/conversion/converters/test_select.cpp +++ b/tests/core/conversion/converters/test_select.cpp @@ -865,7 +865,7 @@ TEST(Converters, ScatterValueConvertsCorrectly) { %5 : NoneType = prim::Constant() %6 : bool = prim::Constant[value=0]() %7 : int = prim::Constant[value=4]() - %index : Tensor = aten::to(%index.1, %7, %6, %6, %5) + %index : Tensor = aten::to(%index.1, %7, %6, %6, %5) %10 : Tensor = aten::scatter(%data, %dim, %index, %value) return (%10))IR"; @@ -900,7 +900,7 @@ TEST(Converters, ScatterSrcConvertsCorrectly) { %5 : NoneType = prim::Constant() %6 : bool = prim::Constant[value=0]() %7 : int = prim::Constant[value=4]() - %index : Tensor = aten::to(%index.1, %7, %6, %6, %5) + %index : Tensor = aten::to(%index.1, %7, %6, %6, %5) %10 : Tensor = aten::scatter(%data, %dim, %index, %src) return (%10))IR";