Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,7 @@ import torch
|
|
| 10 |
import gradio as gr
|
| 11 |
from PIL import Image
|
| 12 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 13 |
|
| 14 |
def hf_hub_download_local(repo_id, filename, local_dir, **kwargs):
|
| 15 |
downloaded_path = hf_hub_download(repo_id=repo_id, filename=filename, **kwargs)
|
|
@@ -199,6 +200,17 @@ MODELS_AND_NODES["VAEDecode"] = NODE_CLASS_MAPPINGS["VAEDecode"]()
|
|
| 199 |
MODELS_AND_NODES["CreateVideo"] = NODE_CLASS_MAPPINGS["CreateVideo"]()
|
| 200 |
MODELS_AND_NODES["SaveVideo"] = NODE_CLASS_MAPPINGS["SaveVideo"]()
|
| 201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
print("All models loaded successfully!")
|
| 203 |
|
| 204 |
# --- Main Video Generation Logic ---
|
|
|
|
| 10 |
import gradio as gr
|
| 11 |
from PIL import Image
|
| 12 |
from huggingface_hub import hf_hub_download
|
| 13 |
+
from comfy import model_management
|
| 14 |
|
| 15 |
def hf_hub_download_local(repo_id, filename, local_dir, **kwargs):
|
| 16 |
downloaded_path = hf_hub_download(repo_id=repo_id, filename=filename, **kwargs)
|
|
|
|
| 200 |
MODELS_AND_NODES["CreateVideo"] = NODE_CLASS_MAPPINGS["CreateVideo"]()
|
| 201 |
MODELS_AND_NODES["SaveVideo"] = NODE_CLASS_MAPPINGS["SaveVideo"]()
|
| 202 |
|
| 203 |
+
print("Pre-loading main models onto GPU...")
|
| 204 |
+
model_loaders = [
|
| 205 |
+
MODELS_AND_NODES["clip"],
|
| 206 |
+
MODELS_AND_NODES["vae"],
|
| 207 |
+
MODELS_AND_NODES["model_low_noise"], # This is the UNET + LoRA
|
| 208 |
+
MODELS_AND_NODES["model_high_noise"], # This is the other UNET + LoRA
|
| 209 |
+
MODELS_AND_NODES["clip_vision"],
|
| 210 |
+
]
|
| 211 |
+
model_management.load_models_gpu([
|
| 212 |
+
loader[0].patcher if hasattr(loader[0], 'patcher') else loader[0] for loader in model_loaders
|
| 213 |
+
])
|
| 214 |
print("All models loaded successfully!")
|
| 215 |
|
| 216 |
# --- Main Video Generation Logic ---
|