5
5
import pytest
6
6
import torch
7
7
8
- import tests_pytorch .helpers .pipelines as tpipes
8
+ import tests_pytorch .helpers .pipelines as pipes
9
9
from lightning .pytorch .demos .boring_classes import BoringModel
10
10
from tests_pytorch .helpers .runif import RunIf
11
11
12
12
13
- @RunIf (tensorrt = True , min_cuda_gpus = 1 )
13
+ @RunIf (tensorrt = True , min_cuda_gpus = 1 , min_torch = "2.2.0" )
14
14
def test_tensorrt_saves_with_input_sample (tmp_path ):
15
15
model = BoringModel ()
16
16
ori_device = model .device
@@ -34,6 +34,7 @@ def test_tensorrt_saves_with_input_sample(tmp_path):
34
34
assert len (file_path .getvalue ()) > 4e2
35
35
36
36
37
+ @RunIf (tensorrt = True , min_cuda_gpus = 1 , min_torch = "2.2.0" )
37
38
def test_tensorrt_error_if_no_input (tmp_path ):
38
39
model = BoringModel ()
39
40
model .example_input_array = None
@@ -47,7 +48,7 @@ def test_tensorrt_error_if_no_input(tmp_path):
47
48
model .to_tensorrt (file_path )
48
49
49
50
50
- @RunIf (tensorrt = True , min_cuda_gpus = 2 )
51
+ @RunIf (tensorrt = True , min_cuda_gpus = 2 , min_torch = "2.2.0" )
51
52
def test_tensorrt_saves_on_multi_gpu (tmp_path ):
52
53
trainer_options = {
53
54
"default_root_dir" : tmp_path ,
@@ -63,7 +64,7 @@ def test_tensorrt_saves_on_multi_gpu(tmp_path):
63
64
model = BoringModel ()
64
65
model .example_input_array = torch .randn ((4 , 32 ))
65
66
66
- tpipes .run_model_test (trainer_options , model , min_acc = 0.08 )
67
+ pipes .run_model_test (trainer_options , model , min_acc = 0.08 )
67
68
68
69
file_path = os .path .join (tmp_path , "model.trt" )
69
70
model .to_tensorrt (file_path )
@@ -79,7 +80,7 @@ def test_tensorrt_saves_on_multi_gpu(tmp_path):
79
80
("ts" , torch .jit .ScriptModule ),
80
81
],
81
82
)
82
- @RunIf (tensorrt = True , min_cuda_gpus = 1 )
83
+ @RunIf (tensorrt = True , min_cuda_gpus = 1 , min_torch = "2.2.0" )
83
84
def test_tensorrt_save_ir_type (ir , export_type ):
84
85
model = BoringModel ()
85
86
model .example_input_array = torch .randn ((4 , 32 ))
@@ -96,7 +97,7 @@ def test_tensorrt_save_ir_type(ir, export_type):
96
97
"ir" ,
97
98
["default" , "dynamo" , "ts" ],
98
99
)
99
- @RunIf (tensorrt = True , min_cuda_gpus = 1 )
100
+ @RunIf (tensorrt = True , min_cuda_gpus = 1 , min_torch = "2.2.0" )
100
101
def test_tensorrt_export_reload (output_format , ir , tmp_path ):
101
102
import torch_tensorrt
102
103
0 commit comments