diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

train_dreambooth.py cannot be started.

Open captainweasly opened this issue 1 year ago • 0 comments

Describe the bug

Whenever train_dreambooth.py is being triggered, it failed to continue due to line 35 within the deprecation_utils.py.

Reproduction

N/A

Logs

he following values were not passed to `accelerate launch` and had defaults used instead:
	`--num_processes` was set to a value of `1`
	`--num_machines` was set to a value of `1`
	`--mixed_precision` was set to a value of `'no'`
	`--num_cpu_threads_per_process` was set to `1` to improve out-of-box performance
To avoid this warning pass in values for each of the problematic parameters or run `accelerate config`.
/usr/local/lib/python3.7/dist-packages/diffusers/utils/deprecation_utils.py:35: FutureWarning: It is deprecated to pass a pretrained model name or path to `from_config`.If you were trying to load a scheduler, please use <class 'diffusers.schedulers.scheduling_ddpm.DDPMScheduler'>.from_pretrained(...) instead. Otherwise, please make sure to pass a configuration dictionary instead. This functionality will be removed in v1.0.0.
  warnings.warn(warning + message, FutureWarning)
Caching latents:   0% 0/50 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/PIL/ImageFile.py", line 233, in load
    s = read(self.decodermaxblock)
  File "/usr/local/lib/python3.7/dist-packages/PIL/PngImagePlugin.py", line 838, in load_read
    cid, pos, length = self.png.read()
  File "/usr/local/lib/python3.7/dist-packages/PIL/PngImagePlugin.py", line 129, in read
    length = i32(s)
  File "/usr/local/lib/python3.7/dist-packages/PIL/_binary.py", line 71, in i32be
    return unpack_from(">I", c, o)[0]
struct.error: unpack_from requires a buffer of at least 4 bytes

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "train_dreambooth.py", line 822, in <module>
    main(args)
  File "train_dreambooth.py", line 613, in main
    for batch in tqdm(train_dataloader, desc="Caching latents"):
  File "/usr/local/lib/python3.7/dist-packages/tqdm/std.py", line 1195, in __iter__
    for obj in iterable:
  File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 681, in __next__
    data = self._next_data()
  File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 721, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 49, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "train_dreambooth.py", line 326, in __getitem__
    example["instance_images"] = self.image_transforms(instance_image)
  File "/usr/local/lib/python3.7/dist-packages/torchvision/transforms/transforms.py", line 94, in __call__
    img = t(img)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/torchvision/transforms/transforms.py", line 349, in forward
    return F.resize(img, self.size, self.interpolation, self.max_size, self.antialias)
  File "/usr/local/lib/python3.7/dist-packages/torchvision/transforms/functional.py", line 430, in resize
    return F_pil.resize(img, size=size, interpolation=pil_interpolation, max_size=max_size)
  File "/usr/local/lib/python3.7/dist-packages/torchvision/transforms/functional_pil.py", line 275, in resize
    return img.resize((new_w, new_h), interpolation)
  File "/usr/local/lib/python3.7/dist-packages/PIL/Image.py", line 1886, in resize
    self.load()
  File "/usr/local/lib/python3.7/dist-packages/PIL/ImageFile.py", line 239, in load
    raise OSError("image file is truncated")
OSError: image file is truncated
Traceback (most recent call last):
  File "/usr/local/bin/accelerate", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/accelerate/commands/accelerate_cli.py", line 43, in main
    args.func(args)
  File "/usr/local/lib/python3.7/dist-packages/accelerate/commands/launch.py", line 837, in launch_command
    simple_launcher(args)
  File "/usr/local/lib/python3.7/dist-packages/accelerate/commands/launch.py", line 354, in simple_launcher
    raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', 'train_dreambooth.py', '--pretrained_model_name_or_path=runwayml/stable-diffusion-v1-5', '--pretrained_vae_name_or_path=stabilityai/sd-vae-ft-mse', '--output_dir=/content/drive/MyDrive/stable_diffusion_weights/zwx', '--revision=fp16', '--with_prior_preservation', '--prior_loss_weight=1.0', '--seed=1337', '--resolution=512', '--train_batch_size=1', '--train_text_encoder', '--mixed_precision=fp16', '--use_8bit_adam', '--gradient_accumulation_steps=1', '--learning_rate=1e-6', '--lr_scheduler=constant', '--lr_warmup_steps=0', '--num_class_images=50', '--sample_batch_size=4', '--max_train_steps=800', '--save_interval=10000', '--save_sample_prompt=photo of Kurenai', '--concepts_list=concepts_list.json']' returned non-zero exit status 1.

System Info

Python version is 3.7 and I am running the Google collab instance.

captainweasly avatar Nov 29 '22 05:11 captainweasly