swabhs/open-sesame

Add python 3.X compatibility

brenowca opened this issue · 9 comments

Code compatibility with python 3 would be a nice feature since python 2.7 is no longer continued.

I made a pull request, #33, and I believe that it would close this issue and provide python 2.7 and 3.X compatibility to this repository.

Reading model from logs/fn1.7-pretrained-targetid/best-targetid-1.7-model ...
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/wanicca/code/framebase/open-sesame/sesame/targetid.py", line 430, 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,400000})

I tried the pretrained model with your code, but there is something buggy...

I have the same problem...

This would seem like a very important thing to fix because, as far as I can tell, NLTK relies on Python 3 and Open-Sesame relies on NLTK. Until this is resolved, is there any way to get around this problem?

To be clear, I can easily install NLTK for python 3 but not python 2. When I try running the sesame.preprocessor script with python 3, however, there is a cascade of bugs. When I fix one, another bug pops up.

Is there an interim fix for this? Thank you!

I have a branch running to resolve these issues. I have made it through training for the first 2 networks, and getting the 3rd now. On Python 3.6.X. Next, I will put it in a docker container.

dev branch with the latest: https://github.com/free-soellingeraj/open-sesame/tree/soellingeraj/python36-updates

I will push to master once I have gone through each model and start a new branch for the dockerfile.

Here's a working version using Python3.6 and the option for GPU compute.
https://github.com/free-soellingeraj/open-sesame

I struggled with the exact versions of libraries needed for running this 2.7 original version of open-sesame, so I'm sharing here what worked for me:
pip2 install numpy==1.15.0 dynet nltk==3.4
The remaining instructions, eg. downloading nltk modules, can run as usual.

Thanks everyone for the discussion above. I've now switched to Python 3.7, and hope this resolves most of the issues above. Special thanks to @BrenoWSRCa and @free-soellingeraj for creating forks with this compatibility!