de977736f91d23c53e6a60c45822973a615daa15,fairseq/models/bart/hub_interface.py,BARTHubInterface,fill_mask,#BARTHubInterface#Any#Any#Any#,166

Before Change


            add_if_not_exist=False,
        ).long()

        if tokens.dim() == 1:
            tokens = tokens.unsqueeze(0)

        // ensure beam size is at least as big as topk

After Change


    ):
        masked_token = "<mask>"
        batch_tokens = []
        for masked_input in masked_inputs:
            assert masked_token in masked_input, \
                "please add one {} token for the input".format(masked_token)

            text_spans = masked_input.split(masked_token)
            text_spans_bpe = (" {0} ".format(masked_token)).join(
                [self.bpe.encode(text_span.rstrip()) for text_span in text_spans]
            ).strip()
            tokens = self.task.source_dictionary.encode_line(
                "<s> " + text_spans_bpe + " </s>",
                append_eos=False,
                add_if_not_exist=False,
            ).long()
            batch_tokens.append(tokens)

        // ensure beam size is at least as big as topk
        generate_kwargs["beam"] = max(
            topk,
            generate_kwargs.get("beam", -1),
        )
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: pytorch/fairseq
Commit Name: de977736f91d23c53e6a60c45822973a615daa15
Time: 2020-11-02
Author: shajain@fb.com
File Name: fairseq/models/bart/hub_interface.py
Class Name: BARTHubInterface
Method Name: fill_mask


Project Name: uber/pyro
Commit Name: 3040d26d11096c12daf417cd46912bb30f5dafab
Time: 2020-04-21
Author: fehiepsi@gmail.com
File Name: pyro/infer/mcmc/hmc.py
Class Name: HMC
Method Name: _kinetic_energy


Project Name: BindsNET/bindsnet
Commit Name: b6240c06fb49020e2d51703a1fcfddba7e27297d
Time: 2019-06-21
Author: djsaunde@umass.edu
File Name: bindsnet/network/network.py
Class Name: Network
Method Name: run