SpenserCai / sd-webui-deoldify

DeOldify for Stable Diffusion WebUI:This is an extension for StableDiffusion's AUTOMATIC1111 web-ui that allows colorize of old photos and old video. It is based on deoldify.
GNU Affero General Public License v3.0
652 stars 32 forks source link

Dependency on fastai 1.0.60 seems to cause build error on macOS #27

Open olivierlacan opened 1 year ago

olivierlacan commented 1 year ago

You might want to loosen this version dependency because AFAIK older fastai versions rely on older pytorch versions that did not support ARM/M1 chips at all, so fastai tries to install with CUDA support enabled which obviously cannot work for ARM machines.

I fixed the issue on my machine by changing for dep in ['wandb','fastai=1.0.60', to for dep in ['wandb','fastai>=1.0.60', in https://github.com/SpenserCai/sd-webui-deoldify/blob/3cd19062dc22a18f215bf4716db1258f22e3bbc4/install.py#L46-L46

While that allows deoldify to install, running it fails since it appears not to be compatible with fastai 2.x+:

***
    Traceback (most recent call last):
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/modules/safe.py", line 137, in load_with_extra
        check_pt(filename, extra_handler)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/modules/safe.py", line 95, in check_pt
        unpickler.load()
      File "/Users/olivierlacan/.pyenv/versions/3.10.12/lib/python3.10/pickle.py", line 1213, in load
        dispatch[key[0]](self)
      File "/Users/olivierlacan/.pyenv/versions/3.10.12/lib/python3.10/pickle.py", line 1529, in load_global
        klass = self.find_class(module, name)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/modules/safe.py", line 64, in find_class
        raise Exception(f"global '{module}/{name}' is forbidden")
    Exception: global 'functools/partial' is forbidden

---
*** Error completing request
*** Arguments: (0, <PIL.Image.Image image mode=RGB size=1049x1457 at 0x41BBB4E50>, None, '', '', True, 0, 4, 512, 512, True, 'None', 'None', 0, 0, 0, 0, True, 35, False) {}
    Traceback (most recent call last):
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/modules/call_queue.py", line 58, in f
        res = list(func(*args, **kwargs))
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/modules/call_queue.py", line 37, in f
        res = func(*args, **kwargs)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/modules/postprocessing.py", line 62, in run_postprocessing
        scripts.scripts_postproc.run(pp, args)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/modules/scripts_postprocessing.py", line 130, in run
        script.process(pp, **process_args)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/sd-webui-deoldify/scripts/postprocessing_deoldify.py", line 44, in process
        pp.image = self.process_image(pp.image, render_factor, artistic)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/sd-webui-deoldify/scripts/postprocessing_deoldify.py", line 36, in process_image
        vis = get_image_colorizer(root_folder=Path(paths_internal.models_path),render_factor=render_factor, artistic=artistic)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/sd-webui-deoldify/deoldify/visualize.py", line 417, in get_image_colorizer
        return get_stable_image_colorizer(root_folder=root_folder, render_factor=render_factor)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/sd-webui-deoldify/deoldify/visualize.py", line 426, in get_stable_image_colorizer
        learn = gen_inference_wide(root_folder=root_folder, weights_name=weights_name)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/sd-webui-deoldify/deoldify/generators.py", line 19, in gen_inference_wide
        learn.load(weights_name)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/sd-webui-deoldify/fastai/basic_train.py", line 267, in load
        if purge: self.purge(clear_opt=ifnone(with_opt, False))
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/sd-webui-deoldify/fastai/basic_train.py", line 325, in purge
        for a in attrs_pkl: setattr(self, a, state[a])
    TypeError: 'NoneType' object is not subscriptable
SpenserCai commented 1 year ago

This error appears to be an issue with loading the model. Did you add --disable-safe-unpickle during startup. Please also make sure that the model files in the 'stable-diffusion-webui/models/deoldify' directory are complete. If they are incomplete, you can download them from Hugging Face according to the readme. The installation of fastai is actually for including its related dependencies. You will find a modified version of fastai in the plugin directory, which is actually the one being used. In fact, this is the true version of fastai being utilized.

olivierlacan commented 1 year ago

I did just add --disable-safe-unpickle but it doesn't seem to have solved it.

stable-diffusion-webui/models/deoldify didn't exist actually so that might be the bigger issue, I'll try to reinstall or grab the models from HF.

It seems like fastai didn't have much to do with this, thanks for your help.

olivierlacan commented 1 year ago

Reinstalling leads to a similar crash with install.py relating to fastai. Full stacktrace below.

``` *** Error running install.py for extension /Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/sd-webui-deoldify. *** Command: "/Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/bin/python3.10" "/Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/sd-webui-deoldify/install.py" *** Error code: 1 *** stdout: Installing fastai==1.0.60 for DeOldify extension *** *** stderr: Traceback (most recent call last): *** File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/sd-webui-deoldify/install.py", line 48, in *** launch.run_pip(f"install {dep}", f"{dep} for DeOldify extension") *** File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/modules/launch_utils.py", line 136, in run_pip *** return run(f'"{python}" -m pip {command} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}", live=live) *** File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/modules/launch_utils.py", line 113, in run *** raise RuntimeError("\n".join(error_bits)) *** RuntimeError: Couldn't install fastai==1.0.60 for DeOldify extension. *** Command: "/Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/bin/python3.10" -m pip install fastai==1.0.60 --prefer-binary *** Error code: 1 *** stdout: Collecting fastai==1.0.60 *** Using cached fastai-1.0.60-py3-none-any.whl (237 kB) *** Collecting bottleneck (from fastai==1.0.60) *** Using cached Bottleneck-1.3.7-cp310-cp310-macosx_13_0_arm64.whl *** Requirement already satisfied: fastprogress>=0.2.1 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from fastai==1.0.60) (1.0.3) *** Requirement already satisfied: beautifulsoup4 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from fastai==1.0.60) (4.12.2) *** Requirement already satisfied: matplotlib in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from fastai==1.0.60) (3.7.2) *** Collecting numexpr (from fastai==1.0.60) *** Obtaining dependency information for numexpr from https://files.pythonhosted.org/packages/56/ed/ee046f0cd9d9a01002f4c2efa5f78dcb9e4e7a078d88ea182a79e8ef1ce3/numexpr-2.8.5-cp310-cp310-macosx_11_0_arm64.whl.metadata *** Using cached numexpr-2.8.5-cp310-cp310-macosx_11_0_arm64.whl.metadata (8.0 kB) *** Requirement already satisfied: numpy>=1.15 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from fastai==1.0.60) (1.23.5) *** Collecting nvidia-ml-py3 (from fastai==1.0.60) *** Using cached nvidia_ml_py3-7.352.0-py3-none-any.whl *** Requirement already satisfied: pandas in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from fastai==1.0.60) (2.0.3) *** Requirement already satisfied: packaging in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from fastai==1.0.60) (23.1) *** Requirement already satisfied: Pillow in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from fastai==1.0.60) (9.5.0) *** Requirement already satisfied: pyyaml in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from fastai==1.0.60) (6.0.1) *** Requirement already satisfied: requests in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from fastai==1.0.60) (2.31.0) *** Requirement already satisfied: scipy in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from fastai==1.0.60) (1.11.2) *** Requirement already satisfied: torch>=1.0.0 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from fastai==1.0.60) (2.0.1) *** Requirement already satisfied: spacy>=2.0.18 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from fastai==1.0.60) (3.6.1) *** Requirement already satisfied: torchvision in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from fastai==1.0.60) (0.15.2) *** Collecting pynvx>=1.0.0 (from fastai==1.0.60) *** Using cached pynvx-1.0.0.tar.gz (150 kB) *** Preparing metadata (setup.py): started *** Preparing metadata (setup.py): finished with status 'done' *** Requirement already satisfied: spacy-legacy<3.1.0,>=3.0.11 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from spacy>=2.0.18->fastai==1.0.60) (3.0.12) *** Requirement already satisfied: spacy-loggers<2.0.0,>=1.0.0 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from spacy>=2.0.18->fastai==1.0.60) (1.0.4) *** Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from spacy>=2.0.18->fastai==1.0.60) (1.0.9) *** Requirement already satisfied: cymem<2.1.0,>=2.0.2 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from spacy>=2.0.18->fastai==1.0.60) (2.0.7) *** Requirement already satisfied: preshed<3.1.0,>=3.0.2 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from spacy>=2.0.18->fastai==1.0.60) (3.0.8) *** Requirement already satisfied: thinc<8.2.0,>=8.1.8 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from spacy>=2.0.18->fastai==1.0.60) (8.1.12) *** Requirement already satisfied: wasabi<1.2.0,>=0.9.1 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from spacy>=2.0.18->fastai==1.0.60) (1.1.2) *** Requirement already satisfied: srsly<3.0.0,>=2.4.3 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from spacy>=2.0.18->fastai==1.0.60) (2.4.7) *** Requirement already satisfied: catalogue<2.1.0,>=2.0.6 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from spacy>=2.0.18->fastai==1.0.60) (2.0.9) *** Requirement already satisfied: typer<0.10.0,>=0.3.0 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from spacy>=2.0.18->fastai==1.0.60) (0.9.0) *** Requirement already satisfied: pathy>=0.10.0 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from spacy>=2.0.18->fastai==1.0.60) (0.10.2) *** Requirement already satisfied: smart-open<7.0.0,>=5.2.1 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from spacy>=2.0.18->fastai==1.0.60) (6.3.0) *** Requirement already satisfied: tqdm<5.0.0,>=4.38.0 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from spacy>=2.0.18->fastai==1.0.60) (4.66.1) *** Requirement already satisfied: pydantic!=1.8,!=1.8.1,<3.0.0,>=1.7.4 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from spacy>=2.0.18->fastai==1.0.60) (1.10.12) *** Requirement already satisfied: jinja2 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from spacy>=2.0.18->fastai==1.0.60) (3.1.2) *** Requirement already satisfied: setuptools in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from spacy>=2.0.18->fastai==1.0.60) (68.0.0) *** Requirement already satisfied: langcodes<4.0.0,>=3.2.0 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from spacy>=2.0.18->fastai==1.0.60) (3.3.0) *** Requirement already satisfied: charset-normalizer<4,>=2 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from requests->fastai==1.0.60) (3.2.0) *** Requirement already satisfied: idna<4,>=2.5 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from requests->fastai==1.0.60) (3.4) *** Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from requests->fastai==1.0.60) (1.26.16) *** Requirement already satisfied: certifi>=2017.4.17 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from requests->fastai==1.0.60) (2023.7.22) *** Requirement already satisfied: filelock in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from torch>=1.0.0->fastai==1.0.60) (3.12.2) *** Requirement already satisfied: typing-extensions in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from torch>=1.0.0->fastai==1.0.60) (4.7.1) *** Requirement already satisfied: sympy in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from torch>=1.0.0->fastai==1.0.60) (1.12) *** Requirement already satisfied: networkx in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from torch>=1.0.0->fastai==1.0.60) (3.1) *** Requirement already satisfied: soupsieve>1.2 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from beautifulsoup4->fastai==1.0.60) (2.4.1) *** Requirement already satisfied: contourpy>=1.0.1 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from matplotlib->fastai==1.0.60) (1.1.0) *** Requirement already satisfied: cycler>=0.10 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from matplotlib->fastai==1.0.60) (0.11.0) *** Requirement already satisfied: fonttools>=4.22.0 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from matplotlib->fastai==1.0.60) (4.42.0) *** Requirement already satisfied: kiwisolver>=1.0.1 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from matplotlib->fastai==1.0.60) (1.4.4) *** Requirement already satisfied: pyparsing<3.1,>=2.3.1 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from matplotlib->fastai==1.0.60) (3.0.9) *** Requirement already satisfied: python-dateutil>=2.7 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from matplotlib->fastai==1.0.60) (2.8.2) *** Requirement already satisfied: pytz>=2020.1 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from pandas->fastai==1.0.60) (2023.3) *** Requirement already satisfied: tzdata>=2022.1 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from pandas->fastai==1.0.60) (2023.3) *** Requirement already satisfied: six>=1.5 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib->fastai==1.0.60) (1.16.0) *** Requirement already satisfied: blis<0.8.0,>=0.7.8 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from thinc<8.2.0,>=8.1.8->spacy>=2.0.18->fastai==1.0.60) (0.7.10) *** Requirement already satisfied: confection<1.0.0,>=0.0.1 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from thinc<8.2.0,>=8.1.8->spacy>=2.0.18->fastai==1.0.60) (0.1.1) *** Requirement already satisfied: click<9.0.0,>=7.1.1 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from typer<0.10.0,>=0.3.0->spacy>=2.0.18->fastai==1.0.60) (8.1.7) *** Requirement already satisfied: MarkupSafe>=2.0 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from jinja2->spacy>=2.0.18->fastai==1.0.60) (2.1.3) *** Requirement already satisfied: mpmath>=0.19 in /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages (from sympy->torch>=1.0.0->fastai==1.0.60) (1.3.0) *** Using cached numexpr-2.8.5-cp310-cp310-macosx_11_0_arm64.whl (90 kB) *** Building wheels for collected packages: pynvx *** Building wheel for pynvx (setup.py): started *** Building wheel for pynvx (setup.py): finished with status 'error' *** Running setup.py clean for pynvx *** Failed to build pynvx *** *** stderr: error: subprocess-exited-with-error *** *** × python setup.py bdist_wheel did not run successfully. *** │ exit code: 1 *** ╰─> [121 lines of output] *** running bdist_wheel *** running build *** running build_py *** creating build *** creating build/lib.macosx-13.5-arm64-cpython-310 *** creating build/lib.macosx-13.5-arm64-cpython-310/pynvx *** copying pynvx/pynvml.py -> build/lib.macosx-13.5-arm64-cpython-310/pynvx *** copying pynvx/__init__.py -> build/lib.macosx-13.5-arm64-cpython-310/pynvx *** warning: build_py: byte-compiling is disabled, skipping. *** *** running build_ext *** CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): *** Compatibility with CMake < 3.5 will be removed from a future version of *** CMake. *** *** Update the VERSION argument value or use a ... suffix to tell *** CMake that the project does not need compatibility with older versions. *** *** *** -- The C compiler identification is AppleClang 14.0.3.14030022 *** -- The CXX compiler identification is AppleClang 14.0.3.14030022 *** -- Detecting C compiler ABI info *** -- Detecting C compiler ABI info - done *** -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped *** -- Detecting C compile features *** -- Detecting C compile features - done *** -- Detecting CXX compiler ABI info *** -- Detecting CXX compiler ABI info - done *** -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped *** -- Detecting CXX compile features *** -- Detecting CXX compile features - done *** CMake Deprecation Warning at pybind11/CMakeLists.txt:8 (cmake_minimum_required): *** Compatibility with CMake < 3.5 will be removed from a future version of *** CMake. *** *** Update the VERSION argument value or use a ... suffix to tell *** CMake that the project does not need compatibility with older versions. *** *** *** CMake Deprecation Warning at pybind11/tools/pybind11Tools.cmake:8 (cmake_minimum_required): *** Compatibility with CMake < 3.5 will be removed from a future version of *** CMake. *** *** Update the VERSION argument value or use a ... suffix to tell *** CMake that the project does not need compatibility with older versions. *** Call Stack (most recent call first): *** pybind11/CMakeLists.txt:33 (include) *** *** *** CMake Warning (dev) at pybind11/tools/FindPythonLibsNew.cmake:60 (find_package): *** Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules *** are removed. Run "cmake --help-policy CMP0148" for policy details. Use *** the cmake_policy command to set the policy and suppress this warning. *** *** Call Stack (most recent call first): *** pybind11/tools/pybind11Tools.cmake:16 (find_package) *** pybind11/CMakeLists.txt:33 (include) *** This warning is for project developers. Use -Wno-dev to suppress it. *** *** -- Found PythonInterp: /Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/bin/python3.10 (found version "3.10.12") *** -- Found PythonLibs: /Users/olivierlacan/.pyenv/versions/3.10.12/lib/libpython3.10.dylib *** -- Performing Test HAS_CPP14_FLAG *** -- Performing Test HAS_CPP14_FLAG - Success *** -- pybind11 v2.3.dev0 *** -- Performing Test HAS_FLTO *** -- Performing Test HAS_FLTO - Success *** -- LTO enabled *** CMake Warning (dev) at CMakeLists.txt:8 (find_package): *** Policy CMP0146 is not set: The FindCUDA module is removed. Run "cmake *** --help-policy CMP0146" for policy details. Use the cmake_policy command to *** set the policy and suppress this warning. *** *** This warning is for project developers. Use -Wno-dev to suppress it. *** *** CMake Error at /Users/olivierlacan/.pyenv/versions/3.11.4/lib/python3.11/site-packages/cmake/data/share/cmake-3.27/Modules/FindCUDA.cmake:883 (message): *** Specify CUDA_TOOLKIT_ROOT_DIR *** Call Stack (most recent call first): *** CMakeLists.txt:8 (find_package) *** *** *** -- Configuring incomplete, errors occurred! *** Traceback (most recent call last): *** File "", line 2, in *** File "", line 34, in *** File "/private/var/folders/zt/n3xr6js17k5c_d4m60ts_dcr0000gn/T/pip-install-uomqsodo/pynvx_d3a452b0fd8243829209561654191469/setup.py", line 68, in *** setup( *** File "/Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages/setuptools/__init__.py", line 107, in setup *** return distutils.core.setup(**attrs) *** File "/Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup *** return run_commands(dist) *** File "/Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands *** dist.run_commands() *** File "/Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands *** self.run_command(cmd) *** File "/Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command *** super().run_command(command) *** File "/Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command *** cmd_obj.run() *** File "/Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 349, in run *** self.run_command("build") *** File "/Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command *** self.distribution.run_command(command) *** File "/Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command *** super().run_command(command) *** File "/Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command *** cmd_obj.run() *** File "/Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 131, in run *** self.run_command(cmd_name) *** File "/Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command *** self.distribution.run_command(command) *** File "/Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command *** super().run_command(command) *** File "/Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command *** cmd_obj.run() *** File "/private/var/folders/zt/n3xr6js17k5c_d4m60ts_dcr0000gn/T/pip-install-uomqsodo/pynvx_d3a452b0fd8243829209561654191469/setup.py", line 32, in run *** self.build_extension(ext) *** File "/private/var/folders/zt/n3xr6js17k5c_d4m60ts_dcr0000gn/T/pip-install-uomqsodo/pynvx_d3a452b0fd8243829209561654191469/setup.py", line 56, in build_extension *** subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env) *** File "/Users/olivierlacan/.pyenv/versions/3.10.12/lib/python3.10/subprocess.py", line 369, in check_call *** raise CalledProcessError(retcode, cmd) *** subprocess.CalledProcessError: Command '['cmake', '/private/var/folders/zt/n3xr6js17k5c_d4m60ts_dcr0000gn/T/pip-install-uomqsodo/pynvx_d3a452b0fd8243829209561654191469', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/zt/n3xr6js17k5c_d4m60ts_dcr0000gn/T/pip-install-uomqsodo/pynvx_d3a452b0fd8243829209561654191469/build/lib.macosx-13.5-arm64-cpython-310', '-DPYTHON_EXECUTABLE=/Users/olivierlacan/.local/share/virtualenvs/stable-diffusion-webui-FCXHsyX7/bin/python3.10', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1. *** [end of output] *** *** note: This error originates from a subprocess, and is likely not a problem with pip. *** ERROR: Failed building wheel for pynvx *** ERROR: Could not build wheels for pynvx, which is required to install pyproject.toml-based projects *** Checking roop requirements Install insightface==0.7.3 Installing sd-webui-roop requirement: insightface==0.7.3 Install onnx==1.14.0 Installing sd-webui-roop requirement: onnx==1.14.0 Install onnxruntime==1.15.0 Installing sd-webui-roop requirement: onnxruntime==1.15.0 Install opencv-python==4.7.0.72 Installing sd-webui-roop requirement: opencv-python==4.7.0.72 Launching Web UI with arguments: --skip-torch-cuda-test --upcast-sampling --opt-sub-quad-attention --use-cpu interrogate --disable-safe-unpickle no module 'xformers'. Processing without... no module 'xformers'. Processing without... No module 'xformers'. Proceeding without it. Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled Civitai Helper: Get Custom Model Folder Civitai Helper: Load setting from: /Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/Stable-Diffusion-Webui-Civitai-Helper/setting.json Civitai Helper: No setting file, use default [-] ADetailer initialized. version: 23.7.11, num models: 17 2023-08-19 22:30:20,151 - ControlNet - INFO - ControlNet v1.1.234 ControlNet preprocessor location: /Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/sd-webui-controlnet/annotator/downloads 2023-08-19 22:30:20,212 - ControlNet - INFO - ControlNet v1.1.234 2023-08-19 22:30:20,795 - roop - INFO - roop v0.0.2 2023-08-19 22:30:20,796 - roop - INFO - roop v0.0.2 Loading weights [15012c538f] from /Users/olivierlacan/Development/oss/stable-diffusion-webui/models/Stable-diffusion/realisticVisionV51_v51VAE.safetensors Creating model from config: /Users/olivierlacan/Development/oss/stable-diffusion-webui/configs/v1-inference.yaml LatentDiffusion: Running in eps-prediction mode DiffusionWrapper has 859.52 M params. Running on local URL: http://127.0.0.1:7860 ```

As you can see --disable-safe-unpickle does get passed but only after install.py seems to run, so I'm not sure how it could help?

SpenserCai commented 1 year ago

It seems to be an issue with installing pynvx. You can try installing it separately by using the command: pip3 install pynvx --verbose.

Quickslider commented 1 year ago

You might want to loosen this version dependency because AFAIK older fastai versions rely on older pytorch versions that did not support ARM/M1 chips at all, so fastai tries to install with CUDA support enabled which obviously cannot work for ARM machines.

I fixed the issue on my machine by changing for dep in ['wandb','fastai=1.0.60', to for dep in ['wandb','fastai>=1.0.60', in

https://github.com/SpenserCai/sd-webui-deoldify/blob/3cd19062dc22a18f215bf4716db1258f22e3bbc4/install.py#L46-L46

While that allows deoldify to install, running it fails since it appears not to be compatible with fastai 2.x+:

***
    Traceback (most recent call last):
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/modules/safe.py", line 137, in load_with_extra
        check_pt(filename, extra_handler)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/modules/safe.py", line 95, in check_pt
        unpickler.load()
      File "/Users/olivierlacan/.pyenv/versions/3.10.12/lib/python3.10/pickle.py", line 1213, in load
        dispatch[key[0]](self)
      File "/Users/olivierlacan/.pyenv/versions/3.10.12/lib/python3.10/pickle.py", line 1529, in load_global
        klass = self.find_class(module, name)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/modules/safe.py", line 64, in find_class
        raise Exception(f"global '{module}/{name}' is forbidden")
    Exception: global 'functools/partial' is forbidden

---
*** Error completing request
*** Arguments: (0, <PIL.Image.Image image mode=RGB size=1049x1457 at 0x41BBB4E50>, None, '', '', True, 0, 4, 512, 512, True, 'None', 'None', 0, 0, 0, 0, True, 35, False) {}
    Traceback (most recent call last):
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/modules/call_queue.py", line 58, in f
        res = list(func(*args, **kwargs))
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/modules/call_queue.py", line 37, in f
        res = func(*args, **kwargs)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/modules/postprocessing.py", line 62, in run_postprocessing
        scripts.scripts_postproc.run(pp, args)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/modules/scripts_postprocessing.py", line 130, in run
        script.process(pp, **process_args)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/sd-webui-deoldify/scripts/postprocessing_deoldify.py", line 44, in process
        pp.image = self.process_image(pp.image, render_factor, artistic)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/sd-webui-deoldify/scripts/postprocessing_deoldify.py", line 36, in process_image
        vis = get_image_colorizer(root_folder=Path(paths_internal.models_path),render_factor=render_factor, artistic=artistic)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/sd-webui-deoldify/deoldify/visualize.py", line 417, in get_image_colorizer
        return get_stable_image_colorizer(root_folder=root_folder, render_factor=render_factor)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/sd-webui-deoldify/deoldify/visualize.py", line 426, in get_stable_image_colorizer
        learn = gen_inference_wide(root_folder=root_folder, weights_name=weights_name)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/sd-webui-deoldify/deoldify/generators.py", line 19, in gen_inference_wide
        learn.load(weights_name)
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/sd-webui-deoldify/fastai/basic_train.py", line 267, in load
        if purge: self.purge(clear_opt=ifnone(with_opt, False))
      File "/Users/olivierlacan/Development/oss/stable-diffusion-webui/extensions/sd-webui-deoldify/fastai/basic_train.py", line 325, in purge
        for a in attrs_pkl: setattr(self, a, state[a])
    TypeError: 'NoneType' object is not subscriptable

Thank you very much @olivierlacan

nikhilramakrishnan commented 1 year ago

hello @olivierlacan your change worked for me as well. i was not able to build pynvx before, now i see deoldify. thanks a lot.