How to convert a list of Batchencoding to a BatchEncoding
I have a list of BatchEncoding, I need to convert it into a format that Huggingface models accepts itcontext_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])Thecontext_input_tensoris a list which containsBatchEncodingtype objects. What should I doIf I pass thecontext_input_tensoras it is I get aTypeError: 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 ?