Skip to content

Commit 3fad293

Browse files
authored
ICM fixes (3/n) (#27925)
### Description Fix ICM issue: https://portal.microsofticm.com/imp/v5/incidents/details/31000000567822/summary The ICM is mainly about 2 issues in `validate_package.py` which was fixed by #27840. But the ICM also references another issue in `whisper_jump_times.py` which is what this PR fixes ### Motivation and Context ICM fixes
1 parent efc89b5 commit 3fad293

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

onnxruntime/python/tools/transformers/models/whisper/whisper_jump_times.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
import logging
88
import os
9+
import subprocess
10+
import sys
911
import tempfile
1012
import textwrap
1113
from pathlib import Path
@@ -201,9 +203,9 @@ def create_torch_ops(self):
201203
assert torch.utils.cpp_extension.verify_ninja_availability()
202204
except Exception as e:
203205
logger.error(f"An error occurred while verifying `ninja` is available: {e}", exc_info=True) # noqa: G201
204-
install_cmd = "pip install ninja"
205-
logger.warning(f"Could not import `ninja`. Attempting to install `ninja` via `{install_cmd}`.")
206-
os.system(install_cmd)
206+
install_cmd = [sys.executable, "-m", "pip", "install", "ninja"]
207+
logger.warning("Could not import `ninja`. Attempting to install `ninja` via `%s`.", " ".join(install_cmd))
208+
subprocess.run(install_cmd, check=True)
207209

208210
# Create UnfoldTensor torch op
209211
unfold_op_source = textwrap.dedent("""\

0 commit comments

Comments
 (0)