Skip to content

Commit a7f99b7

Browse files
committed
feat(beitv2): modify how weights are loaded when finetune
1 parent 4f52374 commit a7f99b7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ppcls/arch/backbone/model_zoo/modeling_finetune.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,11 @@ def beit_base_patch16_224(pretrained=False, finetune_weight=None, model_filter_n
582582

583583
all_keys = list(checkpoint_model.keys())
584584
for key in all_keys:
585+
if "Teacher" in key:
586+
checkpoint_model.pop(key)
587+
elif "Student" in key:
588+
checkpoint_model[key.strip("Student.")] = checkpoint_model.pop(key)
589+
585590
if "relative_position_index" in key:
586591
checkpoint_model.pop(key)
587592

0 commit comments

Comments
 (0)