Hi everyone,
I’ve faced a problem regarding the configuration parameters of a custom model (say distilbert). To elaborate, let’s give an example:
Suppose we want to perform the text classification task. For this purpose, we have 2 approaches:
-
we can directly use
DistilBertForSequenceClassification
in hugging face modules (and just change the number of output in classifier):
model = DistilBertForSequenceClassification.from_pretrained('distilbert-base-uncased')
-
write a custom model and define a specific classification head:
In the first approach, model.config
gives the configuration of the model, but in the second, it rises an error: 'Distilbert' object has no attribute 'config'
.
The question is, why does this happen?!
Thanks