tin2tin / Pallaidium

PALLAIDIUM - a generative AI movie studio integrated in the Blender Video Editor.
GNU General Public License v3.0
998 stars 81 forks source link

Mac Contributor Support Thread #106

Open tin2tin opened 8 months ago

tin2tin commented 8 months ago

As I do not personally use Mac, I can't offer support for it, but if anyone has problems with it, report the Mac-related bugs here, and let's hope some other Mac users can help out submitting fixes for those problems.

limnetik commented 7 months ago

In a previous version of blender/os/addon i managed to make it work once on macos. But it did not last long. After i always get this error when trying to install the dependencies , it aborts : cannot instantiate 'WindowsPath' on your system

it works on windows, but can't get the dependencies to complete on macos.

tin2tin commented 7 months ago

Is the error referring to a specific line/lib?

limnetik commented 7 months ago

As i am not a programmer and don't grasp everything i gather here i paste were it stops working on both an INtel and Arm Mac for me:

Successfully built transformers Installing collected packages: safetensors, tokenizers, transformers ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. suno-bark 0.0.1a0 requires encodec, which is not installed. suno-bark 0.0.1a0 requires scipy, which is not installed. suno-bark 0.0.1a0 requires torch, which is not installed. Successfully installed safetensors-0.4.3 tokenizers-0.15.2 transformers-4.40.0.dev0 Traceback (most recent call last): File "/Users/XXXXXX/Library/Application Support/Blender/4.1/scripts/addons/Pallaidium-main/init.py", line 658, in import_module subprocess.call([python_exe, "import ", packageName]) ^^^^^^^^^^^ NameError: name 'packageName' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/XXXXXX/Library/Application Support/Blender/4.1/scripts/addons/Pallaidium-main/init.py", line 865, in execute install_modules(self) File "/Users/XXXXXX/Library/Application Support/Blender/4.1/scripts/addons/Pallaidium-main/init.py", line 691, in install_modules import_module(self, "transformers", "git+https://github.com/huggingface/transformers.git") File "/Users/XXXXXX/Library/Application Support/Blender/4.1/scripts/addons/Pallaidium-main/init.py", line 665, in import_module exec("import " + module) File "", line 1, in File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/site-packages/transformers/init.py", line 26, in from . import dependency_versions_check File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/site-packages/transformers/dependency_versions_check.py", line 16, in from .utils.versions import require_version, require_version_core File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/site-packages/transformers/utils/init.py", line 18, in from huggingface_hub import get_full_repo_name # for backward compatibility ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1229, in _handle_fromlist File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/site-packages/huggingface_hub/init.py", line 487, in getattr submod = importlib.import_module(submod_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/site-packages/huggingface_hub/hf_api.py", line 45, in import requests File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/site-packages/requests/init.py", line 147, in from . import packages, utils File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/site-packages/requests/utils.py", line 63, in DEFAULT_CA_BUNDLE_PATH = certs.where() ^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/site-packages/certifi/core.py", line 36, in where _CACERT_CTX = get_path("certifi", "cacert.pem") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/importlib/resources/_legacy.py", line 25, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/importlib/resources/_legacy.py", line 121, in path return _common.as_file(_common.files(package) / normalize_path(resource)) ^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/importlib/resources/_common.py", line 22, in files return from_package(get_package(package)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/importlib/resources/_common.py", line 65, in from_package reader = spec.loader.get_resource_reader(spec.name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/importlib/resources/_adapters.py", line 29, in get_resource_reader return CompatibilityFiles(self.spec)._native() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/importlib/resources/_adapters.py", line 155, in _native reader = self._reader ^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/importlib/resources/_adapters.py", line 149, in _reader return self.spec.loader.get_resource_reader(self.spec.name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 605, in _check_name_wrapper File "", line 1139, in get_resource_reader File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/importlib/resources/readers.py", line 17, in init self.path = pathlib.Path(loader.path).parent ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/pathlib.py", line 873, in new raise NotImplementedError("cannot instantiate %r on your system" NotImplementedError: cannot instantiate 'WindowsPath' on your system Info: Installing: huggingface_hub module. Info: Installing: transformers module. Error: Python: Traceback (most recent call last): File "/Users/XXXXXX/Library/Application Support/Blender/4.1/scripts/addons/Pallaidium-main/init.py", line 658, in import_module subprocess.call([python_exe, "import ", packageName]) ^^^^^^^^^^^ NameError: name 'packageName' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/XXXXXX/Library/Application Support/Blender/4.1/scripts/addons/Pallaidium-main/init.py", line 665, in import_module exec("import " + module) File "", line 1, in File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/site-packages/transformers/init.py", line 26, in from . import dependency_versions_check File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/site-packages/transformers/dependency_versions_check.py", line 16, in from .utils.versions import require_version, require_version_core File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/site-packages/transformers/utils/init.py", line 18, in from huggingface_hub import get_full_repo_name # for backward compatibility ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1229, in _handle_fromlist File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/site-packages/huggingface_hub/init.py", line 487, in getattr submod = importlib.import_module(submod_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/site-packages/huggingface_hub/hf_api.py", line 45, in import requests File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/site-packages/requests/init.py", line 147, in from . import packages, utils File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/site-packages/requests/utils.py", line 63, in DEFAULT_CA_BUNDLE_PATH = certs.where() ^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/site-packages/certifi/core.py", line 36, in where _CACERT_CTX = get_path("certifi", "cacert.pem") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/importlib/resources/_legacy.py", line 25, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/importlib/resources/_legacy.py", line 121, in path return _common.as_file(_common.files(package) / normalize_path(resource)) ^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/importlib/resources/_common.py", line 22, in files return from_package(get_package(package)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/importlib/resources/_common.py", line 65, in from_package reader = spec.loader.get_resource_reader(spec.name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/importlib/resources/_adapters.py", line 29, in get_resource_reader return CompatibilityFiles(self.spec)._native() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/importlib/resources/_adapters.py", line 155, in _native reader = self._reader ^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/importlib/resources/_adapters.py", line 149, in _reader return self.spec.loader.get_resource_reader(self.spec.name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 605, in _check_name_wrapper File "", line 1139, in get_resource_reader File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/importlib/resources/readers.py", line 17, in init self.path = pathlib.Path(loader.path).parent ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.1/python/lib/python3.11/pathlib.py", line 873, in new raise NotImplementedError("cannot instantiate %r on your system" NotImplementedError: cannot instantiate 'WindowsPath' on your system

