首页 > 解决方案 > 如何离线获取 elmo 嵌入?

问题描述

我正在使用 allennlp 库,并且正在尝试使以下行离线工作。我将要部署的计算机无法访问 Internet:

ee = allennlp.commands.elmo.ElmoEmbedder(
        options_file=options_file, 
        weight_file=weight_file, 
        cuda_device=cuda_device
    )

其中 options_file 和 weight_file 是
options_file = "https://allennlp.s3.amazonaws.com/models/elmo/2x4096_512_2048cnn_2xhighway/elmo_2x4096_512_2048cnn_2xhighway_options.json"
weight_file = "https://allennlp.s3.amazonaws.com/models/elmo/2x4096_512_2048cnn_2xhighway/elmo_2x4096_512_2048cnn_2xhighway_weights.hdf5"
cuda_device = 0or 1

如何将这两个文件保存到一个文件夹中以便它们脱机工作?谢谢!

顺便一提。我的文件~/.allennlp/cache夹中有 2 个 json 文件和 2 个其他文件,这些文件是在我运行命令时创建的。

标签: nlpnamed-entity-recognitionallennlpflair

解决方案


推荐阅读