forked from shariqfarooq123/LooseControl
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathweight_fusion.py
More file actions
28 lines (22 loc) · 811 Bytes
/
weight_fusion.py
File metadata and controls
28 lines (22 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from loosecontrol import LooseControlNet
FUSION_SCALE = 1.0
USE_CUDA = True
USE_HUGGINGFACE_WEIGHTS = True
if __name__ == "__main__":
print(f"""
Fusing weights with configs:
FUSION_SCALE: {FUSION_SCALE}
USE_CUDA: {USE_CUDA}
USE_HUGGINGFACE_WEIGHTS: {USE_HUGGINGFACE_WEIGHTS}
You can modify these in this script.
""")
if USE_HUGGINGFACE_WEIGHTS:
lcn = LooseControlNet("shariqfarooq/loose-control-3dbox")
else:
# Modify below to use your pre-downloaded weights
lcn = LooseControlNet(loose_control_weights="..", cn_checkpoint="..", sd_checkpoint="..")
if USE_CUDA:
lcn = lcn.to("cuda")
lcn.pipe.controlnet.fuse_lora(lora_scale=FUSION_SCALE)
lcn.pipe.controlnet.save_pretrained("./fused_weights")
print("Done! Saved to ./fused_weights")