def load_model(config): """ :param config: config :return: nn model """ print("***************************************") model = Sequence_Label(config) if config.use_cuda is True: model = model.cuda() if config.test is True: model = load_test_model(model, config) print(model) return model
def load_model(config): """ :param config: config :return: nn model """ print("***************************************") model = Text_Classification(config) if config.device != cpu_device: model = model.cuda() if config.test is True: model = load_test_model(model, config) print(model) return model
def load_model(config): """ :param config: config :return: nn model """ print("***************************************") model = Sequence_Label(config) print("Copy models to {}".format(config.save_dir)) shutil.copytree("models", "/".join([config.save_dir, "models"])) if config.device != cpu_device: model = model.cuda() if config.test is True: model = load_test_model(model, config) print(model) return model
def load_model(config): """ :param config: config :return: nn model """ print("***************************************") if config.use_bert: model = Text_Classification_BertFeature(config) else: model = Text_Classification(config) if config.device != cpu_device: model = model.to(config.device) if config.test is True: model = load_test_model(model, config) print(model) return model
def load_model(config): """ :param config: config :return: nn model """ print("***************************************") model = ParserModel(config) if config.device != cpu_device: model = model.to(config.device) if config.test is True: model = load_test_model(model, config) parser = BiaffineParser(model, config.word_ROOTID) print(model) print("Parser: ", parser) return parser
def load_model(config): """ :param config: config :return: nn model """ print("***************************************") model = None # if config.model_bilstm is True: # print("loading BiLSTM model......") # model = BiLSTM(config) model = Joint_AL(config) if config.use_cuda is True: model = model.cuda() if config.test is True: model = load_test_model(model, config) print(model) return model
def load_model(config): """ :param config: config :return: nn model """ print("***************************************") model = None if config.use_bert: print("Load Joint_AL_Bert Model .......") model = Joint_AL_Bert(config) elif config.use_bert_model: print("Load Joint_AL_BertModel Model .......") model = Joint_AL_BertModel(config) else: print("Load Joint_AL Model ......") model = Joint_AL(config) if config.device != cpu_device: # model = model.cuda() model = model.to(config.device) if config.test is True: model = load_test_model(model, config) print(model) return model