Skip to content

Commit

Permalink
Fix MPS with sequence loss (#2834)
Browse files Browse the repository at this point in the history
* Add MPS support for list outputs in training eval loop

* Add error for invalid state outputs type in trainer

* Remove raise ValueError in trainer eval loop

---------

Co-authored-by: Daniel King <[email protected]>
  • Loading branch information
JAEarly and dakinggg authored Jan 22, 2024
1 parent 2fb4519 commit 1df5557
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions composer/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2983,6 +2983,13 @@ def _eval_loop(
outputs[k] = v.cpu()
else:
outputs[k] = v
elif isinstance(self.state.outputs, Sequence):
outputs = []
for v in self.state.outputs:
if isinstance(v, torch.Tensor):
outputs.append(v.cpu())
else:
outputs.append(v)
else:
outputs = self.state.outputs.cpu()
else:
Expand Down

0 comments on commit 1df5557

Please sign in to comment.