Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -56,14 +56,16 @@ def infer(image_path, prompt, orbit_type, progress=gr.Progress(track_tqdm=True))
|
|
56 |
lora_path = "checkpoints/"
|
57 |
if orbit_type == "Left":
|
58 |
weight_name = "orbit_left_lora_weights.safetensors"
|
59 |
-
adapter_name = "orbit_left_lora_weights"
|
60 |
elif orbit_type == "Up":
|
61 |
weight_name = "orbit_up_lora_weights.safetensors"
|
62 |
-
adapter_name = "
|
63 |
lora_rank = 256
|
64 |
|
|
|
|
|
65 |
# Load LoRA weights on CPU, move to GPU afterward
|
66 |
-
pipe.load_lora_weights(lora_path, weight_name=weight_name, adapter_name=
|
67 |
pipe.fuse_lora(lora_scale=1 / lora_rank)
|
68 |
|
69 |
# Move the pipeline to GPU for inference
|
@@ -84,6 +86,7 @@ def infer(image_path, prompt, orbit_type, progress=gr.Progress(track_tqdm=True))
|
|
84 |
generator=torch.Generator(device="cpu").manual_seed(seed)
|
85 |
)
|
86 |
|
|
|
87 |
pipe.unfuse_lora()
|
88 |
pipe.unload_lora_weights()
|
89 |
|
|
|
56 |
lora_path = "checkpoints/"
|
57 |
if orbit_type == "Left":
|
58 |
weight_name = "orbit_left_lora_weights.safetensors"
|
59 |
+
#adapter_name = "orbit_left_lora_weights"
|
60 |
elif orbit_type == "Up":
|
61 |
weight_name = "orbit_up_lora_weights.safetensors"
|
62 |
+
#adapter_name = "orbit_up_lora_weights"
|
63 |
lora_rank = 256
|
64 |
|
65 |
+
adapter_timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
66 |
+
|
67 |
# Load LoRA weights on CPU, move to GPU afterward
|
68 |
+
pipe.load_lora_weights(lora_path, weight_name=weight_name, adapter_name=adapter_timestamp)
|
69 |
pipe.fuse_lora(lora_scale=1 / lora_rank)
|
70 |
|
71 |
# Move the pipeline to GPU for inference
|
|
|
86 |
generator=torch.Generator(device="cpu").manual_seed(seed)
|
87 |
)
|
88 |
|
89 |
+
torch.cuda.empty_cache()
|
90 |
pipe.unfuse_lora()
|
91 |
pipe.unload_lora_weights()
|
92 |
|