def EncoderText(model_name, vocab_size, word_dim, embed_size, num_layers, use_bi_gru=False, text_norm=True, dropout=0.0):
    """A wrapper to text encoders. Chooses between an different encoders
    that uses precomputed image features.
    """
    model_name = model_name.lower()
    EncoderMap = {
        'scan': EncoderTextRegion,
        'vsepp': EncoderTextGlobal,
        'sgraf': EncoderTextRegion,
        'imram': EncoderTextRegion,
        'bfan': EncoderTextRegion,
        'pfan': EncoderTextRegion
    }

    if model_name in EncoderMap:
        txt_enc = EncoderMap[model_name](vocab_size, word_dim, embed_size, num_layers, use_bi_gru, text_norm, dropout)
    else:
        raise ValueError("Unknown model: {}".format(model_name))

    return txt_enc
A wrapper to text encoders. Chooses between an different encoders
    that uses precomputed image features.
    
torchmm/models/retrieval/layers/txt_enc.py