diff --git a/__init__.py b/__init__.py index 9110b76..7306dcb 100644 --- a/__init__.py +++ b/__init__.py @@ -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 = { diff --git a/__pycache__/__init__.cpython-310.pyc b/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..762a1ad Binary files /dev/null and b/__pycache__/__init__.cpython-310.pyc differ diff --git a/__pycache__/__init__.cpython-311.pyc b/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index 525c667..0000000 Binary files a/__pycache__/__init__.cpython-311.pyc and /dev/null differ diff --git a/__pycache__/preprocess.cpython-310.pyc b/__pycache__/preprocess.cpython-310.pyc new file mode 100644 index 0000000..c8c7063 Binary files /dev/null and b/__pycache__/preprocess.cpython-310.pyc differ diff --git a/__pycache__/preprocess.cpython-311.pyc b/__pycache__/preprocess.cpython-311.pyc deleted file mode 100644 index 8783977..0000000 Binary files a/__pycache__/preprocess.cpython-311.pyc and /dev/null differ diff --git a/__pycache__/prompt_generator.cpython-310.pyc b/__pycache__/prompt_generator.cpython-310.pyc new file mode 100644 index 0000000..adc7868 Binary files /dev/null and b/__pycache__/prompt_generator.cpython-310.pyc differ diff --git a/__pycache__/prompt_generator.cpython-311.pyc b/__pycache__/prompt_generator.cpython-311.pyc deleted file mode 100644 index f5e66de..0000000 Binary files a/__pycache__/prompt_generator.cpython-311.pyc and /dev/null differ diff --git a/generator/__init__.py b/generator/__init__.py new file mode 100644 index 0000000..7544ad1 --- /dev/null +++ b/generator/__init__.py @@ -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 + ) +""" \ No newline at end of file diff --git a/generator/__pycache__/__init__.cpython-310.pyc b/generator/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..fb78b36 Binary files /dev/null and b/generator/__pycache__/__init__.cpython-310.pyc differ diff --git a/generator/__pycache__/generate.cpython-310.pyc b/generator/__pycache__/generate.cpython-310.pyc new file mode 100644 index 0000000..4ee2b37 Binary files /dev/null and b/generator/__pycache__/generate.cpython-310.pyc differ diff --git a/generator/__pycache__/generate.cpython-311.pyc b/generator/__pycache__/generate.cpython-311.pyc deleted file mode 100644 index 73c9058..0000000 Binary files a/generator/__pycache__/generate.cpython-311.pyc and /dev/null differ diff --git a/generator/__pycache__/model.cpython-310.pyc b/generator/__pycache__/model.cpython-310.pyc new file mode 100644 index 0000000..a43f833 Binary files /dev/null and b/generator/__pycache__/model.cpython-310.pyc differ diff --git a/generator/__pycache__/model.cpython-311.pyc b/generator/__pycache__/model.cpython-311.pyc deleted file mode 100644 index e981fc8..0000000 Binary files a/generator/__pycache__/model.cpython-311.pyc and /dev/null differ diff --git a/generator/__pycache__/utility.cpython-310.pyc b/generator/__pycache__/utility.cpython-310.pyc new file mode 100644 index 0000000..58b5832 Binary files /dev/null and b/generator/__pycache__/utility.cpython-310.pyc differ diff --git a/generator/__pycache__/utility.cpython-311.pyc b/generator/__pycache__/utility.cpython-311.pyc deleted file mode 100644 index 8edd9fc..0000000 Binary files a/generator/__pycache__/utility.cpython-311.pyc and /dev/null differ