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

[Bug]: 训练后评估阶段报错 #9908

Open
1 task done
jqtian123 opened this issue Feb 19, 2025 · 0 comments
Open
1 task done

[Bug]: 训练后评估阶段报错 #9908

jqtian123 opened this issue Feb 19, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@jqtian123
Copy link

软件环境

- paddlepaddle:
- paddlepaddle-gpu: 3.0.0rc1
- paddlenlp: 3.0.0b3

重复问题

  • I have searched the existing issues

错误描述

自己构造的数据:
python doccano.py --negative_ratio 5 --doccano_file ./data/doccano_ext.jsonl --task_type ext --save_dir ./data --splits 0.8 0.1 0.1 --schema_lang en
训练命令:
python finetune.py      --device gpu     --logging_steps 10     --save_steps 100     --eval_steps 100     --seed 42     --model_name_or_path uie-m-large     --output_dir $finetuned_model     --train_path data/train.txt     --dev_path data/dev.txt      --max_seq_length 512      --per_device_eval_batch_size 8     --per_device_train_batch_size  8     --num_train_epochs 20     --learning_rate 1e-5     --label_names "start_positions" "end_positions"     --do_train     --do_eval     --do_export     --export_model_dir $finetuned_model     --overwrite_output_dir     --disable_tqdm True     --metric_for_best_model eval_f1     --load_best_model_at_end  True     --save_total_limit 1
报错:
[2025-02-20 06:44:11,305] [    INFO] - ***** Running Evaluation *****
[2025-02-20 06:44:11,305] [    INFO] -   Num examples = 170
[2025-02-20 06:44:11,305] [    INFO] -   Total prediction steps = 22
[2025-02-20 06:44:11,306] [    INFO] -   Pre device batch size = 8
[2025-02-20 06:44:11,306] [    INFO] -   Total Batch size = 8
[[0. 0. 0. ... 0. 0. 0.]
 [0. 0. 0. ... 0. 0. 0.]
 [0. 0. 0. ... 0. 0. 0.]
 ...
 [0. 0. 0. ... 0. 0. 0.]
 [0. 0. 0. ... 0. 0. 0.]
 [0. 0. 0. ... 0. 0. 0.]]
label_ids contains 1
<class 'numpy.ndarray'>
(170, 512)
Traceback (most recent call last):
  File "/root/autodl-tmp/PaddleNLP/slm/model_zoo/uie/finetune.py", line 269, in <module>
    main()
  File "/root/autodl-tmp/PaddleNLP/slm/model_zoo/uie/finetune.py", line 200, in main
    train_result = trainer.train(resume_from_checkpoint=checkpoint)
  File "/root/miniconda3/envs/uie/lib/python3.9/site-packages/paddlenlp/trainer/trainer.py", line 872, in train
    return self._inner_training_loop(
  File "/root/miniconda3/envs/uie/lib/python3.9/site-packages/paddlenlp/trainer/trainer.py", line 1231, in _inner_training_loop
    self._maybe_log_save_evaluate(tr_loss, model, epoch, ignore_keys_for_eval, inputs=inputs)
  File "/root/miniconda3/envs/uie/lib/python3.9/site-packages/paddlenlp/trainer/trainer.py", line 1521, in _maybe_log_save_evaluate
    metrics = self.evaluate(ignore_keys=ignore_keys_for_eval)
  File "/root/miniconda3/envs/uie/lib/python3.9/site-packages/paddlenlp/trainer/trainer.py", line 2989, in evaluate
    output = self.evaluation_loop(
  File "/root/miniconda3/envs/uie/lib/python3.9/site-packages/paddlenlp/trainer/trainer.py", line 3208, in evaluation_loop
    metrics = self.compute_metrics(EvalPrediction(predictions=all_preds, label_ids=batch_labels))
  File "/root/autodl-tmp/PaddleNLP/slm/model_zoo/uie/finetune.py", line 168, in compute_metrics
    start_ids, end_ids = p.label_ids
ValueError: too many values to unpack (expected 2)

稳定复现步骤 & 代码

p.label_ids解包发生错误

@jqtian123 jqtian123 added the bug Something isn't working label Feb 19, 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
Projects
None yet
Development

No branches or pull requests

2 participants