a4f90c8e8420db451da188fcb50d7b801a5c6ff1,parlai/agents/fairseq/fairseq.py,FairseqAgent,report,#FairseqAgent#,546

Before Change


        // in cross_entropy:
        // github.com/pytorch/fairseq/blob/master/fairseq/criterions/cross_entropy.py//L55
        if "train_loss" in m:
            m["train_ppl"] = np.exp2(m["train_loss"])
        if "valid_loss" in m:
            m["ppl"] = np.exp2(m["valid_loss"])

After Change



        if "nll_loss" in self.meters:
            // special case, we used sentence averaging so ppl comes from nll_loss
            output["ppl"] = np.exp2(self.meters["nll_loss"].avg)
        else:
            // normal case, just use loss
            output["ppl"] = np.exp2(self.meters["loss"].avg)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 2

Instances


Project Name: facebookresearch/ParlAI
Commit Name: a4f90c8e8420db451da188fcb50d7b801a5c6ff1
Time: 2018-09-07
Author: roller@fb.com
File Name: parlai/agents/fairseq/fairseq.py
Class Name: FairseqAgent
Method Name: report


Project Name: etal/cnvkit
Commit Name: 5e64c4ea0ea4a2096c794c16130b3e6e0961fac2
Time: 2016-08-22
Author: eric.talevich@gmail.com
File Name: cnvlib/commands.py
Class Name:
Method Name: do_reference_flat


Project Name: etal/cnvkit
Commit Name: 5e64c4ea0ea4a2096c794c16130b3e6e0961fac2
Time: 2016-08-22
Author: eric.talevich@gmail.com
File Name: cnvlib/fix.py
Class Name:
Method Name: apply_weights