PixArt-alpha / PixArt-sigma

PixArt-Σ: Weak-to-Strong Training of Diffusion Transformer for 4K Text-to-Image Generation
https://pixart-alpha.github.io/PixArt-sigma-project/
GNU Affero General Public License v3.0
1.47k stars 70 forks source link

Can only load sigma with --sdvae #18

Closed Bigfield77 closed 3 months ago

Bigfield77 commented 3 months ago

Hello,

I tried downloading using the provided download.py and git clone of the folder but I always get the same error when trying to run the interface.py:


Warning: position embed interpolation: 1, base size: 32
kv compress config: {'sampling': None, 'scale_factor': 1, 'kv_compress_layer': []}
2024-04-06 18:00:24,201 - PixArt - WARNING - Missing keys: ['pos_embed']
2024-04-06 18:00:24,202 - PixArt - WARNING - Unexpected keys: []
Traceback (most recent call last):
  File "D:\stable\pixartSigma\venv\lib\site-packages\diffusers\models\modeling_utils.py", line 109, in load_state_dict
    return safetensors.torch.load_file(checkpoint_file, device="cpu")
  File "D:\stable\pixartSigma\venv\lib\site-packages\safetensors\torch.py", line 308, in load_file
    with safe_open(filename, framework="pt", device=device) as f:
safetensors_rust.SafetensorError: Error while deserializing header: MetadataIncompleteBuffer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\stable\pixartSigma\venv\lib\site-packages\diffusers\models\modeling_utils.py", line 120, in load_state_dict
    if f.read().startswith("version"):
  File "C:\Users\fgran\AppData\Local\Programs\Python\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 0x8f in position 27814: character maps to <undefined>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\stable\pixartSigma\PixArt-sigma\scripts\interface.py", line 193, in <module>
    vae = AutoencoderKL.from_pretrained(f"{args.pipeline_load_from}/vae").to(device).to(weight_dtype)
  File "D:\stable\pixartSigma\venv\lib\site-packages\huggingface_hub\utils\_validators.py", line 119, in _inner_fn
    return fn(*args, **kwargs)
  File "D:\stable\pixartSigma\venv\lib\site-packages\diffusers\models\modeling_utils.py", line 661, in from_pretrained
    state_dict = load_state_dict(model_file, variant=variant)
  File "D:\stable\pixartSigma\venv\lib\site-packages\diffusers\models\modeling_utils.py", line 132, in load_state_dict
    raise OSError(
OSError: Unable to load weights from checkpoint file for 'output/pretrained_models/pixart_sigma_sdxlvae_T5_diffusers/vae\diffusion_pytorch_model.safetensors' at 'output/pretrained_models/pixart_sigma_sdxlvae_T5_diffusers/vae\diffusion_pytorch_model.safetensors'.

I am able to run if I specify the --sdvae

Could the hugging face repo be corrupted?

Bigfield77 commented 3 months ago

Overwriting the content of pixart_sigma_sdxlvae_T5_diffusers\vae with https://huggingface.co/madebyollin/sdxl-vae-fp16-fix seems to solve the issue

lawrence-cj commented 3 months ago

Seems the vae file is crushed. Uploaded.

Bigfield77 commented 3 months ago

redownloaded it and it works fine Thanks!