Skip to content
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

ValueError: mutable default <class 'timm.models.maxxvit.MaxxVitConvCfg'> for field conv_cfg is not allowed: use default_factory #62

Closed
yyyujintang opened this issue Oct 9, 2023 · 4 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@yyyujintang
Copy link

I follow the previous steps

git clone https://github.com/chengtan9907/OpenSTL
cd OpenSTL
conda env create -f environment.yml
conda activate OpenSTL
python setup.py develop
bash tools/prepare_data/download_mmnist.sh
python tools/train.py -d mmnist --lr 1e-3 -c configs/mmnist/simvp/SimVP_gSTA.py --ex_name mmnist_simvp_gsta

And the bug comes up

ValueError: mutable default <class 'timm.models.maxxvit.MaxxVitConvCfg'> for field conv_cfg is not allowed: use default_factory

I tried to fix it and I found this in StackOverflow.

It seems it's a bug caused by Python version 3.11. And I checked your environment.yml and install.md, you suggest Python 3.7+ .
But following the environment.yml, the latest Python version will be installed and the bug will arise.

I suggest you change python to python==3.x((eg, 3.9, which I check is OK) in environment.yml.

In case others meet this bug. Thank you!

@weiyanle
Copy link

Thanks a lot, I encountered the same issue too! Since there are so many dependence, it seems like I can't simply downgrade the python, but only reinstall the environment, which wastes a lot of time😢

@Lupin1998
Copy link
Collaborator

Hi, I have tried to install environments with Python>=3.11.x and the same error occurred. But Python==3.10.x can work. Maybe a better choice is to create a new conda env and reinstall the environments by python setup.py develop.

conda create -n openstl python=3.10
pip install torch==1.12.1+cu116 torchvision==0.13.1+cu116 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu116
conda activate openstl
python setup.py develop

@Lupin1998 Lupin1998 added bug Something isn't working help wanted Extra attention is needed labels Oct 13, 2023
@SPOOKEXE
Copy link

If you want to stay on the later (unsupported) versions still, here is a fix for the issue:
huggingface/pytorch-image-models#1530 (comment)

Also include 'field' in the "from dataclass import ..." statement at the top of the python file located at 'kohya_ss-22.1.0\venv\Lib\site-packages\timm\models\maxxvit.py'

@chengtan9907
Copy link
Owner

I will close this issue if there is no more question. Please feel free to open a new issue when you have new questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants