77
88from transformers import BertModel
99
10- from utils import COSINE_THRESHOLD , cosine_similarity
10+ from torch_tensorrt .dynamo .common_utils .test_utils import (
11+ COSINE_THRESHOLD ,
12+ cosine_similarity ,
13+ )
1114
1215
1316@pytest .mark .unit
@@ -24,13 +27,14 @@ def test_resnet18(ir):
2427 "device" : torchtrt .Device ("cuda:0" ),
2528 "enabled_precisions" : {torch .float },
2629 "ir" : ir ,
30+ "pass_through_build_failures" : True ,
2731 }
2832
2933 trt_mod = torchtrt .compile (model , ** compile_spec )
3034 cos_sim = cosine_similarity (model (input ), trt_mod (input ))
3135 assert (
3236 cos_sim > COSINE_THRESHOLD ,
33- f"Resnet50 TRT outputs don't match with the original model. Cosine sim score: { cos_sim } Threshold: { COSINE_THRESHOLD } " ,
37+ f"Resnet18 TRT outputs don't match with the original model. Cosine sim score: { cos_sim } Threshold: { COSINE_THRESHOLD } " ,
3438 )
3539
3640 # Clean up model env
@@ -54,6 +58,7 @@ def test_mobilenet_v2(ir):
5458 "device" : torchtrt .Device ("cuda:0" ),
5559 "enabled_precisions" : {torch .float },
5660 "ir" : ir ,
61+ "pass_through_build_failures" : True ,
5762 }
5863
5964 trt_mod = torchtrt .compile (model , ** compile_spec )
@@ -84,6 +89,7 @@ def test_efficientnet_b0(ir):
8489 "device" : torchtrt .Device ("cuda:0" ),
8590 "enabled_precisions" : {torch .float },
8691 "ir" : ir ,
92+ "pass_through_build_failures" : True ,
8793 }
8894
8995 trt_mod = torchtrt .compile (model , ** compile_spec )
@@ -123,6 +129,7 @@ def test_bert_base_uncased(ir):
123129 "enabled_precisions" : {torch .float },
124130 "truncate_long_and_double" : True ,
125131 "ir" : ir ,
132+ "pass_through_build_failures" : True ,
126133 }
127134 trt_mod = torchtrt .compile (model , ** compile_spec )
128135
@@ -157,13 +164,14 @@ def test_resnet18_half(ir):
157164 "device" : torchtrt .Device ("cuda:0" ),
158165 "enabled_precisions" : {torch .half },
159166 "ir" : ir ,
167+ "pass_through_build_failures" : True ,
160168 }
161169
162170 trt_mod = torchtrt .compile (model , ** compile_spec )
163171 cos_sim = cosine_similarity (model (input ), trt_mod (input ))
164172 assert (
165173 cos_sim > COSINE_THRESHOLD ,
166- f"Resnet50 Half TRT outputs don't match with the original model. Cosine sim score: { cos_sim } Threshold: { COSINE_THRESHOLD } " ,
174+ f"Resnet18 Half TRT outputs don't match with the original model. Cosine sim score: { cos_sim } Threshold: { COSINE_THRESHOLD } " ,
167175 )
168176
169177 # Clean up model env
0 commit comments