Skip to content

Commit

Permalink
Meagtron encoder decoder fix for empty validation outputs (#6459)
Browse files Browse the repository at this point in the history
* 1. Meagtron encoder decoder fix for empty validation outputs.

Signed-off-by: Micha Livne <[email protected]>

* 1. Debugging.

---------

Signed-off-by: Micha Livne <[email protected]>
Co-authored-by: Micha Livne <[email protected]>
  • Loading branch information
michalivne and michalivne committed Apr 20, 2023
1 parent c738615 commit d30854f
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,10 @@ def validation_step(self, dataloader_iter, batch_idx, dataloader_idx=0):
return self.fwd_bwd_step(dataloader_iter, batch_idx, True)

def validation_epoch_end(self, outputs):
# NOTE: we need to make sure outputs is not empty (this is a workaround for a bug in pytorch lightning (?))
if len(outputs) == 0:
logging.warning("validation_epoch_end: outputs is empty")
return
if parallel_state.is_pipeline_last_stage():
# only the last pipeline parallel stages return loss
averaged_loss = torch.stack(outputs).mean()
Expand Down

0 comments on commit d30854f

Please sign in to comment.