geekyutao / Inpaint-Anything

Inpaint anything using Segment Anything and inpainting models.
Apache License 2.0
6.4k stars 525 forks source link

ValueError: mutable default <class 'hydra.conf.JobConf.JobConfig.OverrideDirname'> for field override_dirname is not allowed: use default_factory #154

Open sbmatch opened 4 months ago

sbmatch commented 4 months ago

执行 python app.py 报错如下内容 python版本3.12

(base) PS D:\sbmatch\Downloads\Compressed\Inpaint-Anything\app> python app.py
Traceback (most recent call last):
  File "D:\sbmatch\Downloads\Compressed\Inpaint-Anything\app\app.py", line 15, in <module>
    from lama_inpaint import inpaint_img_with_lama, build_lama_model, inpaint_img_with_builded_lama
  File "D:\sbmatch\Downloads\Compressed\Inpaint-Anything\lama_inpaint.py", line 19, in <module>
    from saicinpainting.evaluation.utils import move_to_device
  File "D:\sbmatch\Downloads\Compressed\Inpaint-Anything\lama\saicinpainting\evaluation\__init__.py", line 6, in <module>
    from saicinpainting.evaluation.losses.base_loss import SSIMScore, LPIPSScore, FIDScore
  File "D:\sbmatch\Downloads\Compressed\Inpaint-Anything\lama\saicinpainting\evaluation\losses\base_loss.py", line 15, in <module>
    from .lpips import PerceptualLoss
  File "D:\sbmatch\Downloads\Compressed\Inpaint-Anything\lama\saicinpainting\evaluation\losses\lpips.py", line 15, in <module>
    from saicinpainting.utils import get_shape
  File "D:\sbmatch\Downloads\Compressed\Inpaint-Anything\lama\saicinpainting\utils.py", line 12, in <module>
    from pytorch_lightning import seed_everything
  File "D:\Programs\miniconda3\Lib\site-packages\pytorch_lightning\__init__.py", line 28, in <module>
    from pytorch_lightning import metrics  # noqa: E402
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Programs\miniconda3\Lib\site-packages\pytorch_lightning\metrics\__init__.py", line 14, in <module>
    from pytorch_lightning.metrics.classification import (  # noqa: F401
  File "D:\Programs\miniconda3\Lib\site-packages\pytorch_lightning\metrics\classification\__init__.py", line 14, in <module>
    from pytorch_lightning.metrics.classification.accuracy import Accuracy  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Programs\miniconda3\Lib\site-packages\pytorch_lightning\metrics\classification\accuracy.py", line 18, in <module>
    from pytorch_lightning.metrics.functional.accuracy import _accuracy_compute, _accuracy_update
  File "D:\Programs\miniconda3\Lib\site-packages\pytorch_lightning\metrics\functional\__init__.py", line 14, in <module>
    from pytorch_lightning.metrics.functional.accuracy import accuracy  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Programs\miniconda3\Lib\site-packages\pytorch_lightning\metrics\functional\accuracy.py", line 18, in <module>
    from pytorch_lightning.metrics.classification.helpers import _input_format_classification, DataType
  File "D:\Programs\miniconda3\Lib\site-packages\pytorch_lightning\metrics\classification\helpers.py", line 19, in <module>
    from pytorch_lightning.metrics.utils import select_topk, to_onehot
  File "D:\Programs\miniconda3\Lib\site-packages\pytorch_lightning\metrics\utils.py", line 18, in <module>
    from pytorch_lightning.utilities import rank_zero_warn
  File "D:\Programs\miniconda3\Lib\site-packages\pytorch_lightning\utilities\__init__.py", line 18, in <module>
    from pytorch_lightning.utilities.apply_func import move_data_to_device  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Programs\miniconda3\Lib\site-packages\pytorch_lightning\utilities\apply_func.py", line 25, in <module>
    from pytorch_lightning.utilities.imports import _compare_version, _TORCHTEXT_AVAILABLE
  File "D:\Programs\miniconda3\Lib\site-packages\pytorch_lightning\utilities\imports.py", line 76, in <module>
    _HYDRA_EXPERIMENTAL_AVAILABLE = _module_available("hydra.experimental")
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Programs\miniconda3\Lib\site-packages\pytorch_lightning\utilities\imports.py", line 35, in _module_available
    return find_spec(module_path) is not None
           ^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib.util>", line 91, in find_spec
  File "D:\Programs\miniconda3\Lib\site-packages\hydra\__init__.py", line 5, in <module>
    from hydra import utils
  File "D:\Programs\miniconda3\Lib\site-packages\hydra\utils.py", line 8, in <module>
    import hydra._internal.instantiate._instantiate2
  File "D:\Programs\miniconda3\Lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 11, in <module>
    from hydra._internal.utils import _locate
  File "D:\Programs\miniconda3\Lib\site-packages\hydra\_internal\utils.py", line 17, in <module>
    from hydra.core.utils import get_valid_filename, validate_config_path
  File "D:\Programs\miniconda3\Lib\site-packages\hydra\core\utils.py", line 19, in <module>
    from hydra.core.hydra_config import HydraConfig
  File "D:\Programs\miniconda3\Lib\site-packages\hydra\core\hydra_config.py", line 6, in <module>
    from hydra.conf import HydraConf
  File "D:\Programs\miniconda3\Lib\site-packages\hydra\conf\__init__.py", line 45, in <module>
    class JobConf:
  File "D:\Programs\miniconda3\Lib\site-packages\hydra\conf\__init__.py", line 70, in JobConf
    @dataclass
     ^^^^^^^^^
  File "D:\Programs\miniconda3\Lib\dataclasses.py", line 1266, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "D:\Programs\miniconda3\Lib\dataclasses.py", line 1256, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Programs\miniconda3\Lib\dataclasses.py", line 994, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Programs\miniconda3\Lib\dataclasses.py", line 852, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'hydra.conf.JobConf.JobConfig.OverrideDirname'> for field override_dirname is not allowed: use default_factory
MineBoss506 commented 3 months ago

I have the same issue trying to use RVC :(

shojint commented 2 months ago

Try using python 3.8 instead https://github.com/geekyutao/Inpaint-Anything/issues/125

thekaranacharya commented 1 month ago

Just tested this on Python v3.10.14. It works fine! I think this is the latest python version with which Inpaint-Anything can work.

MyTimeBox commented 1 month ago

pip uninstall pytorch_lightning pip install pytorch_lightning