mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-12-27 15:08:43 +00:00
feat: Add inference mode to ExtractiveReader (#7699)
* Add inference mode to ExtractiveReader * Add release notes
This commit is contained in:
parent
c8d53b3ebf
commit
af53e8430d
@ -602,7 +602,8 @@ class ExtractiveReader:
|
||||
cur_input_ids = input_ids[start_index:end_index]
|
||||
cur_attention_mask = attention_mask[start_index:end_index]
|
||||
|
||||
output = self.model(input_ids=cur_input_ids, attention_mask=cur_attention_mask)
|
||||
with torch.inference_mode():
|
||||
output = self.model(input_ids=cur_input_ids, attention_mask=cur_attention_mask)
|
||||
cur_start_logits = output.start_logits
|
||||
cur_end_logits = output.end_logits
|
||||
if num_batches != 1:
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
---
|
||||
enhancements:
|
||||
- |
|
||||
Adds inference mode to model call of the ExtractiveReader. This prevents gradients from being calculated during inference time in pytorch.
|
||||
Loading…
x
Reference in New Issue
Block a user