PaddleNLP [Bug]: 运行CPU方式多线程运行文本分类多分类训练,保存完模型后,在进行评估时一直报错,

h4cxqtbf  于 2个月前  发布在  其他
关注(0)|答案(3)|浏览(45)

根据您提供的错误日志,问题出在分布式训练过程中的通信超时。具体来说,当执行trainer.predict(test_ds)时,出现了RuntimeError: [/paddle/third_party/gloo/gloo/transport/tcp/pair.cc:587] TIMEOUT self_rank = 0 pair_rank = 1 peer_str = [192.168.0.101]:19626错误。

这个错误可能是由于网络不稳定或者计算资源不足导致的。您可以尝试以下方法解决这个问题:

  1. 检查您的网络连接是否稳定,确保所有参与训练的节点之间的通信畅通。
  2. 增加每个节点的计算资源,例如内存、CPU等,以提高训练速度。
  3. 减小批量大小(--per_device_train_batch_size--per_device_eval_batch_size),以减少每次迭代所需的通信量。
  4. 调整模型参数,例如学习率、优化器等,以提高训练效果。

希望这些建议能帮助您解决问题。

j13ufse2

j13ufse21#

# Evaluate and tests model
if training_args.do_eval:
    if data_args.debug:
        **output = trainer.predict(test_ds)**
        log_metrics_debug(output, id2label, test_ds, data_args.bad_case_path)
    else:
        eval_metrics = trainer.evaluate()
        trainer.log_metrics("eval", eval_metrics)
9bfwbjaz

9bfwbjaz2#

output = trainer.predict(test_ds) 此行代码

r8xiu3jd

r8xiu3jd3#

使用以下命令运行:

python -m paddle.distributed.launch --nproc_per_node=4 
--backend=gloo 
train.py 
--do_train 
--do_eval 
--debug 
--do_export 
--model_name_or_path ernie-3.0-tiny-medium-v2-zh 
--output_dir checkpoint 
--device cpu 
--num_train_epochs 3 
--early_stopping True 
--early_stopping_patience 5 
--learning_rate 3e-5 
--max_length 128 
--per_device_eval_batch_size 32 
--per_device_train_batch_size 32 
--metric_for_best_model accuracy 
--load_best_model_at_end 
--logging_steps 5 
--evaluation_strategy epoch 
--save_strategy epoch 
--save_total_limit 1

相关问题