Skip to content

Commit 2613260

Browse files
authored
refactor: コアラッパー内のネストを解消 (#1601)
1 parent cca6daf commit 2613260

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

voicevox_engine/core/core_wrapper.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -399,14 +399,14 @@ def load_core(core_dir: Path, use_gpu: bool) -> CDLL:
399399
return CDLL(str((core_dir / core_name).resolve(strict=True)))
400400
except OSError as e:
401401
_e = e
402-
if model_type == "libtorch":
403-
core_name = _get_suitable_core_name(model_type, gpu_type=GPUType.CUDA)
404-
if core_name:
405-
try:
406-
return CDLL(str((core_dir / core_name).resolve(strict=True)))
407-
except OSError as e_retry:
408-
_e = e_retry
409-
raise RuntimeError(f"コアの読み込みに失敗しました:{_e}") from _e
402+
if model_type == "libtorch":
403+
core_name = _get_suitable_core_name(model_type, gpu_type=GPUType.CUDA)
404+
if core_name:
405+
try:
406+
return CDLL(str((core_dir / core_name).resolve(strict=True)))
407+
except OSError as e:
408+
_e = e
409+
raise RuntimeError(f"コアの読み込みに失敗しました:{_e}") from _e
410410
else:
411411
raise RuntimeError(
412412
f"このコンピュータのアーキテクチャ {platform.machine()} で利用可能なコアがありません"

0 commit comments

Comments
 (0)