Stanford NLP Tree LSTM 运行错误

我正在测试由斯坦福大学NLP提供的代码,并按照 https://github.com/stanfordnlp/treelstm 中的说明进行操作。

然而,当我测试 th sentiment/main.lua -m constituency -b 时,我得到了以下错误:

    --------------------------------------------------------------------------------
    Constituency Tree LSTM for Sentiment Classification
    --------------------------------------------------------------------------------
    /Users/Solomon/torch/install/bin/luajit:
    /Users/Solomon/Downloads/treelstm-master/util/Vocab.lua:19:
    attempt to index local 'file' (a nil value)
    >stack traceback:
    /Users/Solomon/Downloads/treelstm-master/util/Vocab.lua:19: in function '__init'
    /Users/Solomon/torch/install/share/lua/5.1/torch/init.lua:91: in function </Users/Solomon/torch/install/share/lua/5.1/torch/init.lua:87>
    [C]: in function 'Vocab'
    sentiment/main.lua:48: in main chunk
    [C]: in function 'dofile'
    ...omon/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
    [C]: at 0x0104141d50

它在OSX Yosemite下运行,花了几个小时,但是一直都无法解决。我对这些东西还很陌生,有知道问题在哪里的人吗?

点赞
用户825707
用户825707
  1. 将 glove.840B.300d.zip 复制到 data/glove 文件夹中
  2. 在 data/glove 文件夹中解压 glove.840B.300d.zip
  3. 运行以下命令
  4. th scripts/convert-wordvecs.lua data/glove/glove.840B.300d.txt data/glove/glove.840B.vocab data/glove/glove.840B.300d.th

你会看到类似于

正在将 data/glove/glove.840B.300d.txt 转换为 Torch 序列化的格式
count = 2196017
dim = 300

**然后运行以下命令**

th sentiment/main.lua --model constituency --layers 4 --dim 300 --epochs 2

--------------------------------------------------------------------------------
基于组成树的情感分类的树形 LSTM
--------------------------------------------------------------------------------
加载词嵌入
unk count = 976
加载数据集
num train = 8544
num dev   = 1101
num test  = 2210
--------------------------------------------------------------------------------
模型配置
--------------------------------------------------------------------------------
最大 epochs 数 = 2
细粒度情感    = true
num params                = 1085105
num compositional params  = 1083600
词向量维度           = 300
Tree-LSTM 记忆维度      = 300
正则化强度   = 1.00e-04
minibatch 大小            = 25
学习率             = 5.00e-02
词向量学习率 = 1.00e-01
dropout                   = true
--------------------------------------------------------------------------------
正在训练模型
--------------------------------------------------------------------------------
-- epoch 1
2017-03-23 20:21:51