Hello,
Sorry if my question sounds a bit silly, but I just have a question:
I am trying to use LongformerForMultipleChoice
model for a multiple-choice question that has 4 options.
When I do:
my_Longformer_multiple_choice_model.encoder.layer[layer_index].forward(hidden_output,
attention_mask=my_attention_mask,output_attention=False)
, an this error is generated:
File "/Users/hyunjindominiquecho/opt/anaconda3/lib/python3.7/site-packages/transformers/modeling_longformer.py", line 384, in _sliding_chunks_query_key_matmul
batch_size, seq_len, num_heads, head_dim = query.size()
ValueError: too many values to unpack (expected 4)
Here, my_attention_mask
is the same attention mask that I would specify under the regular LongformerForMultipleChoice
command:
# I am using the LongformerForMultipleChoice model, where each multiple choice question has 4 options.
my_attention_mask = tensor([[[1, 1, 1, ..., 0, 0, 0],
[1, 1, 1, ..., 0, 0, 0],
[1, 1, 1, ..., 0, 0, 0],
[1, 1, 1, ..., 0, 0, 0]]])
# I can use the my_attention_mask in the regular command as below:
longformer_output= my_Longformer_multiple_choice_model(input_ids=input_ids,....,attention_mask=my_attention_mask)
why is this value error generated? What should I pass for the attention_mask
parameter in the command my_Longformer_multiple_choice_model.encoder.layer[layer_index].forward(hidden_output, attention_mask,output_attention=False)
?
Thank you,