Fix MoE sample size

This commit is contained in:
shumingma 2023-03-08 01:19:36 -08:00
parent 0a07df1e5b
commit 891f84f302

View File

@ -24,9 +24,6 @@ class MaskedLMMoECrossEntropyCriterion(MoECriterion):
)
net_output = model(**sample["net_input"], masked_tokens=masked_tokens)
sample_size = (
sample["target"].size(0) if self.sentence_avg else sample["ntokens"]
)
lprobs = model.get_normalized_probs(net_output, log_probs=True)
lprobs = lprobs.view(-1, lprobs.size(-1))
target = model.get_targets(sample, net_output)