bi-att-flow: Error when running this tensorflow-1.1.0 version

``$ python -m basic.cli --mode train --noload --debug Traceback (most recent call last): File “anaconda2/envs/tensorflow/lib/python3.5/runpy.py”, line 193, in _run_module_as_main “main”, mod_spec) File “anaconda2/envs/tensorflow/lib/python3.5/runpy.py”, line 85, in _run_code exec(code, run_globals) File “/bi-att-flow/basic/cli.py”, line 5, in <module> from basic.main import main as m File “/bi-att-flow/basic/main.py”, line 14, in <module> from basic.model import get_multi_gpu_models File “/bi-att-flow/basic/model.py”, line 6, in <module> from tensorflow.python.ops.rnn_cell import BasicLSTMCell ImportError: No module named ‘tensorflow.python.ops.rnn_cell’

I have installed the tensorflow-gpu 1.1.0 version and python 3.5.3 and all the required libraries.

It may seem some error with the code version and tensorflow, how can I solve this problem?

Well, it’s hard to find a tensorflow-gpu 0.11 version available now so I have to run the 1.1.0 version.

Thanks a lot!

About this issue

Most upvoted comments

@usakey Your solution not work under tensorflow v1.4

This fix it for me: from tensorflow.contrib.rnn.python.ops.rnn_cell import _Linear

@x-zho14 @daisyjack As per this commit: https://github.com/allenai/bi-att-flow/commit/3fb0943fefd71eea6886dd247d373f46054e922f , it seems this _linear was changed for tf-1.2 compatibility, but on tf-1.1 it doesn’t work for me either.

So my workaround is to revert back to previous one:

from tensorflow.contrib.rnn.python.ops.core_rnn_cell_impl import _linear
...
flat_out = _linear(flat_args, output_size, bias, bias_start=bias_start)

this works for me.

from tensorflow.contrib.rnn.python.ops import core_rnn_cell linear = core_rnn_cell._linear fix my problem!! windows10 + tensorflow1.6

For anyone starting to try to make sure this works, the following steps did for me:

  1. Create conda env with python version 3.5

  2. Install tensorflow version 0.12.1 after activating env using: export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp35-cp35m-linux_x86_64.whl (or any appropriate version) pip install $TF_BINARY_URL

  3. Edit the basic/run_single.sh file to use the created env when running by adding this line: source activate tensorflow35

  4. Run the program within the env using this bash command bash basic/run_single.sh $HOME/data/squad/dev-v1.1.json single.json

You can run this branch for the newer version of tensorflow (all errors have been fixed): https://github.com/Vimos/bi-att-flow/tree/tf1.8