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

AutoGraph could not transform <bound method TopLevelFeature.decode_example of FeaturesDict #35101

Closed
olk opened this issue Dec 13, 2019 · 10 comments
Assignees
Labels
comp:autograph Autograph related issues TF 2.1 for tracking issues in 2.1 release type:bug Bug

Comments

@olk
Copy link

olk commented Dec 13, 2019

System information

  • OS Platform and Distribution: Arch Linux, 5.4.2-arch1-1-ARCH
  • TensorFlow installed from: binary
  • TensorFlow version: 2.1.0rc0-1
  • Keras version: 2.2.4-tf
  • Python version: 3.8
  • GPU model and memory: 2x GTX 1080 Ti 11GB"`

Describe the current behavior
executing Tensorflow's MNIST handwriting example produces warning:

WARNING:tensorflow:AutoGraph could not transform <bound method TopLevelFeature.decode_example of FeaturesDict({
'image': Image(shape=(28, 28, 1), dtype=tf.uint8),
'label': ClassLabel(shape=(), dtype=tf.int64, num_classes=10),
})> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output.
Cause: 'arguments' object has no attribute 'defaults'

Code to reproduce the issue
import tensorflow as tf
import tensorflow_datasets as tfds

from tensorflow.keras.optimizers import Adam

def build_model():
filters = 48
units = 24
kernel_size = 7
learning_rate = 1e-4
model = tf.keras.Sequential([
tf.keras.layers.Conv2D(filters=filters, kernel_size=(kernel_size, kernel_size), activation='relu', input_shape=(28, 28, 1)),
tf.keras.layers.MaxPooling2D(),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(units, activation='relu'),
tf.keras.layers.Dense(10, activation='softmax')
])
model.compile(loss='sparse_categorical_crossentropy', optimizer=Adam(learning_rate), metrics=['accuracy'])
return model

datasets, info = tfds.load(name='mnist', with_info=True, as_supervised=True)
mnist_train, mnist_test = datasets['train'], datasets['test']

num_train_examples = info.splits['train'].num_examples
num_test_examples = info.splits['test'].num_examples

BUFFER_SIZE = 10000
BATCH_SIZE = 32

def scale(image, label):
image = tf.cast(image, tf.float32)
image /= 255
return image, label

train_dataset = mnist_train.map(scale).shuffle(BUFFER_SIZE).repeat().batch(BATCH_SIZE).prefetch(buffer_size=tf.data.experimental.AUTOTUNE)
eval_dataset = mnist_test.map(scale).repeat().batch(BATCH_SIZE).prefetch(buffer_size=tf.data.experimental.AUTOTUNE)

model = build_model()

epochs=2
model.fit(
train_dataset,
validation_data=eval_dataset,
steps_per_epoch=num_train_examples/epochs,
validation_steps=num_test_examples/epochs,
epochs=epochs)

@oanush oanush self-assigned this Dec 16, 2019
@oanush oanush added comp:autograph Autograph related issues TF 2.1 for tracking issues in 2.1 release type:support Support issues labels Dec 16, 2019
@oanush
Copy link

oanush commented Dec 16, 2019

@olk ,
Hi,i tried running the code in TF-2.1rc-1 and I didn't face any error. Kindly find the gist of colab for your reference.Thanks!

@oanush oanush added the stat:awaiting response Status - Awaiting response from author label Dec 16, 2019
@olk
Copy link
Author

olk commented Dec 16, 2019

print('TensorFlow version: %s' % tf.__version__)
print('Keras version: %s' % tf.keras.__version__)

prints:

TensorFlow version: 2.1.0-rc0
Keras version: 2.2.4-tf

Does RC1 fix the issue?

@olk
Copy link
Author

olk commented Dec 16, 2019

Tensorflow at Arch Linux upgraded to new version

TensorFlow version: 2.1.0-rc1
Keras version: 2.2.4-tf

but same warnings are displayed:

WARNING:tensorflow:AutoGraph could not transform <bound method TopLevelFeature.decode_example of FeaturesDict({
'image': Image(shape=(28, 28, 1), dtype=tf.uint8),
'label': ClassLabel(shape=(), dtype=tf.int64, num_classes=10),
})> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output.
Cause: 'arguments' object has no attribute 'defaults'
WARNING:tensorflow:AutoGraph could not transform <bound method TopLevelFeature.decode_example of FeaturesDict({
'image': Image(shape=(28, 28, 1), dtype=tf.uint8),
'label': ClassLabel(shape=(), dtype=tf.int64, num_classes=10),
})> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output.
Cause: 'arguments' object has no attribute 'defaults'
WARNING:tensorflow:AutoGraph could not transform <bound method TopLevelFeature.decode_example of FeaturesDict({
'image': Image(shape=(28, 28, 1), dtype=tf.uint8),
'label': ClassLabel(shape=(), dtype=tf.int64, num_classes=10),
})> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output.
Cause: 'arguments' object has no attribute 'defaults'
WARNING:tensorflow:AutoGraph could not transform <bound method TopLevelFeature.decode_example of FeaturesDict({
'image': Image(shape=(28, 28, 1), dtype=tf.uint8),
'label': ClassLabel(shape=(), dtype=tf.int64, num_classes=10),
})> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output.
Cause: 'arguments' object has no attribute 'defaults'
WARNING:tensorflow:AutoGraph could not transform <function scale at 0x7f1877956940> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output.
Cause: invalid value for "node": expected "ast.AST", got "<class 'NoneType'>"; to visit lists of nodes, use "visit_block" instead
WARNING:tensorflow:AutoGraph could not transform <function scale at 0x7f1877956940> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output.
Cause: invalid value for "node": expected "ast.AST", got "<class 'NoneType'>"; to visit lists of nodes, use "visit_block" instead
Train for 30000.0 steps, validate for 5000.0 steps

@tensorflowbutler tensorflowbutler removed the stat:awaiting response Status - Awaiting response from author label Dec 17, 2019
@oanush oanush added type:bug Bug and removed type:support Support issues labels Dec 17, 2019
@oanush oanush assigned gowthamkpr and unassigned oanush Dec 17, 2019
@olk
Copy link
Author

olk commented Dec 17, 2019

I guess this issue is related to using Tensorflow with Python-3.8.

@olk
Copy link
Author

olk commented Dec 17, 2019

The error vanishes if I downgraded my system to:

  • Python 3.7.4
  • Tensorflow-2.1.0-rc1

After system upgrade (Python 3.8.0) I get the error messages again:

