GoogleCloudPlatform / tensorflow-without-a-phd

A crash course in six episodes for software developers who want to become machine learning practitioners.
Apache License 2.0
2.79k stars 911 forks source link

AttributeError: 'Legend' object has no attribute 'draggable' #43

Open DHOFM opened 5 years ago

DHOFM commented 5 years ago

Hi, first let me say thanks a lot for your videos, making it easier to bring deep learning to my colleagues. But if I run the demo code I get AttributeError: 'Legend' object has no attribute 'draggable' in /tensorflowvisu.py", line 192, in init legend.draggable(True)

I get this on Mac OS with Python 3.7 and on Linux with Python 3.7

But commenting it out both times everything works fine on Mac OS - on Linux Ubuntu I get max test accurancy:0 and no training

Kind regards,

Dirk

dturvene commented 5 years ago

I had same issue running Ubuntu 18.04, python 3.6.7. I commented out legend.draggable(True) and it seems to work: max test accuracy: 0.9234

And I will also add: thanks for the video and code!

xgxofdream commented 4 years ago

I met the same issue in win 10 in Python 3.7. with Tensorflow version 1.15.0.

It is about matplotlib version: Legend.draggable is deprecated and replaced with Legend.set_draggable() in matplotlib 3.1.0 in May 2019.

I updated it, then no errors reported, but still no training I guess, I just got empty figures returned.

ps. lots of warnings:

`WARNING:tensorflow:From F:\tensorflow\tensorflow-mnist-tutorial\tensorflowvisu.py:27: The name tf.set_random_seed is deprecated. Please use tf.compat.v1.set_random_seed instead.

INFO:tensorflow:Tensorflow version 1.15.0 Tensorflow version 1.15.0 WARNING:tensorflow:From C:\Users\liuji\Anaconda3\lib\site-packages\tensorflow_core\python\data\util\random_seed.py:58: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.where in 2.0, which has the same broadcast rule as np.where WARNING:tensorflow:From F:\tensorflow\tensorflow-mnist-tutorial\mnistdata.py:47: DatasetV1.make_one_shot_iterator (from tensorflow.python.data.ops.dataset_ops) is deprecated and will be removed in a future version. Instructions for updating: Use for ... in dataset: to iterate over a dataset. If using tf.estimator, return the Dataset object directly from your input function. As a last resort, you can use tf.compat.v1.data.make_one_shot_iterator(dataset). WARNING:tensorflow:From F:\tensorflow\tensorflow-mnist-tutorial\mnistdata.py:52: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

WARNING:tensorflow:From F:/tensorflow/tensorflow-mnist-tutorial/mnist_1.0_softmax.py:44: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

WARNING:tensorflow:From F:/tensorflow/tensorflow-mnist-tutorial/mnist_1.0_softmax.py:67: The name tf.log is deprecated. Please use tf.math.log instead.

WARNING:tensorflow:From F:/tensorflow/tensorflow-mnist-tutorial/mnist_1.0_softmax.py:75: The name tf.train.GradientDescentOptimizer is deprecated. Please use tf.compat.v1.train.GradientDescentOptimizer instead.

WARNING:tensorflow:From F:/tensorflow/tensorflow-mnist-tutorial/mnist_1.0_softmax.py:85: The name tf.global_variables_initializer is deprecated. Please use tf.compat.v1.global_variables_initializer instead.`

xgxofdream commented 4 years ago

I also got these warnings, which may explain no training I guess, but i do not know how to fix.

runfile('F:/tensorflow/tensorflow-mnist-tutorial/mnist_2.0_five_layers_sigmoid.py', wdir='F:/tensorflow/tensorflow-mnist-tutorial') Reloaded modules: tensorflowvisu, tensorflowvisu_digits, mnistdata, trainer, trainer.task, trainer.utils INFO:tensorflow:Tensorflow version 1.15.0 Tensorflow version 1.15.0 WARNING:tensorflow:Entity <function read_image at 0x0000023E37555048> could not be transformed and will be executed as-is. Please report this to the AutoGraph team. When filing the bug, set the verbosity to 10 (on Linux,export AUTOGRAPH_VERBOSITY=10) and attach the full output. Cause: WARNING: Entity <function read_image at 0x0000023E37555048> could not be transformed and will be executed as-is. Please report this to the AutoGraph team. When filing the bug, set the verbosity to 10 (on Linux,export AUTOGRAPH_VERBOSITY=10) and attach the full output. Cause: WARNING:tensorflow:Entity <function read_label at 0x0000023E37553F78> could not be transformed and will be executed as-is. Please report this to the AutoGraph team. When filing the bug, set the verbosity to 10 (on Linux,export AUTOGRAPH_VERBOSITY=10) and attach the full output. Cause: WARNING: Entity <function read_label at 0x0000023E37553F78> could not be transformed and will be executed as-is. Please report this to the AutoGraph team. When filing the bug, set the verbosity to 10 (on Linux,export AUTOGRAPH_VERBOSITY=10`) and attach the full output. Cause: WARNING:tensorflow:From F:/tensorflow/tensorflow-mnist-tutorial/mnist_2.0_five_layers_sigmoid.py:51: The name tf.truncated_normal is deprecated. Please use tf.random.truncated_normal instead.

WARNING:tensorflow:From F:/tensorflow/tensorflow-mnist-tutorial/mnist_2.0_five_layers_sigmoid.py:74: softmax_cross_entropy_with_logits (from tensorflow.python.ops.nn_ops) is deprecated and will be removed in a future version. Instructions for updating:

Future major versions of TensorFlow will allow gradients to flow into the labels input on backprop by default.

See tf.nn.softmax_cross_entropy_with_logits_v2.

WARNING:tensorflow:From F:/tensorflow/tensorflow-mnist-tutorial/mnist_2.0_five_layers_sigmoid.py:90: The name tf.train.AdamOptimizer is deprecated. Please use tf.compat.v1.train.AdamOptimizer instead.`