tensorflow / models

Models and examples built with TensorFlow
Other
76.78k stars 45.85k forks source link

AttributeError: module 'tensorflow.python.training.experimental.mixed_precision' has no attribute '_register_wrapper_optimizer_cls' #11216

Open abdullahhaidary opened 4 weeks ago

abdullahhaidary commented 4 weeks ago

I am new to tensorflow object detection i have installed tensorflow object detection necessary packages listed in the website belowtensorflow-object-detection-api, but after all the steps when i try to test if my packages are installed correctly or not this error occurs i searched a lot but i couldn't found any solution (ttttf) C:\Users\PC\Desktop\TFOD2\models\research>python object_detection/builders/model_builder_tf2_test.py Traceback (most recent call last): File "C:\Users\PC\Desktop\TFOD2\models\research\object_detection\builders\model_builder_tf2_test.py", line 21, in import tensorflow.compat.v1 as tf File "C:\Users\PC\anaconda3\envs\ttttf\lib\site-packages\tensorflow__init__.py", line 469, in _keras._load() File "C:\Users\PC\anaconda3\envs\ttttf\lib\site-packages\tensorflow\python\util\lazy_loader.py", line 41, in _load module = importlib.import_module(self.name) File "C:\Users\PC\anaconda3\envs\ttttf\lib\importlib__init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "C:\Users\PC\AppData\Roaming\Python\Python39\site-packages\keras\init.py", line 25, in from keras import models File "C:\Users\PC\AppData\Roaming\Python\Python39\site-packages\keras\models.py", line 20, in from keras import metrics as metrics_module File "C:\Users\PC\AppData\Roaming\Python\Python39\site-packages\keras\metrics.py", line 27, in from keras import activations File "C:\Users\PC\AppData\Roaming\Python\Python39\site-packages\keras\activations.py", line 20, in from keras.layers import advanced_activations File "C:\Users\PC\AppData\Roaming\Python\Python39\site-packages\keras\layers\init__.py", line 24, in from keras.engine.input_layer import Input File "C:\Users\PC\AppData\Roaming\Python\Python39\site-packages\keras\engine\input_layer.py", line 21, in from keras.engine import base_layer File "C:\Users\PC\AppData\Roaming\Python\Python39\site-packages\keras\engine\base_layer.py", line 41, in from keras.mixed_precision import loss_scale_optimizer File "C:\Users\PC\AppData\Roaming\Python\Python39\site-packages\keras\mixed_precision\loss_scale_optimizer.py", line 1179, in mixed_precision._register_wrapper_optimizer_cls(optimizer_v2.OptimizerV2, AttributeError: module 'tensorflow.python.training.experimental.mixed_precision' has no attribute '_register_wrapper_optimizer_cls'

(ttttf) C:\Users\PC\Desktop\TFOD2\models\research>

below are my list of packages installed ( pip freeze )

