licyk commited on
Commit
cbef07e
·
verified ·
1 Parent(s): 79b9b35

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -0
README.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 仓库中的 LoRA 已移除其中的 Norm 块,使其兼容 InvokeAI 5.6.0 及以上的版本,避免`AttributeError: 'LayerNorm' object has no attribute 'get_num_patches'`。
2
+
3
+ 移除 Norm 层代码。
4
+
5
+ ```python
6
+ import os
7
+ from safetensors.torch import load_file, save_file
8
+
9
+
10
+ lora_path = "D:/Downloads/BaiduNetdiskDownload/ill-xl-01-rurudo_3-000034.safetensors"
11
+ save_path = os.path.join(
12
+ os.path.dirname(lora_path),
13
+ os.path.splitext(os.path.basename(lora_path))[0] + "_without_norm_block.safetensors"
14
+ )
15
+ norm_block_list = []
16
+ model_weights = load_file(lora_path)
17
+
18
+ for block, _ in model_weights.items():
19
+ if "norm" in block:
20
+ norm_block_list.append(block)
21
+
22
+ for block in norm_block_list:
23
+ del model_weights[block]
24
+
25
+ save_file(model_weights, save_path)
26
+ ```