【问题标题】:Stanford NLP Tree LSTM running error斯坦福 NLP 树 LSTM 运行错误
【发布时间】:2016-05-08 01:01:26
【问题描述】:

我正在测试斯坦福 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 下运行的,花了好几个小时却搞不清楚。我对这些东西很陌生,有人知道出了什么问题吗?

【问题讨论】:

  • 读取错误attempt to index local file (a nil value)和来源Vocab.lua。我敢打赌你忘了设置一些配置来指定词汇文件的路径。

标签: macos lua stanford-nlp lstm


【解决方案1】:
1. cp glove.840B.300d.zip data/glove folder 
2. unzip glove.840B.300d.zip inside data/glove folder 
3. run the following     command
4. th scripts/convert-wordvecs.lua data/glove/glove.840B.300d.txt data/glove/glove.840B.vocab data/glove/glove.840B.300d.th

你会看到类似

Converting data/glove/glove.840B.300d.txt to Torch serialized format
count = 2196017
dim = 300

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

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

--------------------------------------------------------------------------------
Constituency Tree LSTM for Sentiment Classification
--------------------------------------------------------------------------------
loading word embeddings
unk count = 976
loading datasets
num train = 8544

num dev   = 1101
num test  = 2210
--------------------------------------------------------------------------------
model configuration
--------------------------------------------------------------------------------
max epochs = 2
fine grained sentiment    = true
num params                = 1085105
num compositional params  = 1083600
word vector dim           = 300
Tree-LSTM memory dim      = 300
regularization strength   = 1.00e-04
minibatch size            = 25
learning rate             = 5.00e-02
word vector learning rate = 1.00e-01
dropout                   = true
--------------------------------------------------------------------------------
Training model
--------------------------------------------------------------------------------
-- epoch 1

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-04-20
    • 1970-01-01
    • 2014-04-26
    • 1970-01-01
    • 2016-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多