I have a custom Deberta model class for a downstream regression task. I have implemented almost the exact same model, except with a pre-trained Roberta model and it works fine. When I switch the the Deberta model I keep getting errors with the hidden state outputs.
_pretrained_model = 'deberta-base'
config = AutoConfig.from_pretrained(_pretrained_model)
config.update({'output_hidden_states':True})
model = AutoModel.from_pretrained(_pretrained_model, config=config)
tokenizer = AutoTokenizer.from_pretrained(_pretrained_model)
class DebertaCustomModel(nn.Module):
def __init__(self, pretrained_model_name):
super(DebertaCustomModel, self).__init__()
self.deberta = DebertaModel.from_pretrained(pretrained_model_name)
self.dropout = nn.Dropout(0.1)
self.linear1 = nn.Linear(768, 256)
self.linear2 = nn.Linear(256, 2)
def forward(self, input_ids, attention_mask):
outputs = self.deberta(input_ids=input_ids, attention_mask=attention_mask)
all_hidden_states = outputs.hidden_states
print(all_hidden_states)
When I print all_hidden_states it returns None. Does Deberta not allow you to return all all_hidden_states like Roberta does?