Skip to content

Commit

Permalink
In case all three columns are blank, don't die horribly
Browse files Browse the repository at this point in the history
  • Loading branch information
AngledLuffa committed Nov 7, 2023
1 parent 1f34626 commit 26db2d1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions stanza/models/pos/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def update(self, batch, eval=False):
self.model.train()
self.optimizer.zero_grad()
loss, _ = self.model(word, word_mask, wordchars, wordchars_mask, upos, xpos, ufeats, pretrained, word_orig_idx, sentlens, wordlens, text)
if loss == 0.0:
return loss

loss_val = loss.data.item()
if eval:
return loss_val
Expand Down

0 comments on commit 26db2d1

Please sign in to comment.