Accessing the device
attribute of bias terms of TransformerEncoderLayer
initialized with bias = False
causes Attribute error
#125015
Labels
oncall: transformer/mha
Issues related to Transformers and MultiheadAttention
馃悰 Describe the bug
When performing a forward pass on
TransformerEncoderLayer
initialized with an even number of heads (2, 4, 6, ...) and without bias (bias=False
) in eval mode (model.eval()
), I face with an errorAttributeError: 'NoneType' object has no attribute 'device'
.Here is the stack trace:
Upon looking at the relevant code piece, I think the following lines will create the error because the bias terms are None and this line accesses the
device
attribute of None objects and thus the error.Versions
cc @jbschlosser @bhosmer @cpuhrsch @erichan1 @drisspg @mikaylagawarecki
The text was updated successfully, but these errors were encountered: