Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for autodetecting tensor_storage.type from the size of the stream #289

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lmagder
Copy link

@lmagder lmagder commented Jun 16, 2024

I'm honestly not sure if this is even valid as per the official format, but I have some existing .ckpt files which were written using the automatic1111 DreamBooth extension and they contain some f16 tensors without GLOBAL 'torch HalfStorage' opcodes in the pkl stream.

These load fine on the Python implementation, but fail here since PickleTensorReader skips those tensors due a mismatched size. It seems the other loader is guessing the f16 format based on the size of the tensor data file, whereas this code always assumes f32 if the pickle header doesn't contain a specifier.

With this change my checkpoints load and work fine with stable-diffuision.cpp so I figured I would make a PR incase there are other .ckpts out there that need this same fixup to load and maybe it helps somebody else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant