Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Enable Hydra configs in fairseq (#1343) (#1510)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #1510

this is the main pr that switches on hydra functionality in fairseq

we migrate "args" object into omegaconf "DictConfig" at all legacy entry points

in addition this migrates various components from secondary registries (like bpe encoders and tokenizers) to make the migration smoother

i am going through code that references migrated fairseq components and changing it to inherit from "Legacy*" components instead. hopefully tests will catch most of this

Pull Request resolved: fairinternal/fairseq-py#1343

Reviewed By: myleott

Differential Revision: D23973928

Pulled By: alexeib

fbshipit-source-id: dd9554981fff51ea75c1ff343874d1d6e61793c9
  • Loading branch information
alexeib authored and facebook-github-bot committed Oct 20, 2020
1 parent dc0b81c commit 114a2d2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pytext/metric_reporters/seq2seq_metric_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ def calculate_metric(self):
total_count = len(self.all_targets)
trg_vocab = self.tensorizers["trg_seq_tokens"].vocab
bleu_scorer = bleu.Scorer(
trg_vocab.get_pad_index(),
trg_vocab.get_eos_index(),
trg_vocab.get_unk_index(),
bleu.BleuConfig(
pad=trg_vocab.get_pad_index(),
eos=trg_vocab.get_eos_index(),
unk=trg_vocab.get_unk_index(),
)
)
for beam_pred, target in zip(self.all_preds, self.all_targets):
pred = beam_pred[0]
Expand Down

0 comments on commit 114a2d2

Please sign in to comment.