-
Notifications
You must be signed in to change notification settings - Fork 74k
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
TypeError: this __dict__ descriptor does not support '_DictWrapper' objects #59869
Comments
@pmatsibekker Thanks for reporting the issue. We see that you are using 1.x version which is not supported anymore. I was able to run the code without any error on TF 2.11. Please find the gist here and let us know if it helps. Thank you. |
@pmatsibekker I guess this might work. Does it help to you, or still it persist. In Python, objects have a special attribute called dict, which is a dictionary that stores the object's attributes. However, there are some special objects called _DictWrapper that don't support the dict attribute. If you try to access dict on a _DictWrapper object, you'll get a TypeError. Code: |
Solved after removing saving model callback. It seems that error consists in model preservation procedure, which handled via transparent dictionary wrapper incorrectly. |
This issue also happens in version 2.12.0-rc0 on ubuntu import tensorflow as tf
mnist = tf.keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0
model = tf.keras.models.Sequential([
tf.keras.layers.Flatten(input_shape=(28, 28)),
tf.keras.layers.Dense(128, activation='relu'),
tf.keras.layers.Dropout(0.2),
tf.keras.layers.Dense(10, activation='softmax')
])
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
callbacks = [
tf.keras.callbacks.BackupAndRestore('backup'),
]
model.fit(x_train, y_train, epochs=5, callbacks=callbacks)
|
tf_nightly-2.13.0.dev20230302 works fine same code. |
wrapt >= 1.11.0, <1.15 works, so tf_nightly works fine |
upgrade worked. python had a hard time letting go of the version 1.x tensorflow library but a wipe and rebuild worked. thank you! |
In the solving commit it is mentioned that the error has to be understood and solved more in depth. Maybe the issue and discussion on the wrapt repo can be helpful. |
At this point I believe a more appropriate fix is to change the
The change in wrapt 1.15.0 was to fix a bug whereby exceptions were suppressed by a wrapper and not raised when doing attribute access. That these exceptions are now raised has subtly changed how Really need people in the tensorflow community to check this change with all your test suites and verify things still work as expected. I can't really do much else as have no idea what those wrappers in tensorflow do. For more details see GrahamDumpleton/wrapt#231. |
BTW, forgot to highlight this, but the trigger for this is that the exception that tensorflow raises:
uses If it changed to |
Thanks! It works for me when I download to 1.14.1 in conda using: |
Click to expand!
Issue Type
Bug
Have you reproduced the bug with TF nightly?
Yes
Source
binary
Tensorflow Version
v1.12.1-88869-g80170ee25b4 2.12.0-rc0
Custom Code
No
OS Platform and Distribution
WIndows 11
Mobile device
No response
Python version
3.11.2
Bazel version
No response
GCC/Compiler version
No response
CUDA/cuDNN version
No response
GPU model and memory
No response
Current Behaviour?
Standalone code to reproduce the issue
Relevant log output
The text was updated successfully, but these errors were encountered: