How to customize output layer (activate function) of existing models with training arguments?
Hi all, I am using BertForSequenceClassification model for text sentiment analysis. Unlike general sentiment analysis, My model is predicting the intensity of the emotion (a real number between 0 and 1).So I would like to add a sigmoid function to the output layer of my model, is there any way to achieve this other than creating a new class?Currently, I have created the following class to train.class BertForSequenceClassificationWithSigmoid(
    BertForSequenceClassification
):

    """Docstring for BertForSequenceClassificationWithSigmoid. """

    def __init__(self, config):
        """TODO: to be defined. """
        super().__init__(config)
        self.classifier = nn.Sequential(
            self.classifier,
            nn.Sigmoid(),
        )However, with this method, I can’t move only the trained model file and predict by it in another environment. (Because it is necessary to define the class created for that environment.)So I would like to change the activation function of the output layer using TrainingArugument, etc. Is there any way to do this?
2022-04-12T13:18:32Z
HI,I am also looking for the same. did you figured it out?