

TITLE
Unable to execute RobertaModel from pretrained

COMMENTS
0

REACTIONS
+1: 0
-1: 0
laugh: 0
hooray: 0
heart: 0
rocket: 0
eyes: 0

BODY
### Defined a class that inherits from RobertaPretrainedModel and concats image embedding

class XLMRobertaWithImageConcatenationMultiOutputClassifier(RobertaPreTrainedModel):

   def __init__(self,  config_bert , num_labels):

        super(XLMRobertaWithImageConcatenationMultiOutputClassifier, self).__init__(config_bert)
        self.num_labels = num_labels
        self.num_another_labels = num_another_labels
        self.bert = RobertaModel(config_bert)
        self.backbone = models.resnet50(pretrained = False)        
        num_features = self.backbone.fc.in_features
        self.img_hidden_size = 512
        self.pre_classify_hidden = 512        
        self.pre_classify_fc = torch.nn.Linear(config_bert.hidden_size + self.img_hidden_size, self.pre_classify_hidden)
        self.classifier = torch.nn.Linear(self.pre_classify_hidden, num_labels)
        self.apply(self._init_weights)



### Trying to call XLMRobertaWithImageConcatenationMultiOutputClassifier from pretrained
model = XLMRobertaWithImageConcatenationMultiOutputClassifier.from_pretrained( 'roberta-base', num_labels = NUM_CLASSES)

### Error
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-22-d0dbf641e2da> in <module>
---> 17 model = XLMRobertaWithImageConcatenationMultiOutputClassifier.from_pretrained('roberta-base',, num_labels=NUM_CLASSES)

~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/transformers/modeling_utils.py in from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
   1323         else:
   1324             with no_init_weights(_enable=_fast_init):
-> 1325                 model = cls(config, *model_args, **model_kwargs)
   1326 
   1327         if from_pt:

TypeError: __init__() missing 1 required positional argument: 'num_labels'

Is there something I am missing? Despite giving num_labels it still asks for that parameter? Any idea or help would be highly appreciated.
