Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,7 @@ import tempfile
|
|
| 13 |
import numpy as np
|
| 14 |
from PIL import Image
|
| 15 |
import random
|
| 16 |
-
|
| 17 |
from optimization import optimize_pipeline_
|
| 18 |
|
| 19 |
|
|
@@ -64,16 +64,19 @@ pipe.load_lora_weights(
|
|
| 64 |
)
|
| 65 |
kwargs = {}
|
| 66 |
kwargs["load_into_transformer_2"] = True
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
pipe.fuse_lora(adapter_names=["phantom"], lora_scale=3., components=["transformer"])
|
| 74 |
-
|
| 75 |
pipe.unload_lora_weights()
|
| 76 |
|
|
|
|
|
|
|
|
|
|
| 77 |
optimize_pipeline_(pipe,
|
| 78 |
image=Image.new('RGB', (LANDSCAPE_WIDTH, LANDSCAPE_HEIGHT)),
|
| 79 |
prompt='prompt',
|
|
|
|
| 13 |
import numpy as np
|
| 14 |
from PIL import Image
|
| 15 |
import random
|
| 16 |
+
import gc
|
| 17 |
from optimization import optimize_pipeline_
|
| 18 |
|
| 19 |
|
|
|
|
| 64 |
)
|
| 65 |
kwargs = {}
|
| 66 |
kwargs["load_into_transformer_2"] = True
|
| 67 |
+
pipe.load_lora_weights(
|
| 68 |
+
"vrgamedevgirl84/Wan14BT2VFusioniX",
|
| 69 |
+
weight_name="FusionX_LoRa/Phantom_Wan_14B_FusionX_LoRA.safetensors",
|
| 70 |
+
adapter_name="phantom_2", **kwargs
|
| 71 |
+
)
|
| 72 |
+
pipe.set_adapters(["phantom", "phantom_2"], adapter_weights=[1., 1.])
|
| 73 |
pipe.fuse_lora(adapter_names=["phantom"], lora_scale=3., components=["transformer"])
|
| 74 |
+
pipe.fuse_lora(adapter_names=["phantom_2"], lora_scale=1., components=["transformer_2"])
|
| 75 |
pipe.unload_lora_weights()
|
| 76 |
|
| 77 |
+
torch.cuda.empty_cache()
|
| 78 |
+
gc.collect()
|
| 79 |
+
|
| 80 |
optimize_pipeline_(pipe,
|
| 81 |
image=Image.new('RGB', (LANDSCAPE_WIDTH, LANDSCAPE_HEIGHT)),
|
| 82 |
prompt='prompt',
|