kentonl/e2e-coref

Python 3 compatibility

Opened this issue · 1 comments

Pab0 commented

My system

  • OS: Ubuntu 18.04
  • Virtual environment: Conda 4.7.5
  • Python: 2.7.12 (this is the setup I used to get it to run; the problems described below appeared when I ran the project with Python 3.7.3)
  • Tensorflow: 1.14.0
  • CUDA toolkit: 10.0

The problem

When run in a (conda) python3 environment, some of the scripts execute successfully but some still seem to require python2.

Specifically:

  • setup_all.sh works fine

  • Running setup_training.sh results in two issues:

    • skeleton2conll.py from the conll scripts throws a syntax error at line

      except InvalidSexprException, e:

    • get_char_vocab.py throws a syntax error at
      f.write(u"{}\n".format(char).encode("utf8"))
  • Running train.py within a python3 environment throws the following error:

    tensorflow.python.framework.errors_impl.NotFoundError: ./coref_kernels.so: undefined symbol: _ZN10tensorflow12OpDefBuilder4AttrESs

    The above symbol doesn't seem to exist in either the CPU or the GPU version of python3 TensorFlow (at least the versions available from pip an conda at the time of writing). While I could not find it in the python2 environment's TensorFlow either, the program still runs (maybe the symbol isn't called at all in the python2 version?).

Proposed solution

I have created a pull request to fix the two issues encountered when running setup_training.py: #67
Forcing a fallback to python2 for the problematic scripts allowed me to run the script even in a python3 environment.

Regarding the error in train.py, I'm not 100% sure that the Python version is the culprit. I'm not familiar with the inner workings of TensorFlow, so if you think this is unrelated I'll open a separate issue for this.

Getting same error