nicknochnack / TFODCourse

944 stars 919 forks source link

ValueError(f'mutable default {type(f.default)} for field #150

Closed csyeungad closed 10 months ago

csyeungad commented 10 months ago

Encounter error in step 6 train the model. Could anyone help on this?

Traceback (most recent call last): File "D:\Tensorflow object detection\TFODCourse\Tensorflow\models\research\object_detection\model_main_tf2.py", line 31, in from object_detection import model_lib_v2 File "D:\Tensorflow object detection\TFODCourse\tfod\Lib\site-packages\object_detection-0.1-py3.11.egg\object_detection\model_lib_v2.py", line 31, in from object_detection import model_lib File "D:\Tensorflow object detection\TFODCourse\tfod\Lib\site-packages\object_detection-0.1-py3.11.egg\object_detection\model_lib.py", line 35, in from object_detection.builders import optimizer_builder File "D:\Tensorflow object detection\TFODCourse\tfod\Lib\site-packages\object_detection-0.1-py3.11.egg\object_detection\builders\optimizer_builder.py", line 25, in from official.modeling.optimization import ema_optimizer File "D:\Tensorflow object detection\TFODCourse\tfod\Lib\site-packages\tf_models_official-2.13.1-py3.11.egg\official\modeling\optimization__init__.py", line 19, in from official.modeling.optimization.configs.optimization_config import * File "D:\Tensorflow object detection\TFODCourse\tfod\Lib\site-packages\tf_models_official-2.13.1-py3.11.egg\official\modeling\optimization\configs\optimization_config.py", line 31, in @dataclasses.dataclass ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\abcd\anaconda3\Lib\dataclasses.py", line 1230, in dataclass return wrap(cls) ^^^^^^^^^ File "C:\Users\abcd\anaconda3\Lib\dataclasses.py", line 1220, in wrap return _process_class(cls, init, repr, eq, order, unsafe_hash, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\abcd\anaconda3\Lib\dataclasses.py", line 958, in _process_class cls_fields.append(_get_field(cls, name, type, kw_only)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\abcd\anaconda3\Lib\dataclasses.py", line 815, in _get_field raise ValueError(f'mutable default {type(f.default)} for field ' ValueError: mutable default <class 'official.modeling.optimization.configs.optimizer_config.SGDConfig'> for field sgd is not allowed: use default_factory

sabbir2609 commented 10 months ago

what's your python and TF version?

csyeungad commented 10 months ago

I am using python 3.11 and tensorflow 2.13. I think the problem is with the python version.

sabbir2609 commented 10 months ago

I am using python 3.11 and tensorflow 2.13. I think the problem is with the python version.

Try python 3.10.6 and TF 2.10.0 python 3.10.6 is most stable version and TF 2.10 is suitable for windows coz after 2.10 they officially dropped support for windows.

csyeungad commented 10 months ago

Thanks for you help. I tried to create a new environment with python 3.10.6.

image

However, when I run this cell, it installs TF2.13 automatically. Do I just uninstall TF and install TF2.10 again to solve it? Not sure if this is the proper way to do it.

sabbir2609 commented 10 months ago

You can do that.