models/Transformer/class_wrapper.py
def make_optimizer(self, optim, lr, weight_decay):
        """
        Make the corresponding optimizer from the Only below optimizers are allowed. Welcome to add more
        :return:
        """
        if optim == 'Adam':
            op = torch.optim.Adam(self.model.parameters(), lr=lr, weight_decay=weight_decay)
        elif optim == 'RMSprop':
            op = torch.optim.RMSprop(self.model.parameters(), lr=lr, weight_decay=weight_decay)
        elif optim == 'SGD':
            op = torch.optim.SGD(self.model.parameters(), lr=lr, weight_decay=weight_decay)
        else:
            raise Exception("Your Optimizer is neither Adam, RMSprop or SGD, please change in param or contact Ben")
        return op

        Make the corresponding optimizer from the Only below optimizers are allowed. Welcome to add more
        :return:
        
Make the corresponding optimizer from the Only below optimizers are allowed. Welcome to add more
Make the corresponding optimizer from the Only below optimizers are allowed . Welcome to add more
def make_optimizer(self, optim, lr, weight_decay):
        if optim == 'Adam':
            op = torch.optim.Adam(self.model.parameters(), lr=lr, weight_decay=weight_decay)
        elif optim == 'RMSprop':
            op = torch.optim.RMSprop(self.model.parameters(), lr=lr, weight_decay=weight_decay)
        elif optim == 'SGD':
            op = torch.optim.SGD(self.model.parameters(), lr=lr, weight_decay=weight_decay)
        else:
            raise Exception("Your Optimizer is neither Adam, RMSprop or SGD, please change in param or contact Ben")
        return op
def make_optimizer ( self , optim , lr , weight_decay ) : if optim == 'Adam' : op = torch . optim . Adam ( self . model . parameters ( ) , lr = lr , weight_decay = weight_decay ) elif optim == 'RMSprop' : op = torch . optim . RMSprop ( self . model . parameters ( ) , lr = lr , weight_decay = weight_decay ) elif optim == 'SGD' : op = torch . optim . SGD ( self . model . parameters ( ) , lr = lr , weight_decay = weight_decay ) else : raise Exception ( "Your Optimizer is neither Adam, RMSprop or SGD, please change in param or contact Ben" ) return op
Make the corresponding optimizer from the Only below optimizers are allowed.
Make the corresponding optimizer from the Only below optimizers are allowed .
"""
        Make the corresponding optimizer from the Only below optimizers are allowed. Welcome to add more
        :return:
        """
None
self
optim
lr
weight_decay