nlp - 如何离线获取 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 = 0
or 1
。
如何将这两个文件保存到一个文件夹中以便它们脱机工作?谢谢!
顺便一提。我的文件~/.allennlp/cache
夹中有 2 个 json 文件和 2 个其他文件,这些文件是在我运行命令时创建的。
解决方案
推荐阅读
- reactjs - 如何在中心设置 reactstrap modal-header 的内容?
- java - 为什么即使 myLocation 是全局变量,当 onSuccess() 终止时 myLocation 也会变为 null?
- redis - 相同变量的 Redis 复制
- javascript - 在渲染所有 DOM 元素后,控制器或路由器中是否存在要调用的钩子?
- php - 如何在 Laravel 5.7 中翻译 Carbon 1.32 - 环境 Docker(Laradock)
- sql-server - 按主键分组时如何最好地从其他表中选择项目
- java - 阻塞返回直到异步调用完成Java?
- eclipse - Spock 测试:Eclipse 似乎无法识别 Where 子句中的数据变量
- string - 如何在 Python 2.7 中将字符串转换为浮点数
- asp.net-mvc - 使用 MVC 按钮控件单击事件不起作用