-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[Trainer] PaddleNLP trainer and finetune ernie-1.0 pretrain. #1761
Conversation
Coding style CI没过。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
datasets | ||
tqdm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tqdm是否一定要放在requirements里面了?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议放一下,默认会 import tqdm。
这里 datasets 是 会依赖 tqdm的,实际上不加也可以。
from paddlenlp.metrics.squad import squad_evaluate, compute_prediction | ||
|
||
from paddlenlp.trainer.trainer_base import TrainerBase | ||
from paddlenlp.utils.log import logger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我看library增加一下新的logging模块,是否需要新增logging模块,是否在logger模块上进行优化升级了?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已删除 新的logging模块
, trainer 这边之前主要有些日志分级控制、重定向文件输出等能力,后续可以升级
|
||
|
||
@dataclass | ||
class DataTrainingArguments: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的Arguments设置可以放到paddlenlp library里面,这样的话后续可以统一一些配置,例如max_seq_length这种设置在各个任务里面都可以直接使用
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
方案是可行的。
但放库里面有一个问题,用户缺少自定义参数的示例。当用户要添加自定参数需求,会缺少指引
@@ -0,0 +1,171 @@ | |||
# Copyright 2020-present the HuggingFace Inc. team. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里有个疑问,这个示例为什么要有HF的Copyright
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已删除
examples/language_model/ernie-1.0/finetune/token_classification.py
Outdated
Show resolved
Hide resolved
examples/language_model/ernie-1.0/finetune/sequence_classification.py
Outdated
Show resolved
Hide resolved
examples/language_model/ernie-1.0/finetune/sequence_classification.py
Outdated
Show resolved
Hide resolved
examples/language_model/ernie-1.0/finetune/sequence_classification.py
Outdated
Show resolved
Hide resolved
return batchify_fn | ||
|
||
|
||
class Dict(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在paddlenlp里面Dict class,这里区别是什么了?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的 dict 返回出来还是dict,原来paddlenlp里面返回为 list。
paddle.static.InputSpec( | ||
shape=[None, None], dtype="int64") # segment_ids | ||
] | ||
trainer.export_model(input_spec=input_spec, load_best_model=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
输出模型path可以让用户自定义
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已添加
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…r ernie-1.0 pretraining. (PaddlePaddle#1761) * add some datasets for finetune. * support fine tune for all tastks. * add trainer prototype. * init verison for paddlenlp trainer. * refine trainer. * update for some details. * support multi-cards training evaluation. * support load from ckpt. * support for export inference model. * first version of trainer. * seq cls support clue. * trainer support for token classification and question answersing tasks. * fix as reviews. Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
PR types
New features
PR changes
Others
Description
Finetune for all tasks.
示例用法:
Logs of Trainer
更新日志
TODO: