我阅读了官方教程(https://huggingface.co/transformers/model_doc/bert.html)并尝试设置配置,但它不起作用。
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)