tensorflow / models

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

v2.12.0 did not support python 3.11 #10966

Open guizili0 opened 1 year ago

guizili0 commented 1 year ago

I run RN50 training with command: python train.py \ --model_dir=$model_dir \ --mode=train_and_eval \ --config_file=imagenet_resnet50_tpu.yaml \ --experiment=image_classification

Got below issue: 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

laxmareddyp commented 1 year ago

Hi @guizili0 ,

In order to expedite the trouble-shooting process, please provide a code snippet/colab code to reproduce the issue reported here.

Meanwhile please check this gist which is image classification with gpu config which is trained without any error, let us know if this helps you.

Thanks!

guizili0 commented 1 year ago

@laxmareddyp This issue is from python 3.11, do you know how to change the python version in colab?

laxmareddyp commented 1 year ago

Hi @guizili0 ,

Thanks for bringing this issue to our notice, we are working on it internally and let you know asap.

Thanks.

wendyliu235 commented 11 months ago

Any update for this issue?

jinmiyoon commented 11 months ago

I am waiting for this to be resolved too.

kmkolasinski commented 11 months ago

Hi, @laxmareddyp Any updates on this ? We have the same issue with python 3.11.

Additionally, do you maybe know if there are some works on bumping pyyaml to >=6.0 in the requirements.text for the TF official packages ?

This file: https://github.com/tensorflow/models/blob/master/official/requirements.txt

has constraint:

# Loader becomes a required positional argument in 6.0 in yaml.load
pyyaml>=5.1,<5.4.0

This is also problematic for python 3.11. Thanks

laxmareddyp commented 11 months ago

Hi @kmkolasinski,

Sure, Let me check with the team for bumping the version is feasible or not.

Thanks.

kmkolasinski commented 11 months ago

Hi @laxmareddyp thank you, just for your information the issue

ValueError: mutable default <class 'official.modeling.optimization.configs.optimizer_config.SGDConfig'> for field sgd is not allowed: use default_factory

seems to be handled in the newest version of tf-official-models 2.13, but this version requires tensorflow-text==2.13 which cannot be installed from pip with python 3.11 (there are no wheels for py311)

ERROR: Could not find a version that satisfies the requirement tensorflow-text==2.13 (from versions: 2.12.0rc0, 2.12.0, 2.12.1, 2.13.0rc0)
ERROR: No matching distribution found for tensorflow-text==2.13
Spoortitondihal2 commented 10 months ago

Hi, Did anyone resolve this error??

kmkolasinski commented 10 months ago

Nope, not yet, I would prefer to use the right approach before hacking. @laxmareddyp any news on this ?

@Spoortitondihal2 note that the main error disappear if you will use 2.13, but this causes issues with tensorflow-text==2.13 which does not work with py3.11. For python <3.10 you should be able to use tf-models-official==2.11.0 with TF 211

ujjwalnur commented 9 months ago

This should be resolved since Python 3.11 support seems pretty well broken.