How can I change the forward function of BertForSequenceClassification

I run the code in /examples/pytorch/text-classification/ I want to change the forward funtion of BertForSequenceClassification.
My model is :
model = AutoModelForSequenceClassification.from_pretrained(
from_tf=bool(".ckpt" in args.model_name_or_path),
I change the code of class BertForSequenceClassification(BertPreTrainedModel) in src/transformers/models/bert/ But nothing happens, the forward function is still the same as the origin. I want to know how to change the code to change the forward function? Thanks!

1 Like