I found two fine tune ways for Sequence Classification with transformer:
1,BertForSequenceClassification.from_pretrained(https://huggingface.co/transformers/training.html):
from transformers import BertForSequenceClassification
model = BertForSequenceClassification.from_pretrained('bert-base-uncased')
model.train()
2,python run_glue.py(https://github.com/huggingface/transformers/tree/master/examples/text-classification):
export GLUE_DIR=/path/to/glue
export TASK_NAME=MRPC
python run_glue.py \
--model_name_or_path bert-base-cased \
--task_name $TASK_NAME \
--do_train \
--do_eval \
--data_dir $GLUE_DIR/$TASK_NAME \
--max_seq_length 128 \
--per_device_train_batch_size 32 \
--learning_rate 2e-5 \
--num_train_epochs 3.0 \
--output_dir /tmp/$TASK_NAME/
Are there any difference between them?