Skip to content

Loading PT Files for VAE with the AutoEncoder is still broken!!!Β #9154

@JemiloII

Description

@JemiloII

Describe the bug

Just doesn't load pt files anymore. Really frustrating as it's been broken for a long time now. I keep posting about it, so now I'll just open a issue / bug instead of messaging in update threads. Last working version is 0.27.2

There is not a working safetensors or diffusers version of the VAE I'm using and I shouldn't have to. PT works just fine.

Reproduction

    pipe = StableDiffusionPipeline.from_single_file(
        "./assets/models/AOM3B4_orangemixs.safetensors",
        safety_checker=None,
        requires_safety_checker=False,
        cache_dir=path.join("./assets/models"),
        local_files_only=True,
        torch_dtype=torch.bfloat16,
    )

    pipe = pipe.to(device, torch.bfloat16)

    pipe.vae = AutoencoderKL.from_single_file(
        path.join("./assets/vae/orangemix.vae.pt"),
        local_files_only=True,
        torch_dtype=torch.bfloat16
    )

Logs

Traceback (most recent call last):
  File "C:\Users\Shibiko AI\Desktop\shibiko ai\diffusion-ai\.venv\lib\site-packages\diffusers\models\model_loading_utils.py", line 108, in load_state_dict
    return torch.load(
  File "C:\Users\Shibiko AI\Desktop\shibiko ai\diffusion-ai\.venv\lib\site-packages\torch\serialization.py", line 1024, in load
    raise pickle.UnpicklingError(UNSAFE_MESSAGE + str(e)) from None
_pickle.UnpicklingError: Weights only load failed. Re-running `torch.load` with `weights_only` set to `False` will likely succeed, but it can result in arbitrary code execution.Do it only if you get the file from a trusted source. WeightsUnpickler error: Unsupported class pytorch_lightning.callbacks.model_checkpoint.ModelCheckpoint

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Shibiko AI\Desktop\shibiko ai\diffusion-ai\.venv\lib\site-packages\diffusers\models\model_loading_utils.py", line 116, in load_state_dict
    if f.read().startswith("version"):
  File "C:\Program Files\Python310\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 1681: character maps to <undefined>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Shibiko AI\Desktop\shibiko ai\diffusion-test\main.py", line 89, in <module>
    asyncio.run(main(args.device, args.port))
  File "C:\Program Files\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "C:\Users\Shibiko AI\Desktop\shibiko ai\diffusion-test\main.py", line 79, in main
    pipe, clip_layers = shibiko_init(settings, device)
  File "C:\Users\Shibiko AI\Desktop\shibiko ai\diffusion-test\src\generation.py", line 126, in shibiko_init
    pipe.vae = AutoencoderKL.from_single_file(
  File "C:\Users\Shibiko AI\Desktop\shibiko ai\diffusion-ai\.venv\lib\site-packages\huggingface_hub\utils\_validators.py", line 114, in _inner_fn
    return fn(*args, **kwargs)
  File "C:\Users\Shibiko AI\Desktop\shibiko ai\diffusion-ai\.venv\lib\site-packages\diffusers\loaders\single_file_model.py", line 209, in from_single_file
    checkpoint = load_single_file_checkpoint(
  File "C:\Users\Shibiko AI\Desktop\shibiko ai\diffusion-ai\.venv\lib\site-packages\diffusers\loaders\single_file_utils.py", line 346, in load_single_file_checkpoint
    checkpoint = load_state_dict(pretrained_model_link_or_path)
  File "C:\Users\Shibiko AI\Desktop\shibiko ai\diffusion-ai\.venv\lib\site-packages\diffusers\models\model_loading_utils.py", line 128, in load_state_dict
    raise OSError(
OSError: Unable to load weights from checkpoint file for './assets/vae/orangemix.vae.pt' at './assets/vae/orangemix.vae.pt'.

System Info

Python 3.10.9

AMD 7950X3D | AMD 5950X
RTX 4090 x2 | RTX 4090
128GB DDR5 | 128GB DDR4
Windows 10 | Windows 10

Who can help?

@sayakpaul

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleIssues that haven't received updates

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions