From 87706b7450d87873fae886aad570b9542a3a11fc Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Sun, 16 Jul 2023 09:38:40 +0200 Subject: [PATCH] fix: failed to install onnxruntime package on MacOS as proposed (here)[https://github.com/toriato/stable-diffusion-webui-wd14-tagger/pull/83/files] --- scripts/tagger/interrogator.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/tagger/interrogator.py b/scripts/tagger/interrogator.py index 13b256a..19407ae 100644 --- a/scripts/tagger/interrogator.py +++ b/scripts/tagger/interrogator.py @@ -4,6 +4,7 @@ import io from hashlib import sha256 import json +from platform import system from typing import Tuple, List, Dict, Callable from pandas import read_csv, read_json from PIL import Image, UnidentifiedImageError @@ -438,9 +439,13 @@ def load(self) -> None: # TODO: remove old package when the environment changes? from launch import is_installed, run_pip if not is_installed('onnxruntime'): + if system() == "Darwin": + package_name = "onnxruntime-silicon" + else: + package_name = "onnxruntime-gpu" package = os.environ.get( 'ONNXRUNTIME_PACKAGE', - 'onnxruntime-gpu' + package_name ) run_pip(f'install {package}', 'onnxruntime')