Skip to content

请问hanlp可以加载本地模型吗 #31

@SetonLiang

Description

@SetonLiang

generator = KG2InstructGenerator(
label_db="/newdisk3/data/guihh/KG2Instruction/data/db/label_zh.db",
alias_db="/newdisk3/data/guihh/KG2Instruction/data/db/alias_zh.db",
alias_rev_db="/newdisk3/data/guihh/KG2Instruction/data/db/alias_rev_zh.db",
relation_db="/newdisk3/data/guihh/KG2Instruction/data/db/relation.db",
relation_map_path="/newdisk3/data/guihh/KG2Instruction/data/other/relation_map.json",
model="/newdisk3/data/guihh/KG2Instruction/model/close_tok_pos_ner_srl_dep_sdp_con_electra_base",
language="zh",
device=0,
add_relation_value=False
)

参照KG2Instruction 配好环境并下载了hanlp.pretrained.mtl.CLOSE_TOK_POS_NER_SRL_DEP_SDP_CON_ELECTRA_BASE_ZH的NER模型,通过hanlp.load加载了本地的预训练模型,但还是会重新下载在线模型:

Image

Downloading https://file.hankcs.com/hanlp/mtl/close_tok_pos_ner_srl_dep_sdp_con_electra_small_20210111_124159.zip to /home/.hanlp/mtl/close_tok_pos_ner_srl_dep_sdp_con_electra_small_20210111_124159.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions