d8ahazard / sd_dreambooth_extension

Other
1.85k stars 281 forks source link

[Bug]: Unable to load weights from pytorch; 'utf-8' codec can't decode byte 0x80 in position 64; PytorchStreamReader failed reading zip archive #1367

Closed ghost closed 9 months ago

ghost commented 9 months ago

Is there an existing issue for this?

What happened?

SDXL is unable to load it's parts to start training.

Steps to reproduce the problem

  1. Create SDXL model
  2. Launch training
  3. look at it fail

Commit and libraries

Dreambooth revision: 1a1d1621086a4725fda1200256f319c845dc7a8a [+] xformers version 0.0.23.dev635 installed. [+] torch version 2.0.1+cu118 installed. [+] torchvision version 0.15.2+cu118 installed. [+] accelerate version 0.23.0 installed. [+] diffusers version 0.21.4 installed. [+] transformers version 4.32.1 installed. [+] bitsandbytes version 0.41.1 installed.

Command Line Arguments

@echo off

set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS=--no-half-vae --disable-nan-check --xformers
set "REQS_FILE=extensions\sd_dreambooth_extension\requirements.txt"
call webui.bat

Console logs

Traceback (most recent call last):██████████████████████▎                                 | 3/7 [00:00<00:00, 29.41it/s]
  File "G:\sdui2\venv\lib\site-packages\transformers\modeling_utils.py", line 479, in load_state_dict
    return torch.load(checkpoint_file, map_location=map_location)
  File "G:\sdui2\venv\lib\site-packages\torch\serialization.py", line 797, in load
    with _open_zipfile_reader(opened_file) as opened_zipfile:
  File "G:\sdui2\venv\lib\site-packages\torch\serialization.py", line 283, in __init__
    super().__init__(torch._C.PyTorchFileReader(name_or_buffer))
RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "G:\sdui2\venv\lib\site-packages\transformers\modeling_utils.py", line 483, in load_state_dict
    if f.read(7) == "version":
  File "C:\Users\ruand\AppData\Local\Programs\Python\Python310\lib\codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 64: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "G:\sdui2\extensions\sd_dreambooth_extension\dreambooth\ui_functions.py", line 730, in start_training
    result = main(class_gen_method=class_gen_method)
  File "G:\sdui2\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 1809, in main
    return inner_loop()
  File "G:\sdui2\extensions\sd_dreambooth_extension\dreambooth\memory.py", line 126, in decorator
    return function(batch_size, grad_size, prof, *args, **kwargs)
  File "G:\sdui2\extensions\sd_dreambooth_extension\dreambooth\train_dreambooth.py", line 348, in inner_loop
    text_encoder = text_encoder_cls.from_pretrained(
  File "G:\sdui2\venv\lib\site-packages\transformers\modeling_utils.py", line 2805, in from_pretrained
    state_dict = load_state_dict(resolved_archive_file)
  File "G:\sdui2\venv\lib\site-packages\transformers\modeling_utils.py", line 495, in load_state_dict
    raise OSError(
OSError: Unable to load weights from pytorch checkpoint file for 'G:\sdui2\models\dreambooth\SDXLLoras\working\text_encoder\pytorch_model.bin' at 'G:\sdui2\models\dreambooth\SDXLLoras\working\text_encoder\pytorch_model.bin'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.
Loading text encoder...:  43%|█████████████████████████▎                                 | 3/7 [00:00<00:00, 24.79it/s]

Additional information

python: 3.10.9  •  torch: 2.0.1+cu118  •  xformers: 0.0.23.dev635  •  gradio: 3.16.2  •  commit: [00bd271f]

Wanted to test SDXL today, bu it's a bit f'd up for now.

github-actions[bot] commented 9 months ago

This issue is stale because it has been open 5 days with no activity. Remove stale label or comment or this will be closed in 5 days