def Activation(activation=None, dim=-1):
    """
    generate activation module
    Args:
        activation (str): activation
        dim (int): dimension
    return: activation module
    """
    if activation in [None, 'id', 'identity', 'linear']:
        return nn.Identity()
    elif activation == 'tanh':
        return nn.Tanh()
    elif activation == 'relu':
        return nn.ReLU()
    elif activation == 'gelu':
        return nn.GELU()
    elif activation in ['swish', 'silu']:
        return nn.SiLU()
    elif activation == 'glu':
        return nn.GLU(dim=dim)
    elif activation == 'sigmoid':
        return nn.Sigmoid()
    else:
        raise NotImplementedError("hidden activation '{}' is not implemented".format(activation))
generate activation module
Args:
activation (str): activation
dim (int): dimension
return: activation module
towhee/models/vis4mer/activation.py