I have a list of BatchEncoding, I need to convert it into a format that Huggingface models accepts it
context_input_tensor = []
passage_ids = []
while len(passage_ids) < batch_size:
    idx = random.randint(0, num_questions)
    question_tensor, passage_id = questions[idx]
    if passage_id in passage_ids:
      continue
    passage_ids.append(passage_id)
    context_input_tensor.append(passages_dict[passage_id])

The context_input_tensor is a list which contains BatchEncoding type objects. What should I do
If I pass the context_input_tensor as it is I get a TypeError: forward() missing 2 required positional arguments: 'query_input_ids' and 'query_attention_mask' I was able to solve the issue by creating two different tensors and stacking 'query_input_ids' and 'query_attention_mask'. Is there a better way to do this ?