Skip to content

[Bug]: 训练uie模型时报错ValueError: too many values to unpack (expected 2) #10826

@yuzh0816

Description

@yuzh0816

软件环境

- paddlepaddle-gpu: 3.1.0
- paddlenlp: 3.0.0b4

重复问题

  • I have searched the existing issues

错误描述

报错如下

Traceback (most recent call last):
  File "/root/PaddleNLP/slm/applications/information_extraction/document/evaluate.py", line 150, in <module>
    do_eval()
  File "/root/PaddleNLP/slm/applications/information_extraction/document/evaluate.py", line 113, in do_eval
    eval_metrics = trainer.evaluate()
                   ^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/0708/lib/python3.11/site-packages/paddlenlp/trainer/trainer.py", line 3118, in evaluate
    output = self.evaluation_loop(
             ^^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/0708/lib/python3.11/site-packages/paddlenlp/trainer/trainer.py", line 3340, in evaluation_loop
    metrics = self.compute_metrics(EvalPrediction(predictions=all_preds, label_ids=batch_labels))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/0708/lib/python3.11/site-packages/paddlenlp/utils/ie_utils.py", line 134, in compute_metrics
    start_ids, end_ids = p.label_ids
    ^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 2)

稳定复现步骤 & 代码

训练UIE模型后,执行python evaluate.py --device "gpu" --model_path ./checkpoint/model_best --test_path ./data/dev.txt --output_dir ./checkpoint/model_best --label_names 'start_positions' 'end_positions' --max_seq_len 512 --per_device_eval_batch_size 16 --debug True进行训练后,产生报错。训练过程中没有报错。在evaluate时才出现报错。另外,在训练时加入do_eval也会产生报错。
参考文档:https://blog.csdn.net/z5z5z5z56/article/details/130346646

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions