How can I get hidden_states from BertForSequenceClassification?
I read the official tutorial(https://huggingface.co/transformers/model_doc/bert.html) and tried to set config, but it doesn't work.

from transformers import PretrainedConfig
model = BertForSequenceClassification.from_pretrained("bert-base-uncased", num_labels=2)
model.config.output_hidden_states = True
model.load_state_dict(torch.load('../parameter.pkl'))
model.cuda()
output = model(input)


Output should be a list that holds the hidden states. I expect that because you are loading the parameter.pkl which may not have output hidden states by default, it is overwriting your config.output_hidden_states to False? See what happens if you set it to True after loading the state_dict?
