win-ci: 조사 2 (winrt msvcp140 순서), ffmpeg 없으면 테스트 건너뜀
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,48 +1,18 @@
|
|||||||
"""Windows 에서 워커가 모델 적재 중 조용히 죽는 원인 조사."""
|
"""Windows 워커 크래시 원인 조사 2: winrt 가 자체 msvcp140.dll 을 먼저 올리면 onnxruntime/ctranslate2 가 죽는가."""
|
||||||
|
import glob
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
CODE = r'''
|
sp = os.path.join(sys.prefix, "Lib", "site-packages")
|
||||||
import faulthandler, sys, os
|
for f in glob.glob(os.path.join(sp, "**", "msvcp140*.dll"), recursive=True) + glob.glob(os.path.join(sp, "**", "vcruntime140*.dll"), recursive=True):
|
||||||
faulthandler.enable()
|
v = subprocess.run(["powershell", "-NoProfile", "-Command", f"(Get-Item '{f}').VersionInfo.FileVersion"], capture_output=True, text=True).stdout.strip()
|
||||||
print("python", sys.version, flush=True)
|
print("bundled", f.replace(sp, "site-packages"), v, flush=True)
|
||||||
import ctranslate2
|
for code in [
|
||||||
print("ct2", ctranslate2.__version__, "cuda devices", ctranslate2.get_cuda_device_count(), flush=True)
|
"import winrt.windows.media.ocr; import onnxruntime; print('winrt then ort ok')",
|
||||||
print("cpu compute types", ctranslate2.get_supported_compute_types("cpu"), flush=True)
|
"import winrt.windows.media.ocr; import ctranslate2; print('winrt then ct2 ok')",
|
||||||
from faster_whisper import WhisperModel
|
"import onnxruntime, ctranslate2; import winrt.windows.media.ocr; print('ort,ct2 then winrt ok')",
|
||||||
m = WhisperModel(os.environ["M"], device="cpu", compute_type=os.environ.get("CT", "int8"), cpu_threads=2)
|
"import gvr_worker.ocr as o; import onnxruntime; print('gvr ocr then ort ok')",
|
||||||
print("LOAD OK", flush=True)
|
]:
|
||||||
segs, info = m.transcribe(os.environ["A"], language="ko")
|
p = subprocess.run([sys.executable, "-X", "faulthandler", "-c", code], capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=300, cwd=os.path.join(os.path.dirname(__file__), ".."))
|
||||||
print("TEXT", "".join(s.text for s in segs), flush=True)
|
print(f"--- {code} -> exit {p.returncode} (0x{p.returncode & 0xffffffff:08X})", p.stdout.strip()[-200:], p.stderr.strip()[-600:], flush=True)
|
||||||
'''
|
|
||||||
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
||||||
audio = os.path.join(root, "app", "resources", "diag", "speech_ko.ogg")
|
|
||||||
model = None
|
|
||||||
for base in [os.environ.get("TEMP", ""), os.path.expanduser("~")]:
|
|
||||||
for dp, dn, fn in os.walk(base):
|
|
||||||
if "model.bin" in fn and dp.rstrip("\\/").endswith("tiny"):
|
|
||||||
model = dp
|
|
||||||
break
|
|
||||||
if dp.count(os.sep) - base.count(os.sep) > 4:
|
|
||||||
dn[:] = []
|
|
||||||
if model:
|
|
||||||
break
|
|
||||||
print("model dir", model, flush=True)
|
|
||||||
# onnxruntime 단독 / 다른 패키지 뒤 import, MSVC 런타임 버전
|
|
||||||
for code in ["import onnxruntime; print('ort', onnxruntime.__version__)",
|
|
||||||
"import av, ctranslate2; import onnxruntime; print('ort after av+ct2 ok')",
|
|
||||||
"import onnxruntime, av, ctranslate2; print('ort first ok')"]:
|
|
||||||
p = subprocess.run([sys.executable, "-X", "faulthandler", "-c", code], capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=300)
|
|
||||||
print(f"--- {code} -> exit {p.returncode} (0x{p.returncode & 0xffffffff:08X})", p.stdout.strip()[-300:], p.stderr.strip()[-800:], flush=True)
|
|
||||||
ps = "foreach ($f in 'msvcp140.dll','vcruntime140.dll','vcruntime140_1.dll') { $p = Join-Path $env:WINDIR ('System32\\' + $f); if (Test-Path $p) { $f + ' ' + (Get-Item $p).VersionInfo.FileVersion } else { $f + ' 없음' } }"
|
|
||||||
print(subprocess.run(["powershell", "-NoProfile", "-Command", ps], capture_output=True, text=True).stdout, flush=True)
|
|
||||||
import glob
|
|
||||||
for f in glob.glob(os.path.join(sys.prefix, "Lib", "site-packages", "**", "msvcp140*.dll"), recursive=True):
|
|
||||||
print("bundled", f, flush=True)
|
|
||||||
for env in [{}, {"KMP_DUPLICATE_LIB_OK": "TRUE"}, {"CT": "float32"}, {"OMP_NUM_THREADS": "1", "CT": "float32"}]:
|
|
||||||
e = {**os.environ, "M": model or "tiny", "A": audio, **env}
|
|
||||||
p = subprocess.run([sys.executable, "-X", "faulthandler", "-c", CODE], env=e, capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=600)
|
|
||||||
print(f"=== env={env} exit={p.returncode} (0x{p.returncode & 0xffffffff:08X})", flush=True)
|
|
||||||
print(p.stdout[-1500:], flush=True)
|
|
||||||
print("stderr:", p.stderr[-2500:], flush=True)
|
|
||||||
|
|||||||
@@ -26,8 +26,14 @@ def test_prepare_normalizes_quiet_speech() -> None:
|
|||||||
|
|
||||||
|
|
||||||
def test_short_utterance_uses_profile(tmp_path) -> None:
|
def test_short_utterance_uses_profile(tmp_path) -> None:
|
||||||
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
if not shutil.which("ffmpeg"):
|
||||||
|
pytest.skip("ffmpeg 없음 (픽스처 생성용)")
|
||||||
|
|
||||||
src = tmp_path / "short.ogg"
|
src = tmp_path / "short.ogg"
|
||||||
subprocess.run(["ffmpeg", "-y", "-loglevel", "error", "-i", str(FIXTURES / "speech_ko.ogg"), "-t", "0.3",
|
subprocess.run(["ffmpeg", "-y", "-loglevel", "error", "-i", str(FIXTURES / "speech_ko.ogg"), "-t", "0.3",
|
||||||
"-c:a", "libopus", str(src)], check=True)
|
"-c:a", "libopus", str(src)], check=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user