From c7c2235874ec49ff2f99cccb06390ec7e2d2291f Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 28 Nov 2022 23:59:49 -0800 Subject: [PATCH] Move all of the forward pass to under torch.no_grad() (#3636) --- haystack/nodes/reader/table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haystack/nodes/reader/table.py b/haystack/nodes/reader/table.py index aea3ef0f1..d80f45a24 100644 --- a/haystack/nodes/reader/table.py +++ b/haystack/nodes/reader/table.py @@ -493,9 +493,9 @@ class _TapasScoredEncoder(_BaseTapasEncoder): # Forward pass through model with torch.no_grad(): outputs = self.model.tapas(**inputs) + table_score = self.model.classifier(outputs.pooler_output) # Get general table score - table_score = self.model.classifier(outputs.pooler_output) table_score_softmax = torch.nn.functional.softmax(table_score, dim=1) table_relevancy_prob = table_score_softmax[0][1].item() no_answer_score = table_score_softmax[0][0].item()