def METHOD_NAME(cls, pretrained_file: str = None, projection_dim: int = 0, dropout: float = 0.1,
                 vocab_size: int = 0,
                 padding_idx: int = 0, **kwargs):
    cfg = get_pytext_bert_base_cfg()
    if dropout != 0:
        cfg.dropout = dropout
        cfg.attention_dropout = dropout
        cfg.activation_dropout = dropout
    encoder = cls(cfg, padding_idx, vocab_size, projection_dim, **kwargs)
    if pretrained_file:
        logger.info('Loading pre-trained pytext encoder state from %s', pretrained_file)
        state = torch.load(pretrained_file)
        encoder.load_state_dict(state)
    return encoder