File size: 388 Bytes
dfe40cb
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13

from transformers import AutoConfig, AutoModel
from modeling_cnn_ner import CNNForNER

def get_model(pretrained_model_name_or_path):
    config = AutoConfig.from_pretrained(pretrained_model_name_or_path)
    model = CNNForNER(
        pretrained_model_name=config.pretrained_model_name,
        num_classes=config.num_classes,
        max_length=config.max_length
    )
    return model