open-sesame: RuntimeError: Dimensions of lookup parameter /_0 lookup up from file ({100,400574}) do not match parameters to be populated ({100,410050})

Hello,

I tried to train new models from scratch, but that wouldn’t work. The targetid training would go fine, but then frameid would halt with a NaN error. It would do this at different points in the training, but always eventually did within the first 10% of training or so. None of the issues regarding this were helpful for me.

So, I downloaded the pre-trained models. When I run the pre-trained targetid model over a file of sentences, I see this:

python3 -m sesame.targetid --mode predict                             --model_name fn1.7-pretrained-targetid                             --raw_input yc_essential_startup_advice.txt
[dynet] random seed: 1809054107
[dynet] allocating memory: 512MB
[dynet] memory allocation done.
ARGID_LR:       0.0005
DATA_DIRECTORY: data/
DEBUG_MODE:     False
EMBEDDINGS_FILE:        data/glove.6B.100d.txt
VERSION:        1.7
_____________________
COMMAND: /home/alan/git_projects/open-sesame/sesame/targetid.py --mode predict --model_name fn1.7-pretrained-targetid --raw_input yc_essential_startup_advice.txt
MODEL FOR TEST / PREDICTION:    logs/fn1.7-pretrained-targetid/best-targetid-1.7-model
PARSING MODE:   predict
_____________________


Reading data/open_sesame_v1_data/fn1.7/fn1.7.fulltext.train.syntaxnet.conll ...
591032it [00:07, 83907.23it/s]
# examples in data/open_sesame_v1_data/fn1.7/fn1.7.fulltext.train.syntaxnet.conll : 19391 in 3413 sents
# examples with missing arguments : 526
Combined 19391 instances in data into 3413 instances.

Reading the lexical unit index file: data/fndata-1.7/luIndex.xml
# unique targets = 9421
# total targets = 13572
# targets with multiple LUs = 4151
# max LUs per target = 5


Reading pretrained embeddings from data/glove.6B.100d.txt ...

PARSER SETTINGS (see logs/fn1.7-pretrained-targetid/configuration.json)
_____________________
DEV_EVAL_EPOCH_FREQUENCY:       3
DROPOUT_RATE:   0.01
EVAL_AFTER_EVERY_EPOCHS:        100
HIDDEN_DIM:     100
LEMMA_DIM:      100
LSTM_DEPTH:     2
LSTM_DIM:       100
LSTM_INPUT_DIM: 100
NUM_EPOCHS:     100
PATIENCE:       25
POS_DIM:        100
PRETRAINED_EMBEDDING_DIM:       100
TOKEN_DIM:      100
TRAIN:  data/neural/fn1.7/fn1.7.fulltext.train.syntaxnet.conll
UNK_PROB:       0.1
USE_DROPOUT:    True

# Tokens = 410050
        Unseen in dev/test = 17
        Unlearnt in dev/test = 400017
# POS tags = 45
        Unseen in dev/test = 0
        Unlearnt in dev/test = 1
# Lemmas = 9349
        Unseen in dev/test = 114
        Unlearnt in dev/test = 115

_____________________

Reading model from logs/fn1.7-pretrained-targetid/best-targetid-1.7-model ...
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/alan/git_projects/open-sesame/sesame/targetid.py", line 459, in <module>
    model.populate(model_file_name)
  File "_dynet.pyx", line 1461, in _dynet.ParameterCollection.populate
  File "_dynet.pyx", line 1516, in _dynet.ParameterCollection.populate_from_textfile
RuntimeError: Dimensions of lookup parameter /_0 lookup up from file ({100,400574}) do not match parameters to be populated ({100,410050})

I thought perhaps, for some reason, you were supposed to run a test first, since other issues I found similar to this mentioned that it can happen if the training and testing config aren’t perfect matches.

$ python3 -m sesame.targetid --mode test --model_name
fn1.7-pretrained-targetid
[dynet] random seed: 3132663994
[dynet] allocating memory: 512MB
[dynet] memory allocation done.
ARGID_LR:       0.0005
DATA_DIRECTORY: data/
DEBUG_MODE:     False
EMBEDDINGS_FILE:        data/glove.6B.100d.txt
VERSION:        1.7
_____________________
COMMAND: /home/alan/git_projects/open-sesame/sesame/targetid.py --mode test --model_name fn1.7-pretrained-targetid
MODEL FOR TEST / PREDICTION:    logs/fn1.7-pretrained-targetid/best-targetid-1.7-model
PARSING MODE:   test
_____________________


Reading data/open_sesame_v1_data/fn1.7/fn1.7.fulltext.train.syntaxnet.conll ...
591032it [00:07, 80464.20it/s]
# examples in data/open_sesame_v1_data/fn1.7/fn1.7.fulltext.train.syntaxnet.conll : 19391 in 3413 sents
# examples with missing arguments : 526
Combined 19391 instances in data into 3413 instances.

Reading the lexical unit index file: data/fndata-1.7/luIndex.xml
# unique targets = 9421
# total targets = 13572
# targets with multiple LUs = 4151
# max LUs per target = 5


