mberkay0 / pretrained-backbones-unet

A PyTorch-based Python library with UNet architecture and multiple backbones for Image Semantic Segmentation.
MIT License
54 stars 12 forks source link

Error on import #9

Open a-Rahmati opened 3 months ago

a-Rahmati commented 3 months ago

Hello

When I import from backbones_unet.model.unet import Unet a value error raise:

>>> from backbones_unet.model.unet import Unet
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.12/site-packages/backbones_unet/model/unet.py", line 3, in <module>
    from timm import create_model
  File "/usr/local/lib/python3.12/site-packages/timm/__init__.py", line 2, in <module>
    from .models import create_model, list_models, is_model, list_modules, model_entrypoint, \
  File "/usr/local/lib/python3.12/site-packages/timm/models/__init__.py", line 28, in <module>
    from .maxxvit import *
  File "/usr/local/lib/python3.12/site-packages/timm/models/maxxvit.py", line 225, in <module>
    @dataclass
     ^^^^^^^^^
  File "/usr/lib64/python3.12/dataclasses.py", line 1275, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "/usr/lib64/python3.12/dataclasses.py", line 1265, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/dataclasses.py", line 994, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/dataclasses.py", line 852, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'timm.models.maxxvit.MaxxVitConvCfg'> for field conv_cfg is not allowed: use default_factory

My python version is 3.12.4: Python 3.12.4 (main, Jun 7 2024, 00:00:00) [GCC 14.1.1 20240607 (Red Hat 14.1.1-5)] on linux

CBDevelopment commented 2 months ago

I am experiencing the same error: ValueError: mutable default <class 'timm.models.maxxvit.MaxxVitConvCfg'> for field conv_cfg is not allowed: use default_factory

Edit: Downgrading to Python 3.9.6 allowed install