(self, config, fine_tuning_config)
Transformer with a classification head and a language modeling head on top and optionally adapters.
Transformer with a classification head and a language modeling head on top and optionally adapters.
Transformer with a classification head and a language modeling head on top and optionally adapters .
def __init__(self, config, fine_tuning_config):
        """ Transformer with a classification head and a language modeling head on top and optionally adapters. """
        super().__init__(config)
        self.config = fine_tuning_config
        if fine_tuning_config.adapters_dim > 0:
            self.transformer = TransformerWithAdapters(fine_tuning_config.adapters_dim, config.embed_dim, config.hidden_dim,
                                                       config.num_embeddings, config.num_max_positions, config.num_heads,
                                                       config.num_layers, fine_tuning_config.dropout, causal=not config.mlm)
        self.classification_head = nn.Linear(config.embed_dim, fine_tuning_config.num_classes)
        self.apply(self.init_weights)
def __init__ ( self , config , fine_tuning_config ) : super ( ) . __init__ ( config ) self . config = fine_tuning_config if fine_tuning_config . adapters_dim > 0 : self . transformer = TransformerWithAdapters ( fine_tuning_config . adapters_dim , config . embed_dim , config . hidden_dim , config . num_embeddings , config . num_max_positions , config . num_heads , config . num_layers , fine_tuning_config . dropout , causal = not config . mlm ) self . classification_head = nn . Linear ( config . embed_dim , fine_tuning_config . num_classes ) self . apply ( self . init_weights )