Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
KumoLiu opened this issue May 18, 2024 · 1 comment
Open

Comments

@KumoLiu
Copy link
Contributor

KumoLiu commented May 18, 2024

======================================================================
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
Copy link
Contributor Author

KumoLiu commented May 18, 2024

KumoLiu added a commit to KumoLiu/MONAI that referenced this issue May 18, 2024
@KumoLiu KumoLiu mentioned this issue May 18, 2024
7 tasks
KumoLiu added a commit that referenced this issue May 18, 2024
workaround for #7781

### Description

A few sentences describing the changes proposed in this pull request.

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

Signed-off-by: YunLiu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant