def load_model(model_path: str) -> None:
    '\n    模型加载\n    @param model_path: 模型文件夹路径\n    @return:\n    '
    global kge_model, entity2id, id2entity, relation2id, all_true_triples, args
    args = DotMap(json.load(codecs.open(os.path.join(model_path, 'config.json'), 'r', encoding='utf-8')))
    (entity2id, id2entity, relation2id, id2relation, all_true_triples) = get_entity_relation_with_id(args.data_path)
    kge_model = KGEModel(model_name=args.model, nentity=args.nentity, nrelation=args.nrelation, hidden_dim=args.hidden_dim, gamma=args.gamma, double_entity_embedding=args.double_entity_embedding, double_relation_embedding=args.double_relation_embedding)
    if args.cuda:
        kge_model = kge_model.cuda()
    checkpoint = torch.load(os.path.join(args.init_checkpoint, 'checkpoint'))
    kge_model.load_state_dict(checkpoint['model_state_dict'])
模型加载
@param model_path: 模型文件夹路径
@return:
def load_model(model_path: str) -> None:
    '\n    模型加载\n    @param model_path: 模型文件夹路径\n    @return:\n    '
    global kge_model, entity2id, id2entity, relation2id, all_true_triples, args
    args = DotMap(json.load(codecs.open(os.path.join(model_path, 'config.json'), 'r', encoding='utf-8')))
    (entity2id, id2entity, relation2id, id2relation, all_true_triples) = get_entity_relation_with_id(args.data_path)
    kge_model = KGEModel(model_name=args.model, nentity=args.nentity, nrelation=args.nrelation, hidden_dim=args.hidden_dim, gamma=args.gamma, double_entity_embedding=args.double_entity_embedding, double_relation_embedding=args.double_relation_embedding)
    if args.cuda:
        kge_model = kge_model.cuda()
    checkpoint = torch.load(os.path.join(args.init_checkpoint, 'checkpoint'))
    kge_model.load_state_dict(checkpoint['model_state_dict'])