Project-MONAI / Project-MONAI/MONAI

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

Open
#7,781 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.7k
Forks
1.6k
Avg merge
5d 1h
Merged PRs (30d)
20

Description

======================================================================
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'

----------------------------------------------------------------------

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/test_transchex.py, especially test_shape, and reproduce the failure while tracing construction through monai/networks/nets/transchex.py. Read the MultiModal and Transchex initialization around the BertLayer creation and compare the expected Transformers configuration with the config supplied there. Done means the test_shape cases construct Transchex without the _attn_implementation AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.