(ttttf) C:\Users\PC\Desktop\TFOD2\models\research>pip freeze absl-py==1.4.0 apache-beam==2.46.0 array-record==0.4.1 asttokens @ file:///opt/conda/conda-bld/asttokens_1646925590279/work astunparse==1.6.3 avro-python3==1.10.2 backcall @ file:///home/ktietz/src/ci/backcall_1611930011877/work bleach==6.1.0 cachetools==5.3.3 certifi==2024.6.2 charset-normalizer==3.3.2 click==8.1.7 cloudpickle==2.2.1 colorama @ file:///C:/b/abs_a9ozq0l032/croot/colorama_1672387194846/work comm @ file:///C:/b/abs_67a8058udb/croot/comm_1709322909844/work contextlib2==21.6.0 contourpy==1.2.1 crcmod==1.7 cycler==0.12.1 Cython==3.0.10 debugpy @ file:///C:/b/abs_c0y1fjipt2/croot/debugpy_1690906864587/work decorator @ file:///opt/conda/conda-bld/decorator_1643638310831/work dill==0.3.1.1 dm-tree==0.1.8 docopt==0.6.2 etils==1.5.2 exceptiongroup @ file:///C:/b/abs_c5h1o1_b5b/croot/exceptiongroup_1706031441653/work executing @ file:///opt/conda/conda-bld/executing_1646925071911/work fastavro==1.9.4 fasteners==0.19 flatbuffers==24.3.25 fonttools==4.53.0 fsspec==2024.5.0 gast==0.4.0 gin-config==0.5.0 google-api-core==2.19.0 google-api-python-client==2.131.0 google-auth==2.29.0 google-auth-httplib2==0.2.0 google-auth-oauthlib==0.4.6 google-pasta==0.2.0 googleapis-common-protos==1.63.0 grpcio==1.34.1 h5py==3.1.0 hdfs==2.7.3 httplib2==0.21.0 idna==3.7 immutabledict==4.2.0 importlib_metadata==7.1.0 importlib_resources==6.4.0 ipykernel @ file:///C:/b/abs_c2u94kxcy6/croot/ipykernel_1705933907920/work ipython @ file:///C:/b/abs_e5729i179y/croot/ipython_1694181400005/work jedi @ file:///C:/ci/jedi_1644315428289/work joblib==1.4.2 jupyter_client @ file:///C:/b/abs_a6h3c8hfdq/croot/jupyter_client_1699455939372/work jupyter_core @ file:///C:/b/abs_c769pbqg9b/croot/jupyter_core_1698937367513/work kaggle==1.6.14 keras==2.10.0 keras-nightly==2.5.0.dev2021032900 Keras-Preprocessing==1.1.2 kiwisolver==1.4.5 libclang==18.1.1 lvis==0.5.3 lxml==5.2.2 Markdown==3.6 markdown-it-py==3.0.0 MarkupSafe==2.1.5 matplotlib==3.9.0 matplotlib-inline @ file:///C:/ci/matplotlib-inline_1661915841596/work mdurl==0.1.2 ml-dtypes==0.4.0 namex==0.0.8 nest-asyncio @ file:///C:/b/abs_65d6lblmoi/croot/nest-asyncio_1708532721305/work numpy==1.24.4 oauth2client==4.1.3 oauthlib==3.2.2 object_detection @ file:///C:/Users/PC/Desktop/TFOD2/models/research objsize==0.6.1 opencv-python==4.9.0.80 opencv-python-headless==4.9.0.80 opt-einsum==3.3.0 optree==0.11.0 orjson==3.10.3 packaging @ file:///C:/b/abs_cc1h2xfosn/croot/packaging_1710807447479/work pandas==2.2.2 parso @ file:///opt/conda/conda-bld/parso_1641458642106/work pickleshare @ file:///tmp/build/80754af9/pickleshare_1606932040724/work pillow==10.3.0 platformdirs @ file:///C:/b/abs_b6z_yqw_ii/croot/platformdirs_1692205479426/work portalocker==2.8.2 promise==2.3 prompt-toolkit @ file:///C:/b/abs_68uwr58ed1/croot/prompt-toolkit_1704404394082/work proto-plus==1.23.0 protobuf==3.19.6 psutil @ file:///C:/Windows/Temp/abs_b2c2fd7f-9fd5-4756-95ea-8aed74d0039flsd9qufz/croots/recipe/psutil_1656431277748/work pure-eval @ file:///opt/conda/conda-bld/pure_eval_1646925070566/work py-cpuinfo==9.0.0 pyarrow==9.0.0 pyasn1==0.6.0 pyasn1_modules==0.4.0 pycocotools @ file:///C:/Users/PC/Desktop/TFOD2/cocoapi/PythonAPI pydot==1.4.2 Pygments @ file:///C:/b/absfay9dpq4n/croot/pygments_1684279990574/work pymongo==3.13.0 pyparsing==2.4.7 python-dateutil @ file:///C:/b/abs_3au_koqnbs/croot/python-dateutil_1716495777160/work python-slugify==8.0.4 pytz==2024.1 pywin32==305.1 PyYAML==5.4.1 pyzmq @ file:///C:/b/abs_89aq69t0up/croot/pyzmq_1705605705281/work regex==2024.5.15 requests==2.32.3 requests-oauthlib==2.0.0 rich==13.7.1 rsa==4.9 sacrebleu==2.2.0 scikit-learn==1.5.0 scipy==1.13.1 sentencepiece==0.2.0 seqeval==1.2.2 six==1.15.0 stack-data @ file:///opt/conda/conda-bld/stack_data_1646927590127/work tabulate==0.9.0 tensorboard==2.10.1 tensorboard-data-server==0.6.1 tensorboard-plugin-wit==1.8.1 tensorflow==2.10.1 tensorflow-addons==0.22.0 tensorflow-datasets==4.9.0 tensorflow-estimator==2.10.0 tensorflow-hub==0.16.1 tensorflow-io==0.31.0 tensorflow-io-gcs-filesystem==0.31.0 tensorflow-metadata==1.13.0 tensorflow-model-optimization==0.8.0 tensorflow-text==2.10.0 termcolor==1.1.0 text-unidecode==1.3 tf-keras==2.15.0 tf-models-official==2.10.1 tf-slim==1.1.0 threadpoolctl==3.5.0 toml==0.10.2 tornado @ file:///C:/b/abs_0cbrstidzg/croot/tornado_1696937003724/work tqdm==4.66.4 traitlets @ file:///C:/b/abs_e5m_xjjl94/croot/traitlets_1671143896266/work typeguard==2.13.3 typing_extensions @ file:///C:/b/abs_0as9mdbkfl/croot/typing_extensions_1715268906610/work tzdata==2024.1 uritemplate==4.1.1 urllib3==2.2.1 wcwidth @ file:///Users/ktietz/demo/mc3/conda-bld/wcwidth_1629357192024/work webencodings==0.5.1 Werkzeug==3.0.3 wrapt==1.12.1 zipp==3.19.1 zstandard==0.22.0

rannlangel commented 3 weeks ago

official/core/init.py

official/core/init.py