PaddlePaddle / PaddleNLP

👑 Easy-to-use and powerful NLP and LLM library with 🤗 Awesome model zoo, supporting wide-range of NLP tasks from research to industrial applications, including 🗂Text Classification, 🔍 Neural Search, ❓ Question Answering, ℹ️ Information Extraction, 📄 Document Intelligence, 💌 Sentiment Analysis etc.
https://paddlenlp.readthedocs.io
Apache License 2.0
12.14k stars 2.94k forks source link

Layoutxlm 多卡训练ser任务,保存模型时显示找不到save_pretrained方法 #1484

Closed WenmuZhou closed 2 years ago

WenmuZhou commented 2 years ago

欢迎您反馈PaddleNLP使用问题,非常感谢您对PaddleNLP的贡献! 在留下您的问题时,辛苦您同步提供如下信息:

训练脚本

python3 -m paddle.distributed.launch \
    --log_dir=./log/ \
    --gpus '0,1' \
    train_ser.py \
    --model_name_or_path "layoutxlm-base-uncased" \
    --train_data_dir "XFUN_v1.0_data/zh.train/" \
    --train_label_path "XFUN_v1.0_data/xfun_normalize_train.json" \
    --eval_data_dir "XFUN_v1.0_data/zh.val/" \
    --eval_label_path "XFUN_v1.0_data/xfun_normalize_val.json" \
    --num_train_epochs 200 \
    --eval_steps 10 \
    --output_dir "./output/ser_distributed/" \
    --learning_rate 5e-5 \
    --warmup_steps 50 \
    --per_gpu_train_batch_size 8 \
    --evaluate_during_training \
    --seed 2048
yingyibiao commented 2 years ago

多卡环境训练,可以通过model._layers.save_pretrained(output_dir)进行模型的保存

WenmuZhou commented 2 years ago

多卡环境训练,可以通过model._layers.save_pretrained(output_dir)进行模型的保存

好的,已解决