Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot execute your code due to missing attribute '_linear' #10

Open
tle4336 opened this issue Jul 14, 2017 · 10 comments
Open

Cannot execute your code due to missing attribute '_linear' #10

tle4336 opened this issue Jul 14, 2017 · 10 comments

Comments

@tle4336
Copy link

tle4336 commented Jul 14, 2017

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?

@tle4336
Copy link
Author

tle4336 commented Jul 14, 2017

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;(

@ssonia1
Copy link

ssonia1 commented Sep 1, 2017

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

@manucarbonell
Copy link

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

@anthnyprschka
Copy link

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

@SkylerHuang
Copy link

@anthnyprschka i am newer , could you tell me more details of the substitude _linear with tf.xxxxx.fully_connected . thanks very much!

@lutein
Copy link

lutein commented Aug 21, 2018

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.

@kino-ngoo
Copy link

@lutein many thanks. This works for me, too.

@githubpiyush
Copy link

@lutein any alternative in tensorflow 2?? I was unable to find the _linear function in tensorflow add on.

@madhu-korada
Copy link

Yes, Any alternative in tensorflow 2 for _linear function ?

@shuDaoNan9
Copy link

How about TensorFlow 2 ? I can't find _Linear in TF2 too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants