Skip to content

Commit da191cd

Browse files
committed
fix multimodal peft_model megatron
1 parent 7919369 commit da191cd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

swift/megatron/utils/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ def prepare_adapter(model):
179179
for n, p in model.named_parameters():
180180
if '.ref_adapter.' in n:
181181
p.requires_grad = False
182+
# setting average_gradients_across_tp_domain
183+
if args.is_multimodal:
184+
visual_model = model.visual
185+
for n, p in visual_model.named_parameters():
186+
if p.requires_grad:
187+
p.average_gradients_across_tp_domain = True
182188
return model
183189

184190

0 commit comments

Comments
 (0)