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 | |