Views
No views yet
AttributeError: 'LayerNorm' object has no attribute 'get_num_patches'。1import os
2from safetensors.torch import load_file, save_file
3
4
5lora_path = "D:/Downloads/BaiduNetdiskDownload/ill-xl-01-rurudo_3-000034.safetensors"
6save_path = os.path.join(
7 os.path.dirname(lora_path),
8 os.path.splitext(os.path.basename(lora_path))[0] + "_without_norm_block.safetensors"
9)
10norm_block_list = []
11model_weights = load_file(lora_path)
12
13for block, _ in model_weights.items():
14 if "norm" in block:
15 norm_block_list.append(block)
16
17for block in norm_block_list:
18 del model_weights[block]
19
20save_file(model_weights, save_path)