deep-text-corrector
deep-text-corrector copied to clipboard
Cannot execute your code due to missing attribute '_linear'
Hi Alex, thanks for your great work!! I tried executing your main execution file ("textcorrector.ipnyb"), but I keep getting this error message: AttributeError: module 'tensorflow.python.ops.rnn_cell' has no attribute '_linear'. I ran your code using Jupyter Notebook, with Python's 3.5 version (latest), and tensorflow's 1.2.1 version (latest too). I don't understand why it keeps saying certain module lacks of the essential attribute to run your code. Could you please help explain why this happens, Alex?
So I was able to fix it now by deleting the entire 'linear =...' line. Now, another problem appears: ImportError: cannot import name 'TextCorrectorModel', when I execute the main file. I load the file 'text_corrector_models.py', and then run that file alone. I got the error message: ArgumentError: argument --config: conflicting option string: --config. These errors, surprisingly, stem from seq2seq.py. But the thing is: I already successful ran the seq2seq.py file. When I got rid of the line import seq2seq in the 'text_corrector_models.py' and ran this Python script, no error was announced!
Cannot believe running your execution file takes that much effort, but I still cannot give up;(
go to seq2seq.py
add in to seq2seq: from tensorflow.python.ops import rnn_cell_impl change line #70 to linear = rnn_cell_impl._linear
you will need seq2seq for text_corrector_models.py
Hi, I'm getting the same error as in the title. I did as you suggest @largevaluesoftwo but I still get this:
linear = rnn_cell_impl._linear # pylint: disable=protected-access AttributeError: 'module' object has no attribute '_linear'
any suggestion?
Thanks
This stems from the fact that newer versions of TF don't have the _linear op implemented in rnn_cell_impl anymore. If you downgrade your TF to 1.2 it should definitely work. Alternatively, i assume you can substitute _linear with a standard TF layer such as tf.contrib.layers.fully_connected. I am working on that currently for my own model
@anthnyprschka i am newer , could you tell me more details of the substitude _linear with tf.xxxxx.fully_connected . thanks very much!
Hi, I use tf 1.8 and solve this by changing seq2seq.py:
from tensorflow.contrib.rnn.python.ops import core_rnn_cell
linear = core_rnn_cell._Linear
This works for me.
@lutein many thanks. This works for me, too.
@lutein any alternative in tensorflow 2?? I was unable to find the _linear function in tensorflow add on.
Yes, Any alternative in tensorflow 2 for _linear function ?
How about TensorFlow 2 ? I can't find _Linear in TF2 too.