This commit is contained in:
thecooltechguy
2023-11-24 05:54:15 +00:00
parent 1d3917cfbf
commit 470c762524
3 changed files with 73 additions and 7 deletions
+50
View File
@@ -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."
+2 -2
View File
@@ -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}"')
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}"')
+21 -5
View File
@@ -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
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