Reading pretrained embeddings from data/glove.6B.100d.txt ...

Reading data/open_sesame_v1_data/fn1.7/fn1.7.test.syntaxnet.conll ...
189185it [00:02, 74813.60it/s]
# examples in data/open_sesame_v1_data/fn1.7/fn1.7.test.syntaxnet.conll : 6714 in 1354 sents
# examples with missing arguments : 491
Combined 6714 instances in data into 1354 instances.

PARSER SETTINGS (see logs/fn1.7-pretrained-targetid/configuration.json)
_____________________
DEV_EVAL_EPOCH_FREQUENCY:       3
DROPOUT_RATE:   0.01
EVAL_AFTER_EVERY_EPOCHS:        100
HIDDEN_DIM:     100
LEMMA_DIM:      100
LSTM_DEPTH:     2
LSTM_DIM:       100
LSTM_INPUT_DIM: 100
NUM_EPOCHS:     100
PATIENCE:       25
POS_DIM:        100
PRETRAINED_EMBEDDING_DIM:       100
TOKEN_DIM:      100
TRAIN:  data/neural/fn1.7/fn1.7.fulltext.train.syntaxnet.conll
UNK_PROB:       0.1
USE_DROPOUT:    True

# Tokens = 410050
        Unseen in dev/test = 2029
        Unlearnt in dev/test = 402029
# POS tags = 45
        Unseen in dev/test = 0
        Unlearnt in dev/test = 1
# Lemmas = 9349
        Unseen in dev/test = 1958
        Unlearnt in dev/test = 1959

_____________________

Reading model from logs/fn1.7-pretrained-targetid/best-targetid-1.7-model ...
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/alan/git_projects/open-sesame/sesame/targetid.py", line 433, in <module>
    model.populate(model_file_name)
  File "_dynet.pyx", line 1461, in _dynet.ParameterCollection.populate
  File "_dynet.pyx", line 1516, in _dynet.ParameterCollection.populate_from_textfile
RuntimeError: Dimensions of lookup parameter /_0 lookup up from file ({100,400574}) do not match parameters to be populated ({100,410050})

So I am at quite a loss now. Details of what I am running below. Note that I am using the current release of DyNet (2.1.2) because the suggested one in the README seems to be unavailable. This seems to be because Eigen is no longer downloadable from the location it used to be. Installing Eigen from scratch is well over my head (as shown by a cascade of bugs which I won’t reproduce here), so I am hoping that I can get by with 2.1.2.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:        20.04
Codename:       focal
$ python3 --version
Python 3.8.5
$ pip show nltk
Name: nltk
Version: 3.5
Summary: Natural Language Toolkit
Home-page: http://nltk.org/
Author: Steven Bird
Author-email: stevenbird1@gmail.com
License: Apache License, Version 2.0
Location: /home/alan/.local/lib/python3.8/site-packages
Requires: click, tqdm, joblib, regex
Required-by:
$ pip show dynet
Name: dyNET
Version: 2.1.2
Summary: The Dynamic Neural Network Toolkit
Home-page: https://github.com/clab/dynet
Author: Graham Neubig
Author-email: dynet-users@googlegroups.com
License: Apache 2.0
Location: /home/alan/.local/lib/python3.8/site-packages
Requires: numpy, cython
Required-by:

Thank you, Alan

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 6
  • Comments: 23

Most upvoted comments

Hello @eahogue , how much time approximately did it take for you to train the model (targetid)? I have started training the model but its taking forever to train it. My specs are as follows and I am concerned that it will take a lot of time to train the models: MacBook Pro (13-inch, 2020, Four Thunderbolt 3 ports) Processor - 2 GHz Quad-Core Intel Core i5 Graphics - Intel Iris Plus Graphics 1536 MB RAM - 16 GB 3733 MHz LPDDR4X Also, if possible, can someone upload the trained models for targetid, frameid and argid, so that maybe others could use them as pre-trained models? Thanks!😃

Hello, I can try loading my trained models for targetid, frameid. But I haven’t tested them yet as the model for argid is still learning (4th day). And they will also have less accuracy than stated in this table https://github.com/swabhs/open-sesame#pre-trained-models . It would be better to share them after checking the work and additional training.

Can you still upload the trained models for targetid and frameid? I dont think there would be much of a difference between the accuracy of your models and the pretrained ones as they are trained on the same fn data. 😃

https://drive.google.com/file/d/1BMQJXbjhPItmdH8ZWRlqD3vKU16TAJrr/view?usp=sharing Yes of course. This archive contains all 3 models.

Best dev f1:

  • argid 0.5912
  • targetid 0.7892
  • frameid 0.8930

I will still try to retrain them later.

I struggled to get sesame working due to this issue, so instead trained a T5 transformer model using the open-sesame data/splits. It gets pretty comparable results in trigger ID and frame ID, but does better in arg ID. Sharing here in case it’s useful to others: https://github.com/chanind/frame-semantic-transformer

I had the same issue ( frameid haltingwith a NaN error), but I got it solved by using Dynet v. 2.1. You could do this with ‘pip install dynet==2.1’ command line.