diff --git a/install.py b/install.py new file mode 100644 index 0000000..7daaa9d --- /dev/null +++ b/install.py @@ -0,0 +1,50 @@ +import sys +import subprocess +import locale +import threading +import os + + +def handle_stream(stream, prefix): + stream.reconfigure(encoding=locale.getpreferredencoding(), errors='replace') + for msg in stream: + if prefix == '[!]' and ('it/s]' in msg or 's/it]' in msg) and ('%|' in msg or 'it [' in msg): + if msg.startswith('100%'): + print('\r' + msg, end="", file=sys.stderr), + else: + print('\r' + msg[:-1], end="", file=sys.stderr), + else: + if prefix == '[!]': + print(prefix, msg, end="", file=sys.stderr) + else: + print(prefix, msg, end="") + + +def process_wrap(cmd_str, cwd_path, handler=None): + process = subprocess.Popen(cmd_str, cwd=cwd_path, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, bufsize=1) + + if handler is None: + handler = handle_stream + + stdout_thread = threading.Thread(target=handler, args=(process.stdout, "")) + stderr_thread = threading.Thread(target=handler, args=(process.stderr, "[!]")) + + stdout_thread.start() + stderr_thread.start() + + stdout_thread.join() + stderr_thread.join() + + return process.wait() + +assert process_wrap([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"], cwd_path=os.path.dirname(os.path.realpath(__file__))) == 0, "ERROR: Failed to install requirements.txt. Please install them manually, and restart ComfyUI." + +nodep_packages = [ + "torchvision", + "kornia>=0.6.9", + "xformers>=0.0.20", + "open-clip-torch>=2.20.0", + "timm" +] + +assert process_wrap([sys.executable, "-m", "pip", "install", "--no-deps", *nodep_packages], cwd_path=os.path.dirname(os.path.realpath(__file__))) == 0, "ERROR: Failed to install last set of packages. Please install them manually, and restart ComfyUI." \ No newline at end of file diff --git a/prestartup_script.py b/prestartup_script.py index 68f899c..45f6fd5 100644 --- a/prestartup_script.py +++ b/prestartup_script.py @@ -16,5 +16,5 @@ existing_svd_models = os.listdir(svd_models_dir) for model_name, model_url in SVD_MODEL_URLS.items(): if model_name not in existing_svd_models: - print(f"Downloading {model_name}...") - os.system(f'wget -O {os.path.join(svd_models_dir, model_name)} "{model_url}"') \ No newline at end of file + print(f"Downloading SVD model: {model_name}...") + os.system(f'wget -q --show-progress -O {os.path.join(svd_models_dir, model_name)} "{model_url}"') \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index e7f4cc9..227306d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,27 @@ numpy fsspec -torchvision matplotlib requests omegaconf -kornia>=0.6.9 -open-clip-torch>=2.20.0 transformers -xformers>=0.0.20 -pytorch-lightning \ No newline at end of file +pytorch-lightning + +#torchvision + +#kornia>=0.6.9 +packaging + + +#xformers>=0.0.20 + + +#open-clip-torch>=2.20.0 +regex +ftfy +tqdm +sentencepiece +protobuf + +#timm +pyyaml +huggingface_hub \ No newline at end of file