You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
我在训练transformer的时候遇到bug,报错代码中说多传了output_attention,在paddlenlp/transformers/model_outputs.py中,我将output_attentions=output_attentions注释掉后错误就消失了,哪位大佬能告诉我原因,感谢!! (之前ppnlp 2.1.1没有该错误)
Traceback (most recent call last):
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/distributed/spawn.py", line 361, in _func_wrapper
result = func(*args)
File "/home/aistudio/PaddleSeq/ppseq_cli/train.py", line 263, in main_worker
scheduler=scheduler
File "/home/aistudio/PaddleSeq/ppseq_cli/train.py", line 65, in train_one_epoch
logits, sum_cost, avg_cost, token_num = criterion(model, sample)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 948, in call
return self.forward(*inputs, **kwargs)
File "/home/aistudio/PaddleSeq/ppseq/criterions/cross_entropy.py", line 12, in forward
logits, attn = model(sample["src_tokens"], sample["prev_tokens"])
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 948, in call
return self.forward(*inputs, **kwargs)
File "/home/aistudio/PaddleSeq/ppseq/models/transformer/transformer_model.py", line 223, in forward
encoder_out = self.forward_encoder(src_tokens)
File "/home/aistudio/PaddleSeq/ppseq/models/transformer/transformer_model.py", line 189, in forward_encoder
encoder_out=self.encoder(src_embed,src_mask)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 948, in call
return self.forward(*inputs, **kwargs)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/transformers/model_outputs.py", line 304, in _transformer_encoder_fwd
output_attentions=output_attentions,
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 948, in call
return self.forward(*inputs, **kwargs)
TypeError: forward() got an unexpected keyword argument 'output_attention
软件环境
重复问题
错误描述
稳定复现步骤 & 代码
模型在 ppseq/models/transformer/transformer_model.py 下
git clone https://gitee.com/miugod/PaddleSeq.git
cd PaddleSeq
git checkout develop
pip install -r requirements.txt && pip install -e .
数据集:https://aistudio.baidu.com/aistudio/datasetdetail/203506
unzip datasets.zip
ppseq_train -c examples/iwslt14/configs/de_en.yaml
错误版本:
pip install paddlenlp --upgrade
sed -i "s/paddlenlp==2.1.1/paddlenlp>=2.1.1/g" setup.py
pip install -e .
ppseq_train -c examples/iwslt14/configs/de_en.yaml
The text was updated successfully, but these errors were encountered: