jzbor / sdiff-gtk

GTK+ front end for AI image generation using StableDiffusion
5 stars 1 forks source link

Image generation fails with `Unable to load weights from checkpoint file for '[...]/.cache/huggingface/diffusers/models--runwayml--stable-diffusion-v1-5/snapshots/[...]/unet/diffusion_pytorch_model.bin' at '[...]/.cache/huggingface/diffusers/models--runwayml--stable-diffusion-v1-5/snapshots/[...]/unet/diffusion_pytorch_model.bin'`. #4

Closed dreirund closed 1 year ago

dreirund commented 1 year ago

I am installing the software using the [↗ Arch Linux AUR package sdiff-gtk]().

When trying to generate an image, I get an error window popping up which says

Unexpected error

Unable to load weights from checkpoint file for '/home/[...]/.cache/huggingface/diffusers/models--runwayml--stable-diffusion-v1-5/snapshots/39593d5650112b4cc580433f6b0435385882d819/unet/diffusion_pytorch_model.bin' at '/home/[...]/.cache/huggingface/diffusers/models--runwayml--stable-diffusion-v1-5/snapshots/39593d5650112b4cc580433f6b0435385882d819/unet/diffusion_pytorch_model.bin'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.

[ cancel button ]

This also does happen if I set the environment variable from_tf=true.

Screenshot:
sdiff-gtk-error

Regards!

dreirund commented 1 year ago

Still getting this error.

jzbor commented 1 year ago

Have you tried running it from the repository/via poetry? This seems to me like an issue with updated dependencies...

dreirund commented 1 year ago

Have you tried running it from the repository

Do you mean

  1. downloading the source code from https://github.com/jzbor/sdiff-gtk,
  2. compile,
  3. run the compiled binary sdiff-gtk from within the source code directory tree instead of /usr/bin/sdiff-gtk?

/via poetry?

What do you mean? What is "poetry"? How to run it "via poetry"? For me it looks that poetry is used to build the software.

This seems to me like an issue with updated dependencies…

I use the Arch Linux AUR package which you also seem to maintain. So if it is a dependency issue, then I should report to your AUR package?

jzbor commented 1 year ago

Do you mean

1. downloading the source code from https://github.com/jzbor/sdiff-gtk,

2. compile,

3. run the compiled binary `sdiff-gtk` from within the source code directory tree instead of `/usr/bin/sdiff-gtk`?

Yes

What do you mean? What is "poetry"? How to run it "via poetry"? For me it looks that poetry is used to build the software.

poetry is a piece of software that mainly manages python dependencies. It is available from the Arch repos and the usage is described in this repos README.

I use the Arch Linux AUR package which you also seem to maintain. So if it is a dependency issue, then I should report to your AUR package? Yes I think so. I have recently started switching to a different distro, so I don't spend much time on Arch anymore. Those python dependencies seem extra difficult to package and maintain, as they change quite frequently (which is why tools such as poetry exist).

That said I would gladly add you as co-maintainer if you have some spare time and are interested. You can also just try downloading the PKGBUILD and fixing it from there first.

I think the error message corresponds to one of these lines so that would probably be a good place to start.

dreirund commented 1 year ago

Have you tried running it from the repository

With a fresh git checkout tried; same problem.

via poetry?

poetry env info:


Virtualenv
Python:         3.10.9
Implementation: CPython
Path:           /home/[...]/.cache/pypoetry/virtualenvs/sdiff-gtk-YxpwPO0t-py3.10
Executable:     /home/[...]/.cache/pypoetry/virtualenvs/sdiff-gtk-YxpwPO0t-py3.10/bin/python
Valid:          True

System
Platform:   linux
OS:         posix
Python:     3.10.9
Path:       /usr
Executable: /usr/bin/python3.10

poetry install fails:

Installing dependencies from lock file

Package operations: 28 installs, 1 update, 0 removals

  • Installing certifi (2022.12.7): Failed

  DBusErrorResponse

  [org.freedesktop.DBus.Error.Spawn.ChildExited] ('Process org.freedesktop.secrets exited with status 1',)

  at /usr/lib/python3.10/site-packages/secretstorage/util.py:48 in send_and_get_reply
       44│     def send_and_get_reply(self, msg: Message) -> Any:
       45│         try:
       46│             resp_msg: Message = self._connection.send_and_get_reply(msg)
       47│             if resp_msg.header.message_type == MessageType.error:
    →  48│                 raise DBusErrorResponse(resp_msg)
       49│             return resp_msg.body
       50│         except DBusErrorResponse as resp:
       51│             if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):
       52│                 raise ItemNotFoundException('Item does not exist!') from resp

  • Installing charset-normalizer (3.0.1): Failed

  DBusErrorResponse

  [org.freedesktop.DBus.Error.Spawn.ChildExited] ('Process org.freedesktop.secrets exited with status 1',)

  at /usr/lib/python3.10/site-packages/secretstorage/util.py:48 in send_and_get_reply
       44│     def send_and_get_reply(self, msg: Message) -> Any:
       45│         try:
       46│             resp_msg: Message = self._connection.send_and_get_reply(msg)
       47│             if resp_msg.header.message_type == MessageType.error:
    →  48│                 raise DBusErrorResponse(resp_msg)
       49│             return resp_msg.body
       50│         except DBusErrorResponse as resp:
       51│             if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):
       52│                 raise ItemNotFoundException('Item does not exist!') from resp

  • Installing idna (3.4): Failed

  DBusErrorResponse

  [org.freedesktop.DBus.Error.Spawn.ChildExited] ('Process org.freedesktop.secrets exited with status 1',)

  at /usr/lib/python3.10/site-packages/secretstorage/util.py:48 in send_and_get_reply
       44│     def send_and_get_reply(self, msg: Message) -> Any:
       45│         try:
       46│             resp_msg: Message = self._connection.send_and_get_reply(msg)
       47│             if resp_msg.header.message_type == MessageType.error:
    →  48│                 raise DBusErrorResponse(resp_msg)
       49│             return resp_msg.body
       50│         except DBusErrorResponse as resp:
       51│             if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):
       52│                 raise ItemNotFoundException('Item does not exist!') from resp

  • Updating setuptools (67.3.3 -> 66.1.1): Failed

  DBusErrorResponse

  [org.freedesktop.DBus.Error.Spawn.ChildExited] ('Process org.freedesktop.secrets exited with status 1',)

  at /usr/lib/python3.10/site-packages/secretstorage/util.py:48 in send_and_get_reply
       44│     def send_and_get_reply(self, msg: Message) -> Any:
       45│         try:
       46│             resp_msg: Message = self._connection.send_and_get_reply(msg)
       47│             if resp_msg.header.message_type == MessageType.error:
    →  48│                 raise DBusErrorResponse(resp_msg)
       49│             return resp_msg.body
       50│         except DBusErrorResponse as resp:
       51│             if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):
       52│                 raise ItemNotFoundException('Item does not exist!') from resp

  • Installing urllib3 (1.26.14): Failed

  DBusErrorResponse

  [org.freedesktop.DBus.Error.Spawn.ChildExited] ('Process org.freedesktop.secrets exited with status 1',)

  at /usr/lib/python3.10/site-packages/secretstorage/util.py:48 in send_and_get_reply
       44│     def send_and_get_reply(self, msg: Message) -> Any:
       45│         try:
       46│             resp_msg: Message = self._connection.send_and_get_reply(msg)
       47│             if resp_msg.header.message_type == MessageType.error:
    →  48│                 raise DBusErrorResponse(resp_msg)
       49│             return resp_msg.body
       50│         except DBusErrorResponse as resp:
       51│             if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):
       52│                 raise ItemNotFoundException('Item does not exist!') from resp

poetry run python src/sdiff_gtk/__init__.py:


[Errno 13] Permission denied: 'src/sdiff_gtk/__init__.py'

If I do a chmod a+x src/sdiff_gtk/__init__.py, and then poetry run python src/sdiff_gtk/__init__.py, I get


[Errno 8] Exec format error: 'src/sdiff_gtk/__init__.py'

Note that I have skipped poetry install, since I am completely not sure in which directories poetry will mess around.

This seems to me like an issue with updated dependencies...

At least the Arch Linux packages should be pretty much up to date; some packages mentioned in pyproject.toml are older than what I have on my system.

jzbor commented 1 year ago

poetry install fails:

This seems to be an issue with your Arch installation poetry requires some sort of secret store (like kwalled) to store cryptographic stuff for the dependencies. Installing and setting up kwallet should solve that. I don't like that, but it is what it is.

At least the Arch Linux packages should be pretty much up to date; some packages mentioned in pyproject.toml are older than what I have on my system.

Yes I think that is the problem

dreirund commented 1 year ago

I use the Arch Linux AUR package which you also seem to maintain. So if it is a dependency issue, then I should report to your AUR package? Yes I think so. I have recently started switching to a different distro, so I don't spend much time on Arch anymore.

That said I would gladly add you as co-maintainer if you have some spare time and are interested

Actually, as I found out via researching, it seems I can't use stabel diffusion at all on my machine, since 8 GiB of main memory and a non-supported GPU (integrated Intel GPU "UHD Graphics 600" seems not to be supported, or do you think different?) is not enough RAM. Or do you think different?

At least the Arch Linux packages should be pretty much up to date; some packages mentioned in pyproject.toml are older than what I have on my system.

Yes I think that is the problem

Actually, that looks weird to me that older (outdated) versions are required. This looks like the code is not well coded with lots of brittleness?

Anyway, this calls for "putting everything into a chroot jail" or even a virtual machine where the rest of the system does not matter. Or just thrash it as a whole (= not using it) :-(.

jzbor commented 1 year ago

Actually, as I found out via researching, it seems I can't use stabel diffusion at all on my machine, since 8 GiB of main memory and a non-supported GPU (integrated Intel GPU "UHD Graphics 600" seems not to be supported, or do you think different?) is not enough RAM. Or do you think different?

Yes 8G could be pretty slim, you could use zram or swap though. PyTorch should work on your machine, but it would be very slow, as it runs without GPU acceleration.

Actually, that looks weird to me that older (outdated) versions are required.

Yes that is what I meant

This looks like the code is not well coded with lots of brittleness?

That may be true for those libraries, however who am I to judge...

Anyway, this calls for "putting everything into a chroot jail" or even a virtual machine where the rest of the system does not matter. Or just thrash it as a whole (= not using it) :-(.

This is basically what poetry does (although only with python dependencies, so it is a lot more efficient).

I will probably fix this eventually, however it is only a matter of time that another dependencie breaks on update, since this is sadly where the Python ecosystem is at right now.