Open Slime0519 opened 3 years ago
# Model definition
class ConverstaionLM(nn.Module):
def __init__(self,configpath = None):
super(ConverstaionLM, self).__init__()
#self.kogpt2 = GPT2LMHeadModel.from_pretrained(pretrained_path)
assert configpath is not None, "Please put in model configuration file."
config = AutoConfig.from_pretrained(configpath)
self.converstaion_model = AutoModel.from_config(config)
# in api_handler.py
model_config_path = os.path.join(model_dir, "config.json")
self.model = ConverstaionLM(configpath=model_config_path)
# model_dir contain config.json, tokenizer.json, tokenizer_config.json, speical_tokens_map.json
self.tokenizer = AutoTokenizer.from_pretrained(model_dir)
여러 모델들을 추가하는 것을 가정하고 짜자.
TO-DO