Open iamthebot opened 7 months ago
I can verify this bug is not present in 2.15.1. Nor is it present in tf-nightly==2.17.0.dev20240312
with keras-nightly==3.1.0.dev2024031203
Same issue, even simpler example:
import tensorflow as tf
pretrained_model = tf.keras.applications.MobileNet()
tf.saved_model.save(pretrained_model, "mobilenet")
TypeError: this __dict__ descriptor does not support '_DictWrapper' objects
TensorFlow 2.16.0rc0 and 2.16.1 are the only tensorflow
versions currently available using pip install.
I am having the exact same issue.
@darrina yeah the only workaround we have right now is tf-nightly
to enable model saving w/ py3.12... but that's obviously not a viable workaround for production use.
Running into a similar issue.
Hi @iamthebot ,
Sorry for the delay, I tried to run your code on Colab using TF v2.15 and 2.16, But I don't faced any issue here. Could you check again. Please find the gist here for reference.
Thank you!
@Venkat6871 I have similar issue and I think the issue is with python 3.12, with python 3.11 it works
I confirm this to be linked to python 3.12.
I tested tensorflow 2.16, 2.16.1 and 2.17.0.dev20240317. There problem occured with all of them.
@Venkat6871 yep looks like Python 3.12 is required to reproduce this issue. Your collab is running Python 3.10.
By the way disabling wrapt by setting an environment variable WRAPT_DISABLE_EXTENSIONS
(as hinted by wrapt developer https://github.com/GrahamDumpleton/wrapt/issues/231#issuecomment-1455800902) will make the scripts run as expected:
WRAPT_DISABLE_EXTENSIONS=1 python3 python_script.py
It seems to be caused by a fix in the C extension of wrapt which was not adopted yet by tensorflow: https://github.com/GrahamDumpleton/wrapt/issues/231
same issue for me...
import sys
print(sys.version_info)
sys.version_info(major=3, minor=12, micro=3, releaselevel='final', serial=0)
print(tf.__version__)
2.16.1
@Venkat6871 yep looks like Python 3.12 is required to reproduce this issue. Your collab is running Python 3.10.
it also happens using newer versions of typing_extensions on <3.12. Happened for me on 3.9 with typing_extensions=4.12, even on tensorflow 2.15 and wrapt < 1.15. Is this issue being looked into?
FYI, same issue here: python==3.12.4, tf==2.16.2 gives this error, but python==3.11.9, tf==2.15.0 works fine.
Same issue with: TypeError: this dict descriptor does not support '_DictWrapper' objects
This happened when trying to follow the SAC agent tutorial on the tf agents website. Particularly, the "Learners" bit.
I use a custom environment, python == 3.10.12, tf == 2.14.0. wrapt ==1.14.1
Facing issue with tf=2.17 (installed from source) and python 3.12.6 in tf.saved_model.save(model,path) typing-extensions:4.12.2, protobuf(python):4.21.9
I need to save model so that I can load(and use) it using cpp-api.
Do you know which is the minimum version of typing-extensions that doesn't cause this?
Issue type
Bug
Have you reproduced the bug with TensorFlow Nightly?
No (bug doesn't exist in tf-nightly 2.17.0.dev20240312)
Source
source
TensorFlow version
v2.16.1
Custom code
Yes
OS platform and distribution
OSX
Mobile device
No response
Python version
3.12
Bazel version
No response
GCC/compiler version
No response
CUDA/cuDNN version
No response
GPU model and memory
No response
Current behavior?
When calling
tf.saved_model.save(model, saved_model_path)
we see:
I suspect this is related to #59869 which was supposedly fixed. However, in 2.16.1 TF removes the pin on wrapt and the issue indeed persists. I've even tried downgrading wrapt to 1.14.1 and the issue remains.
Standalone code to reproduce the issue