WARNING:root:Limited tf.compat.v2.summary API due to missing TensorBoard installation.
WARNING:root:Limited tf.compat.v2.summary API due to missing TensorBoard installation.
WARNING:root:Limited tf.compat.v2.summary API due to missing TensorBoard installation.
WARNING:tensorflow:AutoGraph could not transform <bound method TopLevelFeature.decode_example of FeaturesDict({
'image': Image(shape=(28, 28, 1), dtype=tf.uint8),
'label': ClassLabel(shape=(), dtype=tf.int64, num_classes=10),
})> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output.
Cause: 'arguments' object has no attribute 'defaults'
WARNING:tensorflow:AutoGraph could not transform <bound method TopLevelFeature.decode_example of FeaturesDict({
'image': Image(shape=(28, 28, 1), dtype=tf.uint8),
'label': ClassLabel(shape=(), dtype=tf.int64, num_classes=10),
})> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output.
Cause: 'arguments' object has no attribute 'defaults'
WARNING:tensorflow:AutoGraph could not transform <bound method TopLevelFeature.decode_example of FeaturesDict({
'image': Image(shape=(28, 28, 1), dtype=tf.uint8),
'label': ClassLabel(shape=(), dtype=tf.int64, num_classes=10),
})> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output.
Cause: 'arguments' object has no attribute 'defaults'
WARNING:tensorflow:AutoGraph could not transform <bound method TopLevelFeature.decode_example of FeaturesDict({
'image': Image(shape=(28, 28, 1), dtype=tf.uint8),
'label': ClassLabel(shape=(), dtype=tf.int64, num_classes=10),
})> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output.
Cause: 'arguments' object has no attribute 'defaults'
WARNING:tensorflow:AutoGraph could not transform <function scale at 0x7f35a7d63040> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output.
Cause: invalid value for "node": expected "ast.AST", got "<class 'NoneType'>"; to visit lists of nodes, use "visit_block" instead
WARNING:tensorflow:AutoGraph could not transform <function scale at 0x7f35a7d63040> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output.
Cause: invalid value for "node": expected "ast.AST", got "<class 'NoneType'>"; to visit lists of nodes, use "visit_block" instead
Train for 30000.0 steps, validate for 5000.0 steps
Epoch 1/2
2019-12-17 21:01:35.085243: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10
2019-12-17 21:01:36.341770: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
30000/30000 [==============================] - 114s 4ms/step - loss: 0.0856 - accuracy: 0.9758 - val_loss: 0.0379 - val_accuracy: 0.9889
Epoch 2/2
29996/30000 [============================>.] - ETA: 0s - loss: 0.0161 - accuracy: 0.99552019-12-17 21:05:09.198963: W tensorflow/core/kernels/data/generator_dataset_op.cc:103] Error occurred when finalizing GeneratorDataset iterator: Cancelled: Operation was cancelled
30000/30000 [==============================] - 112s 4ms/step - loss: 0.0161 - accuracy: 0.9955 - val_loss: 0.0350 - val_accuracy: 0.9898
2019-12-17 21:05:20.499356: W tensorflow/core/kernels/data/generator_dataset_op.cc:103] Error occurred when finalizing GeneratorDataset iterator: Cancelled: Operation was cancelled
2019-12-17 21:05:20.516223: W tensorflow/core/kernels/data/generator_dataset_op.cc:103] Error occurred when finalizing GeneratorDataset iterator: Cancelled: Operation was cancelled
elapsed: 226.111

Seams that this is an issue of Python-3.8.0 and Tensorflow-2.1.0-rc1.

@gowthamkpr
Copy link

@olk Try building tensorflow nightly version with python 3.8 and let me know if the issue still persists. Thanks!

@gowthamkpr gowthamkpr added the stat:awaiting response Status - Awaiting response from author label Dec 20, 2019
@tensorflowbutler
Copy link
Member

It has been 14 days with no activity and the awaiting response label was assigned. Is this still an issue?

@olk
Copy link
Author

olk commented Jan 6, 2020

I'm too busy to build tensorflow from scratch ...
Anyway, I've moved to MXNet - feel free to close this issue.

@tensorflowbutler tensorflowbutler removed the stat:awaiting response Status - Awaiting response from author label Jan 7, 2020
@gowthamkpr
Copy link

@olk I am sorry for misleading you in the above comment.

Tensorflow doesn't support python 3.8 yet. May be from Tensorflow 2.2, we might support python 3.8 and this is the cause of the error. Python 3.8 support for tensorflow has already been tracked here.

I am gonna close this issue. Thanks!

@tensorflow-bot
Copy link

tensorflow-bot bot commented Jan 9, 2020

Are you satisfied with the resolution of your issue?
Yes
No

@geetachavan1 geetachavan1 added this to In progress in TensorFlow 2.2.0 Feb 6, 2020
@goldiegadde goldiegadde moved this from In progress to Done in TensorFlow 2.2.0 Feb 6, 2020
@goldiegadde goldiegadde removed this from Done in TensorFlow 2.2.0 Feb 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:autograph Autograph related issues TF 2.1 for tracking issues in 2.1 release type:bug Bug
Projects
None yet
Development

No branches or pull requests

4 participants