@@ -176,36 +176,49 @@ def _validate_optimization_configuration(
176
176
)
177
177
)
178
178
else :
179
- try :
180
- (
179
+ if optimization_combination . compilation . copy (). pop (): # Compilation is only enabled for TRT
180
+ try :
181
181
TRT_CONFIGURATION ["optimization_combination" ].validate_against (
182
182
optimization_combination , rule_set = _OptimizationContainer .TRT
183
183
)
184
- )
185
- except ValueError as trt_compare_error :
184
+ except ValueError as trt_compare_error :
185
+ raise ValueError (
186
+ (
187
+ f"Optimizations that use Compilation and { trt_compare_error } "
188
+ "are not supported for GPU instances."
189
+ )
190
+ )
191
+ else :
186
192
try :
187
193
(
188
194
VLLM_CONFIGURATION ["optimization_combination" ].validate_against (
189
195
optimization_combination , rule_set = _OptimizationContainer .VLLM
190
196
)
191
197
)
192
198
except ValueError as vllm_compare_error :
193
- if "Quantization must be provided with Compilation" in str (trt_compare_error ):
194
- joint_error_msg = f"""
199
+ try : # try both VLLM and TRT to cover both rule sets
200
+ (
201
+ TRT_CONFIGURATION ["optimization_combination" ].validate_against (
202
+ optimization_combination , rule_set = _OptimizationContainer .TRT
203
+ )
204
+ )
205
+ except ValueError as trt_compare_error :
206
+ if "Quantization must be provided with Compilation" in str (trt_compare_error ):
207
+ joint_error_msg = f"""
195
208
Optimization cannot be performed for the following reasons:
196
209
- Optimizations that use { trt_compare_error } for GPU instances.
197
210
- Optimizations that use { vllm_compare_error } are not supported for GPU instances.
198
211
"""
199
- else :
200
- if str (trt_compare_error ) == str (vllm_compare_error ):
201
- joint_error_msg = f"""
212
+ else :
213
+ if str (trt_compare_error ) == str (vllm_compare_error ):
214
+ joint_error_msg = f"""
202
215
Optimization cannot be performed for the following reasons:
203
216
- Optimizations that use { trt_compare_error } are not supported for GPU instances.
204
217
"""
205
- else :
206
- joint_error_msg = f"""
218
+ else :
219
+ joint_error_msg = f"""
207
220
Optimization cannot be performed for the following reasons:
208
221
- Optimizations that use { trt_compare_error } are not supported for GPU instances.
209
222
- Optimizations that use { vllm_compare_error } are not supported for GPU instances.
210
223
"""
211
- raise ValueError (textwrap .dedent (joint_error_msg ))
224
+ raise ValueError (textwrap .dedent (joint_error_msg ))
0 commit comments