fixed clone and run bug

This commit is contained in:
alpertunga-bile
2023-09-05 21:27:50 +03:00
parent 2cfd10cc85
commit 7d307d5673
15 changed files with 38 additions and 44 deletions
-44
View File
@@ -11,15 +11,6 @@ path.append(dirname(__file__))
from prompt_generator import PromptGenerator
def check_package(package_name: str) -> None:
if find_spec(package_name) is None:
print(f"/_\ Installing {package_name}")
process = run(
f"pip install {package_name}", shell=True, check=True, capture_output=True
)
print("/_\ Loading Prompt Generator")
# Check prompt_generators folder under models folder
@@ -32,41 +23,6 @@ if exists(root) is False:
if exists("generated_prompts") is False:
mkdir("generated_prompts")
# Check required packages
# Installing from git because there is a error with normal transformers package
if find_spec("transformers") is None:
print(f"/_\ Installing transformers")
process = run(
f"pip install git+https://github.com/huggingface/transformers",
shell=True,
check=True,
capture_output=True,
)
check_package("accelerate")
check_package("xformers")
if os_name == "Linux":
check_package("triton")
check_package("optimum")
if find_spec("onnxruntime") is None:
print(f"/_\ Installing onnxruntime")
process = run(
f"pip install optimum[onnxruntime]", shell=True, check=True, capture_output=True
)
if find_spec("onnxruntime-gpu") is None:
print(f"/_\ Installing onnxruntime-gpu")
process = run(
f"pip install optimum[onnxruntime-gpu]",
shell=True,
check=True,
capture_output=True,
)
# Import PromptGenerator node to ComfyUI
NODE_CLASS_MAPPINGS = {
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+38
View File
@@ -0,0 +1,38 @@
from sys import path
from os.path import dirname
from subprocess import run
from importlib.util import find_spec
from platform import system
os_name = system()
path.append(dirname(__file__))
def check_package(package_name: str, install_name: str) -> None:
if find_spec(package_name) is None:
print(f"/_\ Installing {package_name}")
process = run(
f"pip install {install_name}", shell=True, check=True, capture_output=True
)
# Check required packages
print("/_\ Checking packages")
# Installing from git because there is an error with normal transformers package
check_package("transformers", "git+https://github.com/huggingface/transformers")
check_package("accelerate", "accelerate")
if os_name == "Linux":
check_package("triton", "triton")
check_package("optimum", "optimum")
check_package("onnxruntime-gpu", "optimum[onnxruntime-gpu]")
"""
# This package is for onnx models that run on CPU
if find_spec("onnxruntime") is None:
print(f"/_\ Installing onnxruntime")
process = run(
f"pip install optimum[onnxruntime]", shell=True, check=True, capture_output=True
)
"""
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.