Closed cartal closed 4 years ago
The solution provided by the Tensorflow team on their website:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
doesn't seem to work either
Hi,
Even I face the same AttributeError: module 'tensorflow' has no attribute 'placeholder' issue with tensorflow version 2.0
Any leads or workaround for this is greatly appreciated.
Hi @cartal and @Kaarthic29, We will eventually update to tf2 but currently I am super busy with other stuff. The current and safest option is to use tf <2.0 for now. We will have a new release when we update it and also add trVAE.
Mo
Thanks @M0hammadL , as of now i have used tf.compat.v1 to solve that placeholder error in tf v2.0
AttributeError: module 'tensorflow' has no attribute 'placeholder' can any one please tell me how to solve this error message
If you are using tf v2.0. tf v2.0 does not seems to have placeholder(), .reset_default_graph(). You can find more information here: https://www.tensorflow.org/guide/effective_tf2
I solved this and several other incompatibilities in my code by going back to tensorflow version 1:
pip install tensorflow==1.4
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
works. I am using Python 3.7 and tensorflow 2.0.
This error may come if you have installed TensorFlow 2.0 and want to run code that is not compatible with TensorFlow 2.0
For example if you are trying to run below code, you will get the above error. Please check the below post.
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
works. I am using Python 3.7 and tensorflow 2.0.
It works well Thank you ^_^
I re-installed tensorflow==1.15.2 and it worked (otherwise rasa-nlu wouldn't work)
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
works. I am using Python 3.7 and tensorflow 2.0.
yeah it is working now
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
works. I am using Python 3.7 and tensorflow 2.0.
yeah it is working now
for me its not working
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
works. I am using Python 3.7 and tensorflow 2.0.
yeah it is working now
for me its not working
Hello sharifimran, for me what worked was to reinstall TF + Keras version I use. Try this combination:
python -m pip install Keras==2.3.1 tensorflow==2.1.0
just remove the current version of tensorflow (using command: conda remove tensorflow), then install 1.15.0 using command: conda install tensorflow=1.15.0. it works
The same problem was happening to me...
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
it works..
The solution provided by the Tensorflow team on their website:
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
doesn't seem to work either
well it worked for me
the error is because we are using tensorflow version 2 and the command is from version 1 so if we use tf.compat.v1.summary.(method_name) it'll work
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
It worked for me too. I was getting this error from this file site-packages\keras\backend\tensorflow_backend.py I used this code over there.
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
It is working for me but the thing is it is affecting other parts of my code so is there any solution within version 2
May I know what it's affecting
what these couple of line of codes does is disabling the version 2 of tensorflow but I'm using AdamOptimizer which have different syntax in different versions and executing those couple of line is affecting the version 2 syntax of AdamOptimizer.....I may not be so clear as I'm new tensorflow user but any help would be appreciated
On Sun, 3 May 2020 at 15:08, sakshijain032 notifications@github.com wrote:
May I know what it's affecting
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/theislab/scgen/issues/14#issuecomment-623082183, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANQRR7HCKN3QSG37C2FULJLRPU3QFANCNFSM4I7MJCCA .
pip install tensorflow==1.4 will work as it has placeholder attribute
If you use Keras try change your import from keras.name_of_class to tensorflow.keras.name_of_class
The solution provided by the Tensorflow team on their website:
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
doesn't seem to work either
I was using tf(2.0.0-alpha0),python(Python 3.6.4) and it worked for me
just remove the current version of tensorflow (using command: conda remove tensorflow), then install 1.15.0 using command: conda install tensorflow=1.15.0. it works
This worked for me. Thanks.
The following lines of code do not work in the environment of TensorFlow 2.2 and Keras 2.4.3
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
or
import tensorflow.compat.v1 as tf
tf.compat.v1.disable_eager_execution()
AttributeError: module 'tensorflow' has no attribute 'placeholder'
However, the following line code works effectively.
tf.compat.v1.placeholder()
The solution provided by the Tensorflow team on their website:
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
doesn't seem to work either
This worked for me.
Hi @cartal and @Kaarthic29, We will eventually update to tf2 but currently I am super busy with other stuff. The current and safest option is to use tf <2.0 for now. We will have a new release when we update it and also add trVAE.
Mo
Hi @M0hammadL Hope you are well. I have this same issue with TensorFlow 2.1.0, I don't know if you finally found an alternative to use a placeholder in tf2 without disabling tf2.behavior? Thank for advance
The below worked for a similar problem i was facing. I tried going back to a previous version but couldn't. Now i have v2.3 working with the below: 1) Used upgrade script to change all my old files to v2 - https://www.tensorflow.org/guide/upgrade 2) After that there was still an issue which got fixed with this line (from suggestion few posts above here) tf.compat.v1.disable_eager_execution()
import tensorflow.compat.v1 as tf tf.compat.v1.disable_eager_execution() It is working for me
It
The solution provided by the Tensorflow team on their website:
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
doesn't seem to work either
Damm.... It works for me too, great
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
works. I am using Python 3.7 and tensorflow 2.0.
its still working.
Can somebody help me?
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
It reminds me that I
WARNING:tensorflow:From /Users/brycelee/PycharmProjects/MNST/venv/lib/python3.8/site-packages/tensorflow/python/compat/v2_compat.py:96: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version. Instructions for updating: non-resource variables are not supported in the long term
And it tells me 'no module named compat'
@Bryson582 which version of tensorflow do u use?
@alitokur I am using Python 2.7.16 and tensorflow '2.3.1'
@Bryson582 may the problem be your python version? tensorflow2 requires python 3.5–3.8, pip and venv >= 19.0
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
working with Python3.7 and TF 2.3.1
@mikechen66 AttributeError: module 'tensorflow' has no attribute 'compact'
@mikechen66 AttributeError: module 'tensorflow' has no attribute 'compact'
Check if your TensorFlow is well installed on your machine.
try:
import tensorflow
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
works. I am using Python 3.7 and tensorflow 2.0.
hey, where to place this code snippet, can u please mention?
@GP-Kulam you can use like the following on the import part:
import numpy as np
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
Hey I did that: import tensorflow.compat.v1 as tf tf.disable_v2_behavior() but it does not work. What else could be the problem?
Print the error here.
@bm777: AttributeError: module 'tensorflow' has no attribute 'placeholder'
Thank you for your help!
For me, you have two choices if you are using TensorFlow 2.x:
import tensorflow.compat.v1 as tf
and use tf in your code.pip uninstall tensorflow pip install tensorflow==1.7
@bm777 I tried that one too but I also use Keras in the code and for Keras tensorflow 2.2 is needed at least. Is there another solution?
For better help, could you please, show a part of your code and plot the screenshot of your error here too.
Hi,
Even I face the same AttributeError: module 'tensorflow' has no attribute 'placeholder' issue with tensorflow version 2.0
Any leads or workaround for this is greatly appreciated. import tensorflow as tf tf.compat.v1.disable_eager_execution() us tf.compat.v1.placeholder
The solution provided by the Tensorflow team on their website:
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
doesn't seem to work either
module 'tensorflow.compat.v1' has no attribute 'contrib'
Hi guys,
I had to upgrade my
tensorflow
to re-installdiffxpy
and this seems to have broken myscGen
: I've got theAttributeError:
module 'tensorflow' has no attribute 'placeholder'`.I'm trying to find a workaround this, but it seems that it's something that
scGen
will have to fix at some point? Do you have any recommendations?Thanks in advance!