def predict_many()

in submission_code/best_util.py [0:0]


    def predict_many(self, texts, beam_width=5):
        text_enc = [self.text_tokenizer.encode(x) for x in texts]
        
        tokens = nn.utils.rnn.pad_sequence([torch.tensor([bos_id] + x[:self.config.max_src_len] + [eos_id]).long() for x in text_enc], 
                                           batch_first=True, padding_value=pad_id)
        
        pred_utils = []
        with torch.no_grad():
            tokens = tokens.to(self.device)
            logits = self.model(tokens).cpu().numpy()
            topk = np.argpartition(-logits, beam_width-1, axis=1)[:,:beam_width]

            for i in range(len(texts)):
                pred = list(zip(self.cmd_le.inverse_transform(topk[i]), logits[i, topk[i]]))
                pred_utils.append(pred) 
                
        return pred_utils