Maluuba/nlg-eval

Metrics after below CIDEr not computed - AttributeError: module 'theano' has no attribute 'gof'

KristiyanVachev opened this issue · 3 comments

The metrics up to CIDEr are running fine, but after that I get this AttributeError: module 'theano' has no attribute 'gof' somewhere in the imports.

metrics_dict = compute_metrics(hypothesis='examples/hyp.txt', references=['examples/ref1.txt', 'examples/ref2.txt'])
Bleu_1: 0.550000
Bleu_2: 0.428174
Bleu_3: 0.284043
Bleu_4: 0.201143
METEOR: 0.295797
ROUGE_L: 0.522104
CIDEr: 1.242192

I have already tried to delete the $HOME folder and reinstall it 15 times on two different computers at two different networks. It has the same error on both computers.
I am also running this in a virtual environment.

Does anybody have an idea how to fix this?
If it is a problem with the files that need to be downloaded, is there any reliable way to download the needed files manually along with a way to check if all of the files are there?

Stack trace below:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
d:\personal\thesis\code\jupyter\venv\lib\site-packages\theano\gof\lazylinker_c.py in <module>
     80                     version,
---> 81                     actual_version, force_compile, _need_reload))
     82 except ImportError:

ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None. Extra debug information: force_compile=False, _need_reload=True

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
d:\personal\thesis\code\jupyter\venv\lib\site-packages\theano\gof\lazylinker_c.py in <module>
    104                         version,
--> 105                         actual_version, force_compile, _need_reload))
    106         except ImportError:

ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None. Extra debug information: force_compile=False, _need_reload=True

During handling of the above exception, another exception occurred:

Exception                                 Traceback (most recent call last)
d:\personal\thesis\code\jupyter\venv\lib\site-packages\theano\gof\vm.py in <module>
    673         raise theano.gof.cmodule.MissingGXX('lazylinker will not be imported if theano.config.cxx is not set.')
--> 674     from . import lazylinker_c
    675 

d:\personal\thesis\code\jupyter\venv\lib\site-packages\theano\gof\lazylinker_c.py in <module>
    139             cmodule.GCC_compiler.compile_str(dirname, code, location=loc,
--> 140                                              preargs=args)
    141             # Save version into the __init__.py file.

d:\personal\thesis\code\jupyter\venv\lib\site-packages\theano\gof\cmodule.py in compile_str(module_name, src_code, location, include_dirs, lib_dirs, libs, preargs, py_module, hide_symbols)
   2410             raise Exception('Compilation failed (return status=%s): %s' %
-> 2411                             (status, compile_stderr.replace('\n', '. ')))
   2412         elif config.cmodule.compilation_warning and compile_stderr:

Exception: Compilation failed (return status=1): cc1plus.exe: sorry, unimplemented: 64-bit mode not compiled in. 

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
<ipython-input-8-719f91c59fa5> in <module>
----> 1 metrics_dict = compute_metrics(hypothesis='examples/hyp.txt', references=['examples/ref1.txt', 'examples/ref2.txt'])

d:\personal\thesis\code\jupyter\venv\lib\site-packages\nlgeval\__init__.py in compute_metrics(hypothesis, references, no_overlap, no_skipthoughts, no_glove)
     51 
     52     if not no_skipthoughts:
---> 53         from nlgeval.skipthoughts import skipthoughts
     54         import numpy as np
     55         from sklearn.metrics.pairwise import cosine_similarity

d:\personal\thesis\code\jupyter\venv\lib\site-packages\nlgeval\skipthoughts\skipthoughts.py in <module>
      9 import numpy
     10 import six
---> 11 import theano
     12 import theano.tensor as tensor
     13 from nltk.tokenize import word_tokenize

d:\personal\thesis\code\jupyter\venv\lib\site-packages\theano\__init__.py in <module>
    108     object2, utils)
    109 
--> 110 from theano.compile import (
    111     SymbolicInput, In,
    112     SymbolicOutput, Out,

d:\personal\thesis\code\jupyter\venv\lib\site-packages\theano\compile\__init__.py in <module>
     10 from theano.compile.function_module import *
     11 
---> 12 from theano.compile.mode import *
     13 
     14 from theano.compile.io import *

d:\personal\thesis\code\jupyter\venv\lib\site-packages\theano\compile\mode.py in <module>
      9 import theano
     10 from theano import gof
---> 11 import theano.gof.vm
     12 from theano import config
     13 from six import string_types

d:\personal\thesis\code\jupyter\venv\lib\site-packages\theano\gof\vm.py in <module>
    681 except ImportError:
    682     pass
--> 683 except (OSError, theano.gof.cmodule.MissingGXX) as e:
    684     # OSError happens when g++ is not installed.  In that case, we
    685     # already changed the default linker to something else then CVM.

AttributeError: module 'theano' has no attribute 'gof'

Looks like a Theano specific issue and Theano might not be installed properly.

I have managed to fix it on my other computer, where it had a different unrelated error.

This problem still remains on my main computer, but it indeed seems to be with Theano. It is quite a tricky thing with my main theory being a problem with another installation of g++ on my computer - Theano/Theano#6576 . I will post an update if I manage to fix it someday.

As a closing tough, I had a lot of problems related to the of the contents of the $HOME, perhaps by unstable connections.
Some validation to check that the correct files are found (perhaps file sizes) or just an update to the README with a prompt to check the files (like the picture below) would probably save some people a lot of miserable weekends. The current error messages weren't very helpful to me.

image

Thanks for the feedback! You're right that installing Theano and its dependencies can cause issues, that's hard for us to control. At least Theano is deprecated.

That's a good point and listing off the file sizes, we can also use some checksums.