Repository: deepset-ai/haystack

Issue:
DPR training is broken
**Describe the bug**
It seems that DPR training does not work at the moment. I suspect that this bug was introduced by #2703.

**Error message**
```
  File "/Users/bogdan/Repositories/haystack/tutorials/Tutorial9_DPR_training.py", line 92, in <module>
    tutorial9_dpr_training()
  File "/Users/bogdan/Repositories/haystack/tutorials/Tutorial9_DPR_training.py", line 71, in tutorial9_dpr_training
    retriever.train(
  File "/Users/bogdan/Repositories/haystack/haystack/nodes/retriever/dense.py", line 680, in train
    trainer.train()
  File "/Users/bogdan/Repositories/haystack/haystack/modeling/training/base.py", line 290, in train
    loss = self.compute_loss(batch, step)
  File "/Users/bogdan/Repositories/haystack/haystack/modeling/training/base.py", line 374, in compute_loss
    logits = self.model.forward(**batch)
TypeError: forward() got an unexpected keyword argument 'label_ids'
```

**To Reproduce**
Execute Tutorial 9.




Discussion:
Related to #2881
Hi @ZanSara,
I see the changes corresponding to this issue are now available. I have installed the master branch version and tried the DPR training tutorial on custom data. The training is happening without any issue but I am getting the same error during evaluation.

**Error message:**

[/usr/local/lib/python3.7/dist-packages/haystack/modeling/evaluation/eval.py](https://localhost:8080/#) in eval(self, model, return_preds_and_labels, calibrate_conf_scores, use_confidence_scores_for_ranking, use_no_answer_legacy_confidence)
     75                     padding_mask=batch.get("padding_mask", None),
     76                     output_hidden_states=batch.get("output_hidden_states", False),
---> 77                     output_attentions=batch.get("output_attentions", False),
     78                 )
     79                 losses_per_head = model.logits_to_loss_per_head(logits=logits, **batch)

TypeError: forward() got an unexpected keyword argument 'input_ids'

Isn't the same code fixes to be done for the eval function as well?
Hey @vijayirlapati, thanks for reporting this. We're still hunting these arguments across the codebase, so if you find more, please keep reporting. They're going to be fixed one by one. I will link the new PR to this issue.

Resolving patch:
diff --git a/haystack/modeling/evaluation/eval.py b/haystack/modeling/evaluation/eval.py
--- a/haystack/modeling/evaluation/eval.py
+++ b/haystack/modeling/evaluation/eval.py
@@ -8,6 +8,7 @@
 
 from haystack.modeling.evaluation.metrics import compute_metrics, compute_report_metrics
 from haystack.modeling.model.adaptive_model import AdaptiveModel
+from haystack.modeling.model.biadaptive_model import BiAdaptiveModel
 from haystack.utils.experiment_tracking import Tracker as tracker
 from haystack.modeling.visual import BUSH_SEP
 
@@ -69,13 +70,26 @@ def eval(
 
             with torch.no_grad():
 
-                logits = model.forward(
-                    input_ids=batch.get("input_ids", None),
-                    segment_ids=batch.get("segment_ids", None),
-                    padding_mask=batch.get("padding_mask", None),
-                    output_hidden_states=batch.get("output_hidden_states", False),
-                    output_attentions=batch.get("output_attentions", False),
-                )
+                if isinstance(model, AdaptiveModel):
+                    logits = model.forward(
+                        input_ids=batch.get("input_ids", None),
+                        segment_ids=batch.get("segment_ids", None),
+                        padding_mask=batch.get("padding_mask", None),
+                        output_hidden_states=batch.get("output_hidden_states", False),
+                        output_attentions=batch.get("output_attentions", False),
+                    )
+                elif isinstance(model, BiAdaptiveModel):
+                    logits = model.forward(
+                        query_input_ids=batch.get("query_input_ids", None),
+                        query_segment_ids=batch.get("query_segment_ids", None),
+                        query_attention_mask=batch.get("query_attention_mask", None),
+                        passage_input_ids=batch.get("passage_input_ids", None),
+                        passage_segment_ids=batch.get("passage_segment_ids", None),
+                        passage_attention_mask=batch.get("passage_attention_mask", None),
+                    )
+                else:
+                    logits = model.forward(**batch)
+
                 losses_per_head = model.logits_to_loss_per_head(logits=logits, **batch)
                 preds = model.logits_to_preds(logits=logits, **batch)
                 labels = model.prepare_labels(**batch)


Test patch: