Update med.py: Fixed the issue of BERTEncoder.forward() not returning cross-attentions when requested
In class BertEncoder.forward() method, all_cross_attentions is defined in Line 409, but not maintained, which causes a retuning of None object when requested. In this revision, all_cross_attentions is properly updated and maintained in Line 461. The maintenance code is referred from the original Hugging-face Transformer library https://github.com/huggingface/transformers/blob/v4.15.0/src/transformers/models/bert/modeling_bert.py Line600, and is tested to be valid.
Update med.py: Fixed the issue of BERTEncoder.forward() not returning cross-attentions when requested
In class BertEncoder.forward() method,
all_cross_attentions
is defined in Line 409, but not maintained, which causes a retuning of None object when requested. In this revision,all_cross_attentions
is properly updated and maintained in Line 461. The maintenance code is referred from the original Hugging-face Transformer library https://github.com/huggingface/transformers/blob/v4.15.0/src/transformers/models/bert/modeling_bert.py Line600, and is tested to be valid.