3b53962cd7a42d08bcc7c07f4f858b55bf9bbdad,fairseq/hub_utils.py,GeneratorHubInterface,score,#GeneratorHubInterface#Any#,124

Before Change



    def score(self, sentence: str, **kwargs):
        // NOTE: this doesn"t support translation tasks currently
        input = self.encode(sentence)
        return self.generate(input, score_reference=True, **kwargs)[0]

    def generate(self, tokens: torch.LongTensor, beam: int = 5, verbose: bool = False, **kwargs) -> torch.LongTensor:
        sample = self._build_sample(tokens)

After Change



    def score(self, sentences: List[str], **kwargs):
        if isinstance(sentences, str):
            return self.score([sentences], **kwargs)[0]
        // NOTE: this doesn"t support translation tasks currently
        tokenized_sentences = [self.encode(sentence) for sentence in sentences]
        return [hypos[0] for hypos in self.generate(tokenized_sentences, score_reference=True, **kwargs)]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: elbayadm/attn2d
Commit Name: 3b53962cd7a42d08bcc7c07f4f858b55bf9bbdad
Time: 2019-12-25
Author: sai.r.prasanna@gmail.com
File Name: fairseq/hub_utils.py
Class Name: GeneratorHubInterface
Method Name: score


Project Name: ntucllab/libact
Commit Name: cb347641837feb9f651038c2f88317563a347627
Time: 2015-12-17
Author: yangarbiter@gmail.com
File Name: libact/models/svm.py
Class Name: SVM
Method Name: score