Skip to content

Commit 5bde3a9

Browse files
authored
fix ovis2 device_map (#3496)
1 parent 2c702ea commit 5bde3a9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

swift/trainers/trainers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ def compute_loss(self, model, inputs, return_outputs=False, num_items_in_batch=N
208208

209209
if labels is None:
210210
labels = inputs['labels']
211+
outputs.loss = outputs.loss.to(labels.device)
211212
# fix https://github.com/huggingface/transformers/issues/34263
212213
if num_items_in_batch is not None:
213214
outputs.loss = outputs.loss * (labels[:, 1:] != -100).sum() / num_items_in_batch

0 commit comments

Comments
 (0)