Inpaint-Anything
Inpaint-Anything copied to clipboard
Error: mutable default for field override_dirname is not allowed
I am getting an error when I try to run the first example:
python remove_anything.py --input_img ./example/remove-anything/dog.jpg --point_coords 200 450 --point_labels 1 --dilate_kernel_size 15 --output_dir ./results --sam_model_type "vit_h" --sam_ckpt ./pretrained_models/sam_vit_h_4b8939.pth --lama_config ./lama/configs/prediction/default.yaml --lama_ckpt ./pretrained_models/big-lama
I am running on Windows 10 - 64 with Python 3.11
I had to update the lama requirements to use the current version of scikit-image ( 0.20.0 ) as the version called for ( 0.17.2 ) would not compile whereas the current version compiles just fine.
Here is the full error output:
Traceback (most recent call last):
File "F:\ai\Inpaint-Anything\remove_anything.py", line 9, in <module>
from lama_inpaint import inpaint_img_with_lama
File "F:\ai\Inpaint-Anything\lama_inpaint.py", line 19, in <module>
from saicinpainting.evaluation.utils import move_to_device
File "F:\ai\Inpaint-Anything\lama\saicinpainting\evaluation\__init__.py", line 6, in <module>
from saicinpainting.evaluation.losses.base_loss import SSIMScore, LPIPSScore, FIDScore
File "F:\ai\Inpaint-Anything\lama\saicinpainting\evaluation\losses\base_loss.py", line 15, in <module>
from .lpips import PerceptualLoss
File "F:\ai\Inpaint-Anything\lama\saicinpainting\evaluation\losses\lpips.py", line 15, in <module>
from saicinpainting.utils import get_shape
File "F:\ai\Inpaint-Anything\lama\saicinpainting\utils.py", line 12, in <module>
from pytorch_lightning import seed_everything
File "C:\Python311\Lib\site-packages\pytorch_lightning\__init__.py", line 28, in <module>
from pytorch_lightning import metrics # noqa: E402
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\pytorch_lightning\metrics\__init__.py", line 14, in <module>
from pytorch_lightning.metrics.classification import ( # noqa: F401
File "C:\Python311\Lib\site-packages\pytorch_lightning\metrics\classification\__init__.py", line 14, in <module>
from pytorch_lightning.metrics.classification.accuracy import Accuracy # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\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 "C:\Python311\Lib\site-packages\pytorch_lightning\metrics\functional\__init__.py", line 14, in <module>
from pytorch_lightning.metrics.functional.accuracy import accuracy # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\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 "C:\Python311\Lib\site-packages\pytorch_lightning\metrics\classification\helpers.py", line 19, in <module>
from pytorch_lightning.metrics.utils import select_topk, to_onehot
File "C:\Python311\Lib\site-packages\pytorch_lightning\metrics\utils.py", line 18, in <module>
from pytorch_lightning.utilities import rank_zero_warn
File "C:\Python311\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 "C:\Python311\Lib\site-packages\pytorch_lightning\utilities\apply_func.py", line 25, in <module>
from pytorch_lightning.utilities.imports import _compare_version, _TORCHTEXT_AVAILABLE
File "C:\Python311\Lib\site-packages\pytorch_lightning\utilities\imports.py", line 76, in <module>
_HYDRA_EXPERIMENTAL_AVAILABLE = _module_available("hydra.experimental")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\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 94, in find_spec
File "C:\Python311\Lib\site-packages\hydra\__init__.py", line 5, in <module>
from hydra import utils
File "C:\Python311\Lib\site-packages\hydra\utils.py", line 8, in <module>
import hydra._internal.instantiate._instantiate2
File "C:\Python311\Lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 11, in <module>
from hydra._internal.utils import _locate
File "C:\Python311\Lib\site-packages\hydra\_internal\utils.py", line 17, in <module>
from hydra.core.utils import get_valid_filename, validate_config_path
File "C:\Python311\Lib\site-packages\hydra\core\utils.py", line 19, in <module>
from hydra.core.hydra_config import HydraConfig
File "C:\Python311\Lib\site-packages\hydra\core\hydra_config.py", line 6, in <module>
from hydra.conf import HydraConf
File "C:\Python311\Lib\site-packages\hydra\conf\__init__.py", line 45, in <module>
class JobConf:
File "C:\Python311\Lib\site-packages\hydra\conf\__init__.py", line 70, in JobConf
@dataclass
^^^^^^^^^
File "C:\Python311\Lib\dataclasses.py", line 1223, in dataclass
return wrap(cls)
^^^^^^^^^
File "C:\Python311\Lib\dataclasses.py", line 1213, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\dataclasses.py", line 958, in _process_class
cls_fields.append(_get_field(cls, name, type, kw_only))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\dataclasses.py", line 815, 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
Hi, I have successfully run remove_anything.py on win11. Here is my environment setup:
- Download and install the Miniconda3 Windows 64-bit.
- Run
Anaconda Powershell Prompt (miniconda3)
as administrator. - Install the corresponding pakeages. As you said, I update the lama requirements to use the current version of scikit-image and scikit-learn. Here is the updated requirements:
pyyaml
tqdm
numpy
easydict==1.9.0
scikit-image
scikit-learn
opencv-python
tensorflow
joblib
matplotlib
pandas
albumentations==0.5.2
hydra-core==1.1.0
pytorch-lightning==1.2.9
tabulate
kornia==0.5.0
webdataset
packaging
wldhx.yadisk-direct
- Run the command:
python remove_anything.py --input_img ./example/remove-anything/dog.jpg --point_coords 200 450 --point_labels 1 --dilate_kernel_size 15 --output_dir ./results --sam_model_type "vit_h" --sam_ckpt ./pretrained_models/sam_vit_h_4b8939.pth --lama_config ./lama/configs/prediction/default.yaml --lama_ckpt ./pretrained_models/big-lama
Hope this helps :)
Hi, I have successfully run remove_anything.py on win11. Here is my environment setup:
- Download and install the Miniconda3 Windows 64-bit.
- Run
Anaconda Powershell Prompt (miniconda3)
as administrator.- Install the corresponding pakeages. As you said, I update the lama requirements to use the current version of scikit-image and scikit-learn. Here is the updated requirements:
pyyaml tqdm numpy easydict==1.9.0 scikit-image scikit-learn opencv-python tensorflow joblib matplotlib pandas albumentations==0.5.2 hydra-core==1.1.0 pytorch-lightning==1.2.9 tabulate kornia==0.5.0 webdataset packaging wldhx.yadisk-direct
- Run the command:
python remove_anything.py --input_img ./example/remove-anything/dog.jpg --point_coords 200 450 --point_labels 1 --dilate_kernel_size 15 --output_dir ./results --sam_model_type "vit_h" --sam_ckpt ./pretrained_models/sam_vit_h_4b8939.pth --lama_config ./lama/configs/prediction/default.yaml --lama_ckpt ./pretrained_models/big-lama
Hope this helps :)
Python version 3.10.9
I close this issue as completed.
Hi, I have successfully run remove_anything.py on win11. Here is my environment setup:
- Download and install the Miniconda3 Windows 64-bit.
- Run
Anaconda Powershell Prompt (miniconda3)
as administrator.- Install the corresponding pakeages. As you said, I update the lama requirements to use the current version of scikit-image and scikit-learn. Here is the updated requirements:
pyyaml tqdm numpy easydict==1.9.0 scikit-image scikit-learn opencv-python tensorflow joblib matplotlib pandas albumentations==0.5.2 hydra-core==1.1.0 pytorch-lightning==1.2.9 tabulate kornia==0.5.0 webdataset packaging wldhx.yadisk-direct
- Run the command:
python remove_anything.py --input_img ./example/remove-anything/dog.jpg --point_coords 200 450 --point_labels 1 --dilate_kernel_size 15 --output_dir ./results --sam_model_type "vit_h" --sam_ckpt ./pretrained_models/sam_vit_h_4b8939.pth --lama_config ./lama/configs/prediction/default.yaml --lama_ckpt ./pretrained_models/big-lama
Hope this helps :)
Python version 3.10.9
thank you, it works