Spaces:
Sleeping
Sleeping
bann commited on
Commit ·
7ad0a73
1
Parent(s): 90b0db1
fix(diffusers): import WanImageToVideoPipeline, WanPipeline, and DiffusionPipeline safely
Browse files
app.py
CHANGED
|
@@ -216,7 +216,7 @@ def normalize_civitai_url(url: str) -> str:
|
|
| 216 |
|
| 217 |
def resolve_canvas(value: str) -> str:
|
| 218 |
canvas = str(value).strip()
|
| 219 |
-
if canvas in CANVASES:
|
| 220 |
return canvas
|
| 221 |
return DEFAULT_CANVAS
|
| 222 |
|
|
@@ -412,7 +412,7 @@ def load_pipeline(model_repo: str = DEFAULT_MODEL_REPO):
|
|
| 412 |
|
| 413 |
started = time.time()
|
| 414 |
try:
|
| 415 |
-
from diffusers import
|
| 416 |
|
| 417 |
print(f"[wan] loading pipeline from {model_repo} ...", flush=True)
|
| 418 |
if "I2V" in model_repo or "i2v" in model_repo or "TI2V" in model_repo:
|
|
@@ -422,7 +422,7 @@ def load_pipeline(model_repo: str = DEFAULT_MODEL_REPO):
|
|
| 422 |
torch_dtype=torch.bfloat16,
|
| 423 |
)
|
| 424 |
except Exception:
|
| 425 |
-
pipe =
|
| 426 |
model_repo,
|
| 427 |
torch_dtype=torch.bfloat16,
|
| 428 |
)
|
|
@@ -433,7 +433,7 @@ def load_pipeline(model_repo: str = DEFAULT_MODEL_REPO):
|
|
| 433 |
torch_dtype=torch.bfloat16,
|
| 434 |
)
|
| 435 |
except Exception:
|
| 436 |
-
pipe =
|
| 437 |
model_repo,
|
| 438 |
torch_dtype=torch.bfloat16,
|
| 439 |
)
|
|
|
|
| 216 |
|
| 217 |
def resolve_canvas(value: str) -> str:
|
| 218 |
canvas = str(value).strip()
|
| 219 |
+
if canvas in CANVACES if "CANVACES" in locals() else CANVASES:
|
| 220 |
return canvas
|
| 221 |
return DEFAULT_CANVAS
|
| 222 |
|
|
|
|
| 412 |
|
| 413 |
started = time.time()
|
| 414 |
try:
|
| 415 |
+
from diffusers import DiffusionPipeline, WanImageToVideoPipeline, WanPipeline
|
| 416 |
|
| 417 |
print(f"[wan] loading pipeline from {model_repo} ...", flush=True)
|
| 418 |
if "I2V" in model_repo or "i2v" in model_repo or "TI2V" in model_repo:
|
|
|
|
| 422 |
torch_dtype=torch.bfloat16,
|
| 423 |
)
|
| 424 |
except Exception:
|
| 425 |
+
pipe = DiffusionPipeline.from_pretrained(
|
| 426 |
model_repo,
|
| 427 |
torch_dtype=torch.bfloat16,
|
| 428 |
)
|
|
|
|
| 433 |
torch_dtype=torch.bfloat16,
|
| 434 |
)
|
| 435 |
except Exception:
|
| 436 |
+
pipe = DiffusionPipeline.from_pretrained(
|
| 437 |
model_repo,
|
| 438 |
torch_dtype=torch.bfloat16,
|
| 439 |
)
|