swabhs / open-sesame

A frame-semantic parsing system based on a softmax-margin SegRNN.
Apache License 2.0
229 stars 65 forks source link

use pre-trained model have problem. #12

Closed fuzihaofzh closed 6 years ago

fuzihaofzh commented 6 years ago

I run :

python -m sesame.targetid --model_name pretrained-targetid --mode predict --raw_input sentences.txt

But got:

Traceback (most recent call last):
  File "/gds/miniconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/gds/miniconda2/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/workbench/open-sesame/sesame/targetid.py", line 432, in <module>
    model.populate(model_file_name)
  File "_dynet.pyx", line 1061, in _dynet.ParameterCollection.populate
  File "_dynet.pyx", line 1116, in _dynet.ParameterCollection.populate_from_textfile
RuntimeError: Dimensions of lookup parameter /_0 lookup up from file ({100,74152}) do not match parameters to be populated ({100,10411})

How can I solve that?

fuzihaofzh commented 6 years ago

I retrained the model and it worked. I doubt whether the provided pretrained model is out of date?

swabhs commented 6 years ago

I was not able to reproduce this problem. Do you have the latest version of open-sesame?

fuzihaofzh commented 6 years ago

@swabhs I cloned the latest code and download the code following the instruction. Could you please give a version list of your environment? like python, dynet, etc.

swabhs commented 6 years ago

As mentioned in the README, this works on python=2.7. It should work on the latest version of DyNet, which is currently DyNet=2.0.3

BBCMax commented 6 years ago

Hi I am getting the same issue with a targetid model I trained, except with different values for the parameter mismatch:

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

Any ideas of how to fix this? Thanks!

swabhs commented 6 years ago

Did you train your model after pulling the repo, or was it trained previously and then you pulled the repo? I changed the way pretrained embeddings are processed in the repository, for standardization - this is the reason why things might not be working.

BBCMax commented 6 years ago

Hmm ok thats true, I trained this at the end of last week and pulled your latest changes today. So I will need to retrain?

I also noticed that target prediction can potentially fail as there is no mapping for "fw" (foreign words) in targetid.py - again I think this is best as a noun mapping? As it seems to most commonly occur in the names of people or places.

swabhs commented 6 years ago

If you are using this for English (FN versions 1.5 through 1.7) the mappings I have work. Unfortunately, there is no good way around the heuristic mapping, because of the way the lexical units are defined in the codebase.

Also, I have pretrained models available for download, so you don't have to retrain a model, if you are training on the standard FN 1.5/1.7 data.

BBCMax commented 6 years ago

I am using this for English (FN 1.7) and I found that I needed to add an "fw" mapping in order to parse some texts even with your fn1.7 targetid model.

I can't download your frameid model unfortunately, it currently goes through an endless loop on Google Drive taking me back to the download page. And do you have a rough idea when your argid model will be available?

Thank you for your great work on this!

swabhs commented 6 years ago

I did not encounter the endless loop problem you're talking about, and was able to successfully download and test. Did you use a command line downloader?