tin2tin commented 7 months ago

Try to install Git as described in the installation instructions.

limnetik commented 7 months ago

I also have to point out i have both platforms at hand (windows and mac); i use windows mostly at home. BUT when at Work , i use mainly mac along with a bunch of creators that would really benefit from this working on mac

limnetik commented 7 months ago

Try to install Git as described in the installation instructions.

it is installed already, i'll try updating it, but i doubt it is the problem since on the intel MBP it's a fresh install

limnetik commented 7 months ago

NotImplementedError: cannot instantiate 'WindowsPath' on your system last line kept my attention, tried different things and researches , but it is beyond me...

limnetik commented 7 months ago

Git(must be on PATH(or Bark will fail) git 2.44.0 is already installed and up-to-date. To reinstall 2.44.0, run: brew reinstall git (base) xxx@xxx ~ % which git /opt/homebrew/bin/git SO is this OK to have this path or should i consider what is mentionned in this (https://stackoverflow.com/questions/8957862/how-to-upgrade-git-to-latest-version-on-macos) in the 61 article concerning export path commands and such?

limnetik commented 7 months ago

I managed to get past the first error NotImplementedError: cannot instantiate 'WindowsPath' on your system by removing lines in the init.py line 55 temp = pathlib.PosixPath pathlib.PosixPath = pathlib.WindowsPath and line 79 if os_platform == "Windows": pathlib.PosixPath = pathlib.WindowsPath

i still had to manually install the rest of the depedencies manually with blender pip plugin, wich was tedious but worked...

managed to make the generate button download the models for sdxl,

but then i get something concerning the accelerate module not working when i try to use it... to be continued...

tin2tin commented 4 months ago

@limnetik Recently, I did some improvements in the dependencies' installation code, maybe it is working better for you now?

enzyme69 commented 4 months ago

@tin2tin

I tested install using Blender 4.2 ... still giving error:

Traceback (most recent call last):
  File "/Users/jimmygunawan/Library/Application Support/Blender/4.2/scripts/addons/Pallaidium-Pallaidium_MacOS/__init__.py", line 578, in import_module
    subprocess.call([python_exe, "import ", packageName])
                                            ^^^^^^^^^^^
NameError: name 'packageName' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/soundfile.py", line 267, in <module>
    _snd = _ffi.dlopen('sndfile')
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/cffi/api.py", line 150, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/cffi/api.py", line 832, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/cffi/api.py", line 827, in _load_backend_lib
    raise OSError(msg)
OSError: ctypes.util.find_library() did not manage to locate a library called 'sndfile'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jimmygunawan/Library/Application Support/Blender/4.2/scripts/addons/Pallaidium-Pallaidium_MacOS/__init__.py", line 866, in execute
    install_modules(self)
  File "/Users/jimmygunawan/Library/Application Support/Blender/4.2/scripts/addons/Pallaidium-Pallaidium_MacOS/__init__.py", line 710, in install_modules
    import_module(self, "soundfile", "PySoundFile")
  File "/Users/jimmygunawan/Library/Application Support/Blender/4.2/scripts/addons/Pallaidium-Pallaidium_MacOS/__init__.py", line 607, in import_module
    exec("import " + module)
  File "<string>", line 1, in <module>
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/soundfile.py", line 276, in <module>
    _snd = _ffi.dlopen(_os.path.join(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/cffi/api.py", line 150, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/cffi/api.py", line 832, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/cffi/api.py", line 827, in _load_backend_lib
    raise OSError(msg)
OSError: cannot load library '/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib': dlopen(/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib, 0x0002): tried: '/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib' (no such file), '/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib' (no such file).  Additionally, ctypes.util.find_library() did not manage to locate a library called '/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib'
Info: Installing: huggingface_hub module.
Info: Installing: accelerate module.
Info: Installing: bark module.
Info: Installing: diffusers module.
Info: Installing: tensorflow module.
Info: Installing: soundfile module.
Error: Python: Traceback (most recent call last):
  File "/Users/jimmygunawan/Library/Application Support/Blender/4.2/scripts/addons/Pallaidium-Pallaidium_MacOS/__init__.py", line 578, in import_module
    subprocess.call([python_exe, "import ", packageName])
                                            ^^^^^^^^^^^
NameError: name 'packageName' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/soundfile.py", line 267, in <module>
    _snd = _ffi.dlopen('sndfile')
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/cffi/api.py", line 150, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/cffi/api.py", line 832, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/cffi/api.py", line 827, in _load_backend_lib
    raise OSError(msg)
OSError: ctypes.util.find_library() did not manage to locate a library called 'sndfile'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jimmygunawan/Library/Application Support/Blender/4.2/scripts/addons/Pallaidium-Pallaidium_MacOS/__init__.py", line 607, in import_module
    exec("import " + module)
  File "<string>", line 1, in <module>
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/soundfile.py", line 276, in <module>
    _snd = _ffi.dlopen(_os.path.join(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/cffi/api.py", line 150, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/cffi/api.py", line 832, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/cffi/api.py", line 827, in _load_backend_lib
    raise OSError(msg)
OSError: cannot load library '/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib': dlopen(/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib, 0x0002): tried: '/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib' (no such file), '/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib' (no such file).  Additionally, ctypes.util.find_library() did not manage to locate a library called '/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib'
tin2tin commented 4 months ago

@enzyme69 Apparently, Mac disagrees with that version of soundfile lib. I've updated Pallaidium with another one. Try that.

enzyme69 commented 4 months ago

@tin2tin

Thanks for the update, you might need to update Palladium Mac, but anyhow I use Master Repo. Dependencies installed, however still bug error:

init
Traceback (most recent call last):
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 811, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/models/autoencoders/__init__.py", line 1, in <module>
    from .autoencoder_asym_kl import AsymmetricAutoencoderKL
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/models/autoencoders/autoencoder_asym_kl.py", line 23, in <module>
    from .vae import DecoderOutput, DiagonalGaussianDistribution, Encoder, MaskConditionDecoder
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/models/autoencoders/vae.py", line 24, in <module>
    from ..attention_processor import SpatialNorm
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/models/attention_processor.py", line 22, in <module>
    from ..image_processor import IPAdapterMaskProcessor
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/image_processor.py", line 23, in <module>
    from PIL import Image, ImageFilter, ImageOps
ImportError: cannot import name 'ImageFilter' from 'PIL' (/Users/jimmygunawan/.local/lib/python3.11/site-packages/PIL/__init__.py)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 811, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/pipeline_utils.py", line 44, in <module>
    from ..models import AutoencoderKL
  File "<frozen importlib._bootstrap>", line 1229, in _handle_fromlist
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 801, in __getattr__
    module = self._get_module(self._class_to_module[name])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 813, in _get_module
    raise RuntimeError(
RuntimeError: Failed to import diffusers.models.autoencoders.autoencoder_kl because of the following error (look up to see its traceback):
cannot import name 'ImageFilter' from 'PIL' (/Users/jimmygunawan/.local/lib/python3.11/site-packages/PIL/__init__.py)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/jimmygunawan/Library/Application Support/Blender/4.2/scripts/addons/Pallaidium-main/__init__.py", line 3559, in execute
    from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
  File "<frozen importlib._bootstrap>", line 1229, in _handle_fromlist
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 802, in __getattr__
    value = getattr(module, name)
            ^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 801, in __getattr__
    module = self._get_module(self._class_to_module[name])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 813, in _get_module
    raise RuntimeError(
RuntimeError: Failed to import diffusers.pipelines.pipeline_utils because of the following error (look up to see its traceback):
Failed to import diffusers.models.autoencoders.autoencoder_kl because of the following error (look up to see its traceback):
cannot import name 'ImageFilter' from 'PIL' (/Users/jimmygunawan/.local/lib/python3.11/site-packages/PIL/__init__.py)
Error: Python: Traceback (most recent call last):
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 811, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/models/autoencoders/__init__.py", line 1, in <module>
    from .autoencoder_asym_kl import AsymmetricAutoencoderKL
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/models/autoencoders/autoencoder_asym_kl.py", line 23, in <module>
    from .vae import DecoderOutput, DiagonalGaussianDistribution, Encoder, MaskConditionDecoder
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/models/autoencoders/vae.py", line 24, in <module>
    from ..attention_processor import SpatialNorm
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/models/attention_processor.py", line 22, in <module>
    from ..image_processor import IPAdapterMaskProcessor
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/image_processor.py", line 23, in <module>
    from PIL import Image, ImageFilter, ImageOps
ImportError: cannot import name 'ImageFilter' from 'PIL' (/Users/jimmygunawan/.local/lib/python3.11/site-packages/PIL/__init__.py)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 811, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/pipeline_utils.py", line 44, in <module>
    from ..models import AutoencoderKL
  File "<frozen importlib._bootstrap>", line 1229, in _handle_fromlist
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 801, in __getattr__
    module = self._get_module(self._class_to_module[name])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 813, in _get_module
    raise RuntimeError(
RuntimeError: Failed to import diffusers.models.autoencoders.autoencoder_kl because of the following error (look up to see its traceback):
cannot import name 'ImageFilter' from 'PIL' (/Users/jimmygunawan/.local/lib/python3.11/site-packages/PIL/__init__.py)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/jimmygunawan/Library/Application Support/Blender/4.2/scripts/addons/Pallaidium-main/__init__.py", line 3559, in execute
    from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
  File "<frozen importlib._bootstrap>", line 1229, in _handle_fromlist
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 802, in __getattr__
    value = getattr(module, name)
            ^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 801, in __getattr__
    module = self._get_module(self._class_to_module[name])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 813, in _get_module
    raise RuntimeError(
RuntimeError: Failed to import diffusers.pipelines.pipeline_utils because of the following error (look up to see its traceback):
Failed to import diffusers.models.autoencoders.autoencoder_kl because of the following error (look up to see its traceback):
cannot import name 'ImageFilter' from 'PIL' (/Users/jimmygunawan/.local/lib/python3.11/site-packages/PIL/__init__.py)
tin2tin commented 4 months ago

@enzyme69 The important line is the last line: cannot import name 'ImageFilter' from 'PIL' Why it fails, I don't know. The first you could do is to google something like: "mac pil imagefilter", bc the lib could be incompatible on Mac, or needs a special way of installation (in this case it is the standard: pip install pillow). If nothing shows up, use this add-on's List button, to list all installed add-ons: https://github.com/amb/blender_pip Check if it is already installed and check the version. If it is installed, try to use the add-on to Remove it and re-Install it, and notice if the version number changes. If any of this solves the problem, or if you find the lib needs special handholding when being installed on Mac, let me know.

enzyme69 commented 4 months ago

I will try resolving via Claude...

After all, I also did use Blender Module Manager and install pillow module already.

Seems like Blender is looking at different Python environment?

Traceback (most recent call last):
  File "/Users/jimmygunawan/Library/Application Support/Blender/4.2/scripts/addons/Pallaidium-main/__init__.py", line 3559, in execute
    from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
  File "<frozen importlib._bootstrap>", line 1229, in _handle_fromlist
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 802, in __getattr__
    value = getattr(module, name)
            ^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 801, in __getattr__
    module = self._get_module(self._class_to_module[name])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 813, in _get_module
    raise RuntimeError(
RuntimeError: Failed to import diffusers.pipelines.pipeline_utils because of the following error (look up to see its traceback):
Failed to import diffusers.models.autoencoders.autoencoder_kl because of the following error (look up to see its traceback):
cannot import name 'ImageFilter' from 'PIL' (/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/PIL/__init__.py)
Error: Python: Traceback (most recent call last):
  File "/Text", line 1, in <module>
ImportError: cannot import name 'ImageFilters' from 'PIL' (/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/PIL/__init__.py)
Error: Python: Traceback (most recent call last):
  File "/Text", line 1, in <module>
ImportError: cannot import name 'ImageFilters' from 'PIL' (/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/PIL/__init__.py)
Error: Python: Traceback (most recent call last):
  File "/Text", line 1, in <module>
ImportError: cannot import name 'ImageFilter' from 'PIL' (/Applications/Blender 42 LTS /Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/PIL/__init__.py)
3.11.7 (main, Jun 26 2024, 17:15:05) [Clang 15.0.0 (clang-1500.1.0.2.5)]
3.11.7 (main, Jun 26 2024, 17:15:05) [Clang 15.0.0 (clang-1500.1.0.2.5)]
limnetik commented 3 months ago

Hello, after installing LTS 4.2.1 and deinstalling dependencies and reinstalling. 1 - jaxlib and jax uninstalled and reinstalled ok because of conflicts 2- managed to get opendalle to call the modules and download and install hub 3- but when prompt started render, got errors concerning cuda...

File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/cuda/init.py", line 305, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

If there could be a button to disable cuda and use cpu; on mac it would probably work then... i don't know about coding it to disable torch with cuda on mac... so that's it for now! Thanks!

tin2tin commented 3 months ago

@limnetik The switch should happen automatic, however torch/cuda was used to find the available vram, which doesn't work on Mac. As I don't run Mac, I asked a chatGPT for some code to get the VRAM amount on Mac. Could you check if this both solves the problem and that the value is correct?

limnetik commented 3 months ago

The error seems shorter and precise:

Error: Python: Traceback (most recent call last): File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 1077, in call ) = self.encode_prompt( ^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 397, in encode_prompt prompt_embeds = text_encoder(text_input_ids.to(device), output_hidden_states=True) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/cuda/init.py", line 305, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

so here it is: i just reinstalled the addon form a new download of the main this morning; would there be more to do ? Should i reinstall the depedencies? I felt just the plugin update would test what you added, if i understand right.

Thank you!

limnetik commented 3 months ago

ok same with a dependencies reinstall: Traceback (most recent call last): File "/Users/x/Library/Application Support/Blender/4.2/extensions/user_default/pallaidium_generative_ai/init.py", line 5727, in execute image = pipe( ^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 1077, in call ) = self.encode_prompt( ^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 397, in encode_prompt prompt_embeds = text_encoder(text_input_ids.to(device), output_hidden_states=True) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/cuda/init.py", line 305, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled Error: Python: Traceback (most recent call last): File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 1077, in call ) = self.encode_prompt( ^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 397, in encode_prompt prompt_embeds = text_encoder(text_input_ids.to(device), output_hidden_states=True) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/cuda/init.py", line 305, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

tin2tin commented 3 months ago

Okay thank you. Feeling like I'm stumbling around in the dark here, since I have no Mac to test things on, so I'll have to rely on your feedback. Here one more attempt to get rid of CUDA: https://github.com/tin2tin/Pallaidium/archive/refs/heads/Pallaidium_MacOS.zip

limnetik commented 3 months ago

I cannot activate the plugin with this variant, in opposition to the main wich works; i get this new message never seen before, (i think Macos is cpu only compatible, if i understand correctly) it seems 'mps' selected here?... :

Python: 3.11.7 (main, Jun 26 2024, 17:15:05) [Clang 15.0.0 (clang-1500.1.0.2.5)] GFX Device: mps An error occurred: cannot access local variable 'vram_gb' where it is not associated with a value Traceback (most recent call last): File "/Applications/Blender.app/Contents/Resources/4.2/scripts/modules/addon_utils.py", line 407, in enable mod = importlib.import_module(module_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1204, in _gcd_import File "", line 1176, in _find_and_load File "", line 1147, in _find_and_load_unlocked File "", line 690, in _load_unlocked File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed File "/Users/x/Library/Application Support/Blender/4.2/extensions/user_default/pallaidium_generative_ai/init.py", line 1249, in class GeneratorAddonPreferences(AddonPreferences): File "/Users/x/Library/Application Support/Blender/4.2/extensions/user_default/pallaidium_generative_ai/init.py", line 1450, in GeneratorAddonPreferences if low_vram(): ^^^^^^^^^^ File "/Users/x/Library/Application Support/Blender/4.2/extensions/user_default/pallaidium_generative_ai/init.py", line 603, in low_vram return vram_gb # Y/N under 16 GB? ^^^^^^^ UnboundLocalError: cannot access local variable 'vram_gb' where it is not associated with a value

tin2tin commented 3 months ago

Okay, this means that chatgpt do not know how to get the vram on a mac. Try this instead: https://github.com/tin2tin/Pallaidium/archive/refs/heads/main.zip

Torch apparently detects mps on your computer, and tries to use that.

limnetik commented 3 months ago

It activates but , similar message when trying rendering:

Traceback (most recent call last): File "/Users/X/Library/Application Support/Blender/4.2/extensions/user_default/pallaidium_generative_ai/init.py", line 5727, in execute image = pipe( ^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 1077, in call ) = self.encode_prompt( ^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 397, in encode_prompt prompt_embeds = text_encoder(text_input_ids.to(device), output_hidden_states=True) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/cuda/init.py", line 305, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled Error: Python: Traceback (most recent call last): File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 1077, in call ) = self.encode_prompt( ^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 397, in encode_prompt prompt_embeds = text_encoder(text_input_ids.to(device), output_hidden_states=True) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/cuda/init.py", line 305, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

tin2tin commented 3 months ago

Is there something called mps on macs? If not, I can try to force it to cpu.

limnetik commented 3 months ago

i think mps does not apply since it's arm cpu and Automatic1111 forces cpu only on mac platform; so i think the answer is to force it to be in cpu mode.

tin2tin commented 3 months ago

Okay, so now it is forcing cpu usage on mps detected hardware (I hope...): https://github.com/tin2tin/Pallaidium/archive/refs/heads/Pallaidium_MacOS.zip

limnetik commented 3 months ago

hmm loads, but still message on render: Loading pipeline components...: 100%|██████████████████████████████████████████| 7/7 [00:00<00:00, 7.21it/s] Seed: -1320711943 Generate: Image Traceback (most recent call last): File "/Users/X/Library/Application Support/Blender/4.2/extensions/user_default/pallaidium_generative_ai/init.py", line 5739, in execute image = pipe( ^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 1077, in call ) = self.encode_prompt( ^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 397, in encode_prompt prompt_embeds = text_encoder(text_input_ids.to(device), output_hidden_states=True) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/cuda/init.py", line 305, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled Error: Python: Traceback (most recent call last): File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 1077, in call ) = self.encode_prompt( ^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 397, in encode_prompt prompt_embeds = text_encoder(text_input_ids.to(device), output_hidden_states=True) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/cuda/init.py", line 305, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

tin2tin commented 3 months ago

Is it the same thing with ex. OpenDalle?

limnetik commented 3 months ago

it is with OpenDalle that i get the message and it says the same with Stable Diffusion XL 1.0

tin2tin commented 3 months ago

Let's try another approach. Open the Text Editor in Blender, copy/paste this code into it. Change cuda to mps and/or CPU. Open the Blender system console. Run the script and see if it can run without errors (the dependencies should already be installed with Pallaidium):

from diffusers import DiffusionPipeline
import torch

pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, use_safetensors=True, variant="fp16")
pipe.to("cuda")

prompt = "An astronaut riding a green horse"

images = pipe(prompt=prompt).images[0]

The code is from here: https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0

If it throws errors on torch and cuda, even though you add mps or cpu, you'll have to investigate what version of torch is useable on mac, and then you can try to install it with the pip add-on, untill you find something that works.

limnetik commented 2 months ago

seems to run fine only set with pipe.to("mps")

with cpu it give out errors and stall very long with cuda, it output the dreaded cuda message error

i don't get a resulting image but the procedure render something until the end with mps so i'm not sure what the result means for Pallaidium, but mps seems to be working with the small script.

tin2tin commented 2 months ago

@limnetik That's great now we're making progress. Let's check how it is behaving on the various memory optimizations. First, check the code if it runs as is. If it runs, then try to enable each of the optimize-lines one by one, and note which ones work and which ones fail:

import torch
from diffusers import DiffusionPipeline
from diffusers import AutoencoderKL

vae = AutoencoderKL.from_pretrained(
    "madebyollin/sdxl-vae-fp16-fix",
    torch_dtype=torch.float16,
)
pipe = DiffusionPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0",
    vae=vae,
    torch_dtype=torch.float16,
    variant="fp16",
)

pipe.to("mps")
# Remove the # and check each of these if they're working or not:
#pipe.enable_model_cpu_offload()
#pipe.enable_attention_slicing()
#pipe.enable_sequential_cpu_offload()
#pipe.vae.enable_tiling()
#pipe.enable_attention_slicing()

prompt = "An astronaut riding a green horse"

image = pipe(prompt=prompt).images[0]

image.save("image.png")
limnetik commented 2 months ago

Wow, the code runs perfectly as is! I'll test the different codes when i have a moment. image

limnetik commented 2 months ago

TEST

1- pipe.enable_model_cpu_offload() Error: Python: Traceback (most recent call last): File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 1077, in call ) = self.encode_prompt( ^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 397, in encode_prompt prompt_embeds = text_encoder(text_input_ids.to(device), output_hidden_states=True) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/cuda/init.py", line 305, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

2- pipe.enable_attention_slicing() /Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/image_processor.py:111: RuntimeWarning: invalid value encountered in cast images = (images * 255).round().astype("uint8") The result is a black image

3- pipe.enable_sequential_cpu_offload() Error: Python: Traceback (most recent call last): File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/accelerate/utils/modeling.py", line 408, in set_module_tensor_to_device new_value = old_value.to(device) ^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/cuda/init.py", line 305, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

4- pipe.vae.enable_tiling() WORKS OK!

5- (same as 2?) pipe.enable_attention_slicing() No error message this time The result is a black image

tin2tin commented 2 months ago

Thank you. A black image could mean nsfw content. Could you try with #5 again?

tin2tin commented 2 months ago

Try this version: https://github.com/tin2tin/Pallaidium/archive/refs/heads/Pallaidium_MacOS.zip (Try with the small models, bc there are no optimizations enabled)

limnetik commented 2 months ago

Thank you. A black image could mean nsfw content. Could you try with #5 again?

A black image is the result with this 👍 /Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/image_processor.py:111: RuntimeWarning: invalid value encountered in cast images = (images * 255).round().astype("uint8")

limnetik commented 2 months ago

Try this version: https://github.com/tin2tin/Pallaidium/archive/refs/heads/Pallaidium_MacOS.zip (Try with the small models, bc there are no optimizations enabled)

Any attemps with XL or OpenDalle or else result in error, no images: Traceback (most recent call last): File "/Users/XXXX/Library/Application Support/Blender/4.2/extensions/user_default/pallaidium_generative_ai/init.py", line 5652, in execute image = pipe( ^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 1077, in call ) = self.encode_prompt( ^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 397, in encode_prompt prompt_embeds = text_encoder(text_input_ids.to(device), output_hidden_states=True) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/cuda/init.py", line 305, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled Error: Python: Traceback (most recent call last): File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 1077, in call ) = self.encode_prompt( ^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 397, in encode_prompt prompt_embeds = text_encoder(text_input_ids.to(device), output_hidden_states=True) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/torch/cuda/init.py", line 305, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

tin2tin commented 2 months ago

Thanks, looks like every model needs additional hand-holding on MacOS, pretty hard to do, without having some hardware to test it on. What about the audio models?

limnetik commented 2 months ago

Thanks, looks like every model needs additional hand-holding on MacOS, pretty hard to do, without having some hardware to test it on. What about the audio models?

hmm: error sndfile module not installed and fails to install with python module manager

tin2tin commented 2 months ago

I believe this is the one attempted to be installed on Mac: https://pypi.org/project/soundfile/

What did you do before getting that error? What is missing sndfile lib?

limnetik commented 2 months ago

I believe this is the one attempted to be installed on Mac: https://pypi.org/project/soundfile/

What did you do before getting that error? What is missing sndfile lib?

This is the error i get with dependencies installed ok and i try to render audio

Traceback (most recent call last): File "/Users/xxxx/Library/Application Support/Blender/4.2/extensions/user_default/pallaidium_generative_ai/init.py", line 2940, in execute import soundfile as sf File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/soundfile.py", line 162, in _snd = _ffi.dlopen(_os.path.join( ^^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: cannot load library '/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib': dlopen(/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib, 0x0002): tried: '/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib' (no such file), '/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib' (no such file) Error: Python: Traceback (most recent call last): File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/soundfile.py", line 142, in raise OSError('sndfile library not found') OSError: sndfile library not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/xxxx/Library/Application Support/Blender/4.2/extensions/user_default/pallaidium_generative_ai/init.py", line 2940, in execute import soundfile as sf File "/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/soundfile.py", line 162, in _snd = _ffi.dlopen(_os.path.join( ^^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: cannot load library '/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib': dlopen(/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib, 0x0002): tried: '/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib' (no such file), '/Applications/Blender.app/Contents/Resources/4.2/python/lib/python3.11/site-packages/_soundfile_data/libsndfile.dylib' (no such file)

tin2tin commented 2 months ago

Searching for the last part of the stdout, things like these show up: https://github.com/bastibe/python-soundfile/issues/310 https://github.com/bastibe/python-soundfile/pull/311 https://github.com/ohmtech-rdi/eurorack-blocks/issues/444 https://github.com/bastibe/python-soundfile/issues/324 Are there any solutions in there you can use?

tin2tin commented 2 months ago

@limnetik I've replaced Soundfile(not working good on Mac) with Scripy, so maybe the audio models should work for you now?

And maybe OpenDalle could work now?

tin2tin commented 2 months ago

@limnetik Was there any improvements in how the latest version run om Mac?

limnetik commented 2 months ago

Unfortunately, last time i tried, i managed to install dependencies, but the same cuda error message appeared aborting the image generation. The only thing working was the small script experiments with mps processing the green astronaut on a horse thing. I am going to use my pc, using a mac for this is not an end in itself for me right now. If anyone else finds a way further, i will keep an eye out!

enzyme69 commented 1 month ago

Back to this thread, still kind of sad that Palladium is not used much in the macOS. It has potential.

If you actually get Mac Mini M4, try the macOS and probably it is worth to test. Minimum 64 GB.

What would work outside of Blender:

Ideally streamlining Blender for composition and layout, with prompt ability in VSE and adding and generating audio all fully open source.

But your addon relies too much by generating inside Blender. Maybe let external app for AI generation and VSE to layout storyboards and prompts.

tin2tin commented 1 month ago

@enzyme69 Since I don't have a Mac, I can't identify where it is choking. Someone with a Mac needs to run Pallaidium on it and tinker with the code until it works. It should be possible to get it working, but not without a Mac to run it on.