-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeError: Dimensions of lookup parameter /_0 lookup up from file ({100,400574}) do not match parameters to be populated ({100,410050}) #61
Comments
I am also working on the same problem. I haven't totally solved the problem but I do solve one bug in the preprocessing script which is related. In "preprocess.py", line 79, remove the encode function. outf.write(str(token.encode('utf-8')) + "\t") # The encode shouldn't appear here in the python3 version
outf.write(str(token) + "\t") # FORM = 1 # The correct one When using encode function here, the output of the training data would be
, where the prefix b indicates that it is a byte. When parsing training data to build the vocabulary (VOCDICT), these words are treated as a whole (b'Over'). The vocabulary size is then larger than the original one. After solving this, the vocabulary size doesn't match still. Now it is 400572 but the provided model has 400574 words. Waiting for someone else to dig further into the issue. Thanks. |
Thanks for that tip! Still hoping someone has insight into the cause of this problem. I'd be willing to try fixing it. |
I also faced a completely similar problem. |
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. |
@Brit7777 Wow, that worked! Thank you! Hopefully with our own trained models, the other problem of vocab size will be solved as well. I will know for sure by tomorrow, probably. :) |
@eahogue I'm training my model rn as well haha. Training argid takes forever....Please let me know if the trained model works without error! |
@eahogue @Brit7777 @Vlad116 Even though I installed
Is there anything I miss? I’d be glad if you could help me. |
There are actually two problems here. One is the vocab number which appears
when you try to make predictions from the pre-trained models. I assume this
has something to do with one of the models being corrupted or some number
not matching up somewhere. No one seems to know.
Switching to Dynet 2.1 doesn't affect that. What it does is make it
possible to train your own models. If you try training with the recommended
version of dynet, you get NaN errors. Using the newer version does fix that
problem.
The upshot being, if you want to use open-sesame, you have to train your
own models first.
Alan
…On Sun, Mar 21, 2021 at 10:11 PM fairy-of-9 ***@***.***> wrote:
@eahogue <https://github.com/eahogue> @Brit7777
<https://github.com/Brit7777> @Vlad116 <https://github.com/Vlad116>
Hi, Everyone I respect.
Even though I installed Dynet v.2.1, I have the same problem.
***@***.***:~/bert_models/open-sesame# pip show nltk
Name: nltk
Version: 3.5
Summary: Natural Language Toolkit
Home-page: http://nltk.org/
Author: Steven Bird
Author-email: ***@***.***
License: Apache License, Version 2.0
Location: /opt/conda/lib/python3.7/site-packages
Requires: tqdm, joblib, regex, click
Required-by:
***@***.***:~/bert_modelsopen-sesame# pip show dynet
Name: dyNET
Version: 2.1
Summary: The Dynamic Neural Network Toolkit
Home-page: https://github.com/clab/dynet
Author: Graham Neubig
Author-email: ***@***.***
License: Apache 2.0
Location: /opt/conda/lib/python3.7/site-packages
Requires: numpy, cython
Required-by:
***@***.***:~/bert_models/minimal-BERT/open-sesame# python -m sesame.targetid --mode predict --model_name fn1.7-pretrained-targetid --raw_input data/input/atomic-emotion.txt
[dynet] random seed: 715363830
[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: /root/bert_models/minimal-BERT/open-sesame/sesame/targetid.py --mode predict --model_name fn1.7-pretrained-targetid --raw_input data/input/atomic-emotion.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:06, 96443.46it/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 = 550
Unlearnt in dev/test = 400550
# POS tags = 45
Unseen in dev/test = 0
Unlearnt in dev/test = 1
# Lemmas = 9349
Unseen in dev/test = 5495
Unlearnt in dev/test = 5496
_____________________
Reading model from logs/fn1.7-pretrained-targetid/best-targetid-1.7-model ...
Traceback (most recent call last):
File "/opt/conda/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/opt/conda/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/root/bert_models/minimal-BERT/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})
Is there anything I miss?
I’d be glad if you could help me.
Thanks.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#61 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJ2L3GZNWDW2HEM2WUVLULTE3GQJANCNFSM4YNWTE6Q>
.
|
I understood the current situation accurately. Thanks for your kind reply! ...> There are actually two problems here. One is the vocab number which appears when you try to make predictions from the pre-trained models. I assume this has something to do with one of the models being corrupted or some number not matching up somewhere. No one seems to know. Switching to Dynet 2.1 doesn't affect that. What it does is make it possible to train your own models. If you try training with the recommended version of dynet, you get NaN errors. Using the newer version does fix that problem. The upshot being, if you want to use open-sesame, you have to train your own models first. Alan > […](#) > On Sun, Mar 21, 2021 at 10:11 PM fairy-of-9 ***@***.***> wrote: @eahogue @Brit7777 @Vlad116 Hi, Everyone I respect. Even though I installed Dynet v.2.1, I have the same problem. ***@***.***:~/bert_models/open-sesame# pip show nltk Name: nltk Version: 3.5 Summary: Natural Language Toolkit Home-page: http://nltk.org/ Author: Steven Bird Author-email: ***@***.*** License: Apache License, Version 2.0 Location: /opt/conda/lib/python3.7/site-packages Requires: tqdm, joblib, regex, click Required-by: ***@***.***:~/bert_modelsopen-sesame# pip show dynet Name: dyNET Version: 2.1 Summary: The Dynamic Neural Network Toolkit Home-page: https://github.com/clab/dynet Author: Graham Neubig Author-email: ***@***.*** License: Apache 2.0 Location: /opt/conda/lib/python3.7/site-packages Requires: numpy, cython Required-by: ***@***.***:~/bert_models/minimal-BERT/open-sesame# python -m sesame.targetid --mode predict --model_name fn1.7-pretrained-targetid --raw_input data/input/atomic-emotion.txt [dynet] random seed: 715363830 [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: /root/bert_models/minimal-BERT/open-sesame/sesame/targetid.py --mode predict --model_name fn1.7-pretrained-targetid --raw_input data/input/atomic-emotion.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:06, 96443.46it/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 = 550 Unlearnt in dev/test = 400550 # POS tags = 45 Unseen in dev/test = 0 Unlearnt in dev/test = 1 # Lemmas = 9349 Unseen in dev/test = 5495 Unlearnt in dev/test = 5496 _____________________ Reading model from logs/fn1.7-pretrained-targetid/best-targetid-1.7-model ... Traceback (most recent call last): File "/opt/conda/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/opt/conda/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/root/bert_models/minimal-BERT/open-sesame/sesame/targetid.py", line 459, in 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}) Is there anything I miss? I’d be glad if you could help me. Thanks. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <[#61 (comment)](https://github.com//issues/61#issuecomment-803764959)>, or unsubscribe . |
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) 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 . |
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 Best dev f1:
I will still try to retrain them later. |
Thanks a lot for this. But I am still getting the same error
|
Try dyNET == 2.1 as mentioned earlier.
|
Thanks for this. Surprisingly, it was still not working on my Mac configuration. Tested on Windows with the same configuration and it works! Will deep dive into it and see why it's not working on MacOS... |
Hi, did you make any changes to the code you successfully ran except for the version of dynet? |
@Vlad116 hi, sorry to bother. I am trying to use your trained model by running following command:
Could you please upload your |
@Alexia1994 Hi, could there be a problem in the Python version? It seems there was this file |
@Alexia1994 hi, I also have the same problem. Have you solved it yet? |
+up same problem here. Trying to avoid retraining since it is taking a lonnng time |
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 |
@chanind very nice work! Thanks for sharing. I will try with your repo. |
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:
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.
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.
Thank you,
Alan
The text was updated successfully, but these errors were encountered: