Hvass-Labs / TensorFlow-Tutorials

TensorFlow Tutorials with YouTube Videos
MIT License
9.28k stars 4.19k forks source link

module 'tensorflow.python.ops.variable_scope' has no attribute '_VARSCOPE_KEY' #126

Closed haideralimughal closed 3 years ago

haideralimughal commented 3 years ago

Could you please give me any suggestions why i am getting this error in Prettytensor tutorials

WARNING:tensorflow:From C:/Users/Administrator/PycharmProjects/Tensorflow/Simple_Linear_Model.py:75: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

WARNING:tensorflow:From C:/Users/Administrator/PycharmProjects/Tensorflow/Simple_Linear_Model.py:81: calling argmax (from tensorflow.python.ops.math_ops) with dimension is deprecated and will be removed in a future version. Instructions for updating: Use the axis argument instead WARNING:tensorflow:From C:\Users\Administrator\anaconda3\envs\test\lib\site-packages\prettytensor\bookkeeper.py:80: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.

WARNING:tensorflow:From C:\Users\Administrator\anaconda3\envs\test\lib\site-packages\prettytensor\scopes.py:47: The name tf.get_variable_scope is deprecated. Please use tf.compat.v1.get_variable_scope instead.

WARNING:tensorflow:From C:\Users\Administrator\anaconda3\envs\test\lib\site-packages\prettytensor\scopes.py:55: The name tf.get_collection_ref is deprecated. Please use tf.compat.v1.get_collection_ref instead.

Traceback (most recent call last): File "C:/Users/Administrator/PycharmProjects/Tensorflow/Simple_Linear_Model.py", line 238, in conv2d(kernel=5, depth=16, name='layer_conv1').\ File "C:\Users\Administrator\anaconda3\envs\test\lib\site-packages\prettytensor\pretty_tensor_class.py", line 1965, in method with _method_scope(input_layer, scopename) as (scope, ): File "C:\Users\Administrator\anaconda3\envs\test\lib\contextlib.py", line 112, in enter return next(self.gen) File "C:\Users\Administrator\anaconda3\envs\test\lib\site-packages\prettytensor\pretty_tensor_class.py", line 1776, in _method_scope scopes.var_and_name_scope((name, None)) as (scope, var_scope): File "C:\Users\Administrator\anaconda3\envs\test\lib\contextlib.py", line 112, in enter return next(self.gen) File "C:\Users\Administrator\anaconda3\envs\test\lib\site-packages\prettytensor\scopes.py", line 55, in var_and_name_scope vs_key = tf.get_collection_ref(variable_scope._VARSCOPE_KEY) AttributeError: module 'tensorflow.python.ops.variable_scope' has no attribute '_VARSCOPE_KEY'

Process finished with exit code 1

Hvass-Labs commented 3 years ago

You haven't even written which version of TensorFlow you are using so it's very hard to help you. But it looks like you are trying to use very old TensorFlow code with a new version of TensorFlow. As written in the README for these tutorials, several tutorials are no longer supported in TensorFlow 2. If you want to run them, you need to either use an old version of TensorFlow, or you could try and run TF2 in v.1 compatibility mode. But I cannot help you with either. You need to google for instructions on how to do that. If you do find the solution then please write it here so it may help others in the future.

Also, I would suggest you learn how to use Keras instead of PrettyTensor.

haideralimughal commented 3 years ago

thanks for your reply i am using TF1.10 and how can i get the right installations according to your tutorials

On Mon, Nov 2, 2020 at 9:46 PM Hvass-Labs notifications@github.com wrote:

You haven't even written which version of TensorFlow you are using so it's very hard to help you. But it looks like you are trying to use very old TensorFlow code with a new version of TensorFlow. As written in the README for these tutorials, several tutorials are no longer supported in TensorFlow 2. If you want to run them, you need to either use an old version of TensorFlow, or you could try and run TF2 in v.1 compatibility mode. But I cannot help you with either. You need to google for instructions on how to do that. If you do find the solution then please write it here so it may help others in the future.

Also, I would suggest you learn how to use Keras instead of PrettyTensor.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Hvass-Labs/TensorFlow-Tutorials/issues/126#issuecomment-720481543, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI4PKQXP3UNUKG6XGZHC2YLSN2Z2FANCNFSM4TGIFFZQ .

-- Kind Regards,

Haider Ali Cell No:+8615529005696 Email:bscs.f13.17@gmail.com Email%3Abscs.f13.17@gmail.com