Use Multithread in ONNX Session

This commit is contained in:
XXXXRT666 2025-05-14 09:36:23 +01:00 committed by GitHub
parent 7b94189747
commit e3e147d4f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -90,7 +90,7 @@ class G2PWOnnxConverter:
sess_options = onnxruntime.SessionOptions()
sess_options.graph_optimization_level = onnxruntime.GraphOptimizationLevel.ORT_ENABLE_ALL
sess_options.execution_mode = onnxruntime.ExecutionMode.ORT_SEQUENTIAL
sess_options.intra_op_num_threads = 2
sess_options.intra_op_num_threads = 2 if torch.cuda.is_available() else 0
try:
self.session_g2pW = onnxruntime.InferenceSession(
os.path.join(uncompress_path, "g2pW.onnx"),