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

[Question]: text_summarization->pegasus->train.py 使用cpu训练报错 #4374

Closed
QQR1 opened this issue Jan 6, 2023 · 4 comments · Fixed by #4431
Closed

[Question]: text_summarization->pegasus->train.py 使用cpu训练报错 #4374

QQR1 opened this issue Jan 6, 2023 · 4 comments · Fixed by #4431
Assignees
Labels
question Further information is requested text_summarization

Comments

@QQR1
Copy link

QQR1 commented Jan 6, 2023

请提出你的问题

Exception in thread Thread-4: Traceback (most recent call last): File "E:\Users\renqi\anaconda3\envs\paddle\lib\threading.py", line 932, in _bootstrap_inner self.run() File "E:\Users\renqi\anaconda3\envs\paddle\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "E:\Users\renqi\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dataloader\dataloader_iter.py", line 217, in _thread_loop batch = self._dataset_fetcher.fetch(indices, File "E:\Users\renqi\anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dataloader\fetcher.py", line 134, in fetch data = self.collate_fn(data) File "E:\Users\renqi\anaconda3\envs\paddle\lib\site-packages\paddlenlp\data\data_collator.py", line 383, in __call__ decoder_input_ids = self.model.prepare_decoder_input_ids_from_labels(labels=features["labels"]) File "E:\Users\renqi\anaconda3\envs\paddle\lib\site-packages\paddlenlp\transformers\pegasus\modeling.py", line 673, in prepare_decoder_input_ids_from_labels return shift_tokens_right(labels, self.pegasus.pad_token_id, self.pegasus.config["decoder_start_token_id"]) File "E:\Users\renqi\anaconda3\envs\paddle\lib\site-packages\paddlenlp\transformers\pegasus\modeling.py", line 45, in shift_tokens_right shifted_input_ids = paddle.where(shifted_input_ids == -100, pad_token_id, shifted_input_ids) File "E:\Users\renqi\anaconda3\envs\paddle\lib\site-packages\paddle\tensor\search.py", line 640, in where broadcast_zeros = paddle.add(zeros_like_x, zeros_like_y) File "E:\Users\renqi\anaconda3\envs\paddle\lib\site-packages\paddle\tensor\math.py", line 278, in add return _C_ops.elementwise_add(x, y) ValueError: (InvalidArgument) The type of data we are trying to retrieve does not match the type of data currently contained in the container. [Hint: Expected dtype() == paddle::experimental::CppTypeToDataType<T>::Type(), but received dtype():7 != paddle::experimental::CppTypeToDataType<T>::Type():5.] (at ..\paddle\phi\core\dense_tensor.cc:137) [operator < elementwise_add > error]

@QQR1 QQR1 added the question Further information is requested label Jan 6, 2023
@github-actions github-actions bot added the triage label Jan 6, 2023
@gongel
Copy link
Member

gongel commented Jan 6, 2023

你好,收到,我们复现一下

@gongel gongel self-assigned this Jan 6, 2023
@gongel
Copy link
Member

gongel commented Jan 11, 2023

你好,我们测试PaddlePaddle==2.4.1,PaddleNLP==2.4.9没有复现出你的问题,可以跑通代码。可以试试上述的版本,也辛苦提供下你的版本哈。

@xiaofeng-ling
Copy link

我这边也出现了这个问题
Windows11 x64
Python 3.7.9
PaddlePaddle==2.4.1
PaddleNLP==2.4.9

使用的是 PaddleNLP-2.4.9的release包中的训练代码,路径PaddleNLP-2.4.9\applications\text_summarization\pegasus\train.py
python.exe train.py --model_name_or_path=IDEA-CCNL/Randeng-Pegasus-238M-Summary-Chinese --train_file data/train.json --eval_file data/test.json --output_dir pegasus_out --max_source_length 128 --max_target_length 64 --epoch 20 --logging_steps 1 --save_steps 10000 --train_batch_size 128 --eval_batch_size 128 --learning_rate 5e-5 --warmup_proportion 0.02 --weight_decay=0.01 --device=cpu
报错内容一致

@gongel
Copy link
Member

gongel commented Jan 11, 2023

各位,已修复该问题#4431,感谢反馈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested text_summarization
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants