Project-MONAI / MONAI

AI Toolkit for Healthcare Imaging
https://monai.io/
Apache License 2.0
5.51k stars 1.01k forks source link

AttributeError: type object 'obj' has no attribute '_attn_implementation' #7781

Open KumoLiu opened 1 month ago

KumoLiu commented 1 month ago
======================================================================
ERROR: test_shape_0 (tests.test_transchex.TestTranschex)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/parameterized/parameterized.py", line 620, in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
  File "/workspace/Code/MONAI/tests/test_transchex.py", line 53, in test_shape
    net = Transchex(**input_param)
  File "/workspace/Code/MONAI/monai/networks/nets/transchex.py", line 342, in __init__
    self.multimodal = MultiModal.from_pretrained(
  File "/workspace/Code/MONAI/monai/networks/nets/transchex.py", line 69, in from_pretrained
    model = cls(num_language_layers, num_vision_layers, num_mixed_layers, bert_config, *inputs, **kwargs)
  File "/workspace/Code/MONAI/monai/networks/nets/transchex.py", line 223, in __init__
    self.language_encoder = nn.ModuleList([BertLayer(self.config) for _ in range(num_language_layers)])
  File "/workspace/Code/MONAI/monai/networks/nets/transchex.py", line 223, in <listcomp>
    self.language_encoder = nn.ModuleList([BertLayer(self.config) for _ in range(num_language_layers)])
  File "/usr/local/lib/python3.10/dist-packages/transformers/models/bert/modeling_bert.py", line 558, in __init__
    self.attention = BertAttention(config)
  File "/usr/local/lib/python3.10/dist-packages/transformers/models/bert/modeling_bert.py", line 476, in __init__
    self.self = BERT_SELF_ATTENTION_CLASSES[config._attn_implementation](
AttributeError: type object 'obj' has no attribute '_attn_implementation'

======================================================================
ERROR: test_shape_1 (tests.test_transchex.TestTranschex)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/parameterized/parameterized.py", line 620, in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
  File "/workspace/Code/MONAI/tests/test_transchex.py", line 53, in test_shape
    net = Transchex(**input_param)
  File "/workspace/Code/MONAI/monai/networks/nets/transchex.py", line 342, in __init__
    self.multimodal = MultiModal.from_pretrained(
  File "/workspace/Code/MONAI/monai/networks/nets/transchex.py", line 69, in from_pretrained
    model = cls(num_language_layers, num_vision_layers, num_mixed_layers, bert_config, *inputs, **kwargs)
  File "/workspace/Code/MONAI/monai/networks/nets/transchex.py", line 223, in __init__
    self.language_encoder = nn.ModuleList([BertLayer(self.config) for _ in range(num_language_layers)])
  File "/workspace/Code/MONAI/monai/networks/nets/transchex.py", line 223, in <listcomp>
    self.language_encoder = nn.ModuleList([BertLayer(self.config) for _ in range(num_language_layers)])
  File "/usr/local/lib/python3.10/dist-packages/transformers/models/bert/modeling_bert.py", line 558, in __init__
    self.attention = BertAttention(config)
  File "/usr/local/lib/python3.10/dist-packages/transformers/models/bert/modeling_bert.py", line 476, in __init__
    self.self = BERT_SELF_ATTENTION_CLASSES[config._attn_implementation](
AttributeError: type object 'obj' has no attribute '_attn_implementation'

----------------------------------------------------------------------
KumoLiu commented 1 month ago

https://pypi.org/project/transformers/4.41.0/