Skip to content

[Bug]: 只要一进入调试模式就会出现TypeError: __init__() got multiple values for argument 'self',正常运行则没有 #5461

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

Closed
1 task done
HelloBroTan opened this issue Mar 29, 2023 · 1 comment
Assignees
Labels
bug Something isn't working triage

Comments

@HelloBroTan
Copy link

HelloBroTan commented Mar 29, 2023

软件环境

windows10 X64 anaconda-spyder5.2.2
- paddlepaddle-gpu: 2.3.2
- paddlenlp: 2.0.1

重复问题

  • I have searched the existing issues

错误描述

只要一进入调试模式就会出现TypeError: __init__() got multiple values for argument 'self',正常运行则没有

File "D:\anaconda\envs\py37nlppad\lib\site-packages\paddle\nn\layer\transformer.py", line 653, in <listcomp>
    for i in range(num_layers)])

......
649    def __init__(self, encoder_layer, num_layers, norm=None):
650        super(TransformerEncoder, self).__init__()
651        self.layers = LayerList([(encoder_layer if i == 0 else
652                          type(encoder_layer)(**encoder_layer._config))
653                                 for i in range(num_layers)])
......

稳定复现步骤 & 代码

Spyder 调试模式运行
!continue
[2023-03-29 14:28:06,817] [ INFO] - Found C:\Users\lenovo.paddlenlp\models\bert-base-chinese\bert-base-chinese-vocab.txt
[2023-03-29 14:28:06,963] [ INFO] - Already cached C:\Users\lenovo.paddlenlp\models\bert-base-chinese\bert-base-chinese.pdparams
Traceback (most recent call last):
File "d:\pycharm_proj\nlplearning\nlpbase\exam03_bert\chinese_wordsegmentcrf.py", line 282, in
bert = BertForTokenClassification.from_pretrained(model_name_or_path, num_classes=label_num)
File "D:\anaconda\envs\py37nlppad\lib\site-packages\paddlenlp\transformers\model_utils.py", line 231, in from_pretrained
base_model = cls.base_model_class(*base_args, **base_kwargs)
File "D:\anaconda\envs\py37nlppad\lib\site-packages\paddlenlp\transformers\utils.py", line 83, in impl
init_func(self, *args, **kwargs)
File "D:\anaconda\envs\py37nlppad\lib\site-packages\paddlenlp\transformers\bert\modeling.py", line 303, in init
self.encoder = nn.TransformerEncoder(encoder_layer, num_hidden_layers)
File "D:\anaconda\envs\py37nlppad\lib\site-packages\paddle\nn\layer\transformer.py", line 653, in init
for i in range(num_layers)])
File "D:\anaconda\envs\py37nlppad\lib\site-packages\paddle\nn\layer\transformer.py", line 653, in
for i in range(num_layers)])
TypeError: init() got multiple values for argument 'self'

@HelloBroTan HelloBroTan added the bug Something isn't working label Mar 29, 2023
@w5688414
Copy link
Contributor

w5688414 commented May 8, 2024

请升级paddlenlp和paddle试一下

@paddle-bot paddle-bot bot closed this as completed May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

3 participants