def load_model(logger, args, n_entities, n_relations, ckpt=None): model = KEModel(args, args.model_name, n_entities, n_relations, args.hidden_dim, args.gamma, double_entity_emb=args.double_ent, double_relation_emb=args.double_rel) if ckpt is not None: # TODO: loading model emb only work for genernal Embedding, not for ExternalEmbedding model.load_state_dict(ckpt['model_state_dict']) return model
def load_model(logger, args, n_entities, n_relations, ckpt=None): model = KEModel(args, args.model_name, n_entities, n_relations, args.hidden_dim, args.gamma, double_entity_emb=args.double_ent, double_relation_emb=args.double_rel) if ckpt is not None: assert False, "We do not support loading model emb for genernal Embedding" return model
def load_model(logger, args, n_entities, n_relations, ckpt=None): model = KEModel(args, args.model_name, n_entities, n_relations, args.hidden_dim, args.gamma, double_entity_emb=args.double_ent, double_relation_emb=args.double_rel) if ckpt is not None: # TODO: loading model emb only work for genernal Embedding, not for ExternalEmbedding if args.gpu >= 0: model.load_parameters(ckpt, ctx=mx.gpu(args.gpu)) else: model.load_parameters(ckpt, ctx=mx.cpu()) logger.info('Load model {}'.format(args.model_name)) return model