    def predict_loop(self, model, eval_dataloader, output_file="qa.npy"):
        """on-the-fly prediction on a single gpu."""
        self.full_scores = []
        model.eval()
        model = model.cuda()
        with torch.no_grad():
            for data in eval_dataloader:
                # reshape ans and dup video 5 times.
                v_len = data["vfeats"].size(1)
                hidden_size = data["vfeats"].size(2)
                data["vfeats"] = data["vfeats"].unsqueeze(1).repeat(1, 5, 1, 1).view(-1, v_len, hidden_size)
                data["vmasks"] = data["vmasks"].unsqueeze(1).repeat(1, 5, 1).view(-1, v_len)

                t_len = data["caps"].size(-1)
                data["caps"] = data["caps"].view(-1, t_len)
                data["cmasks"] = data["cmasks"].view(-1, t_len)

                data = self.to_ctx(data)
                outputs = model(**data)
                outputs.update(data)
                self(outputs)
        return self.finalize(output_file)
on-the-fly prediction on a single gpu.
examples/MMPT/mmpt/evaluators/predictor.py