shibing624 / pytextclassifier

pytextclassifier is a toolkit for text classification. 文本分类,LR,Xgboost,TextCNN,FastText,TextRNN,BERT等分类模型实现,开箱即用。
https://shibing624.github.io/pytextclassifier/
Apache License 2.0
482 stars 74 forks source link

Bert训练的时候可以添加early_stop吗?手动设置epoch不太理想~ #18

Open szj2ys opened 1 month ago

shibing624 commented 1 month ago

https://github.com/shibing624/pytextclassifier/blob/master/pytextclassifier/bert_classfication_utils.py#L77C18-L77C18 early_stop 默认支持的。

方法2:设置epoch=10,每个epoch都保存模型,回头基于valid loss选择best epoch model.

szj2ys commented 1 month ago

https://github.com/shibing624/pytextclassifier/blob/master/pytextclassifier/bert_classfication_utils.py#L77C18-L77C18 early_stop 默认支持的。

方法2:设置epoch=10,每个epoch都保存模型,回头基于valid loss选择best epoch model.

1)我的基座用的是roberta,model_type=‘bert'和model_type='roberta'都能跑起来,但是model_type='roberta'训练的loss比model_type=‘bert',请问model_type具体是什么作用,对模型训练有什么影响? 2)我想用LongformerForSequenceClassification做分类,model_type要设置成什么?