File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -643,16 +643,15 @@ def convert_key(key):
643
643
new_sd [key_pfx + "k_proj" + key_suffix ] = values [1 ]
644
644
new_sd [key_pfx + "v_proj" + key_suffix ] = values [2 ]
645
645
646
- # rename or add position_ids
646
+ # remove position_ids for newer transformer, which causes error :(
647
647
ANOTHER_POSITION_IDS_KEY = "text_model.encoder.text_model.embeddings.position_ids"
648
648
if ANOTHER_POSITION_IDS_KEY in new_sd :
649
649
# waifu diffusion v1.4
650
- position_ids = new_sd [ANOTHER_POSITION_IDS_KEY ]
651
650
del new_sd [ANOTHER_POSITION_IDS_KEY ]
652
- else :
653
- position_ids = torch .Tensor ([list (range (max_length ))]).to (torch .int64 )
654
651
655
- new_sd ["text_model.embeddings.position_ids" ] = position_ids
652
+ if "text_model.embeddings.position_ids" in new_sd :
653
+ del new_sd ["text_model.embeddings.position_ids" ]
654
+
656
655
return new_sd
657
656
658
657
You can’t perform that action at this time.
0 commit comments