Skip to content

Commit

Permalink
Remove code duplication - #1413
Browse files Browse the repository at this point in the history
  • Loading branch information
AngledLuffa committed Aug 25, 2024
1 parent 33a5256 commit 3de69ca
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions stanza/pipeline/pos_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,10 @@ def process(self, document):
idx = []
with torch.no_grad():
if self._tqdm:
for i, b in enumerate(tqdm(batch)):
idx.extend(b[-1])
preds += self.trainer.predict(b)
else:
for i, b in enumerate(batch):
idx.extend(b[-1])
preds += self.trainer.predict(b)
batch = tqdm(batch)
for i, b in enumerate(batch):
idx.extend(b[-1])
preds += self.trainer.predict(b)

preds = unsort(preds, idx)
dataset.doc.set([doc.UPOS, doc.XPOS, doc.FEATS], [y for x in preds for y in x])
Expand Down

0 comments on commit 3de69ca

Please sign in to comment.