Git Product home page Git Product logo

hcp-diffusion's Introduction

HCP-Diffusion

PyPI GitHub stars GitHub license codecov open issues

๐Ÿ“˜ไธญๆ–‡่ฏดๆ˜Ž

๐Ÿ“˜English document ๐Ÿ“˜ไธญๆ–‡ๆ–‡ๆกฃ

Introduction

HCP-Diffusion is a toolbox for Stable Diffusion models based on ๐Ÿค— Diffusers. It facilitates flexiable configurations and component support for training, in comparison with webui and sd-scripts.

This toolbox supports Colossal-AI, which can significantly reduce GPU memory usage.

HCP-Diffusion can unify existing training methods for text-to-image generation (e.g., Prompt-tuning, Textual Inversion, DreamArtist, Fine-tuning, DreamBooth, LoRA, ControlNet, etc) and model structures through a single .yaml configuration file.

The toolbox has also implemented an upgraded version of DreamArtist with LoRA, named DreamArtist++, for one-shot text-to-image generation. Compared to DreamArtist, DreamArtist++ is more stable with higher image quality and generation controllability, and faster training speed.

Features

  • Layer-wise LoRA (with Conv2d)
  • Layer-wise fine-tuning
  • Layer-wise model ensemble
  • Prompt-tuning with multiple words
  • DreamArtist and DreamArtist++
  • Aspect Ratio Bucket (ARB) with automatic clustering
  • Multiple datasets with multiple data sources
  • Image attention mask
  • Word attention multiplier
  • Custom words that occupy multiple words
  • Maximum sentence length expansion
  • ๐Ÿค— Accelerate
  • Colossal-AI
  • xFormers for UNet and text-encoder
  • CLIP skip
  • Tag shuffle and dropout
  • Safetensors support
  • Controlnet (support training)
  • Min-SNR loss
  • Custom optimizer (Lion, DAdaptation, pytorch-optimizer, ...)
  • Custom lr scheduler
  • SDXL support

Install

Install with pip:

pip install hcpdiff
# Start a new project and make initialization
hcpinit

Install from source:

git clone https://github.com/7eu7d7/HCP-Diffusion.git
cd HCP-Diffusion
pip install -e .
# Modified based on this project or start a new project and make initialization
## hcpinit

To use xFormers to reduce VRAM usage and accelerate training:

# use conda
conda install xformers -c xformers

# use pip
pip install xformers>=0.0.17

User guidance

Training

Training scripts based on ๐Ÿค— Accelerate or Colossal-AI are provided.

# with Accelerate
accelerate launch -m hcpdiff.train_ac --cfg cfgs/train/cfg_file.yaml
# with Accelerate and only one GPU
accelerate launch -m hcpdiff.train_ac_single --cfg cfgs/train/cfg_file.yaml
# with Colossal-AI
# pip install colossalai
torchrun --nproc_per_node 1 -m hcpdiff.train_colo --cfg cfgs/train/cfg_file.yaml

Inference

python -m hcpdiff.visualizer --cfg cfgs/infer/cfg.yaml pretrained_model=pretrained_model_path \
        prompt='positive_prompt' \
        neg_prompt='negative_prompt' \
        seed=42

Conversion of Stable Diffusion models

The framework is based on ๐Ÿค— Diffusers. So it needs to convert the original Stable Diffusion model into a supported format using the scripts provided by ๐Ÿค— Diffusers.

  • Download the config file
  • Convert models based on config file
python -m hcpdiff.tools.sd2diffusers \
    --checkpoint_path "path_to_stable_diffusion_model" \
    --original_config_file "path_to_config_file" \
    --dump_path "save_directory" \
    [--extract_ema] # Extract EMA model
    [--from_safetensors] # Whether the original model is in safetensors format
    [--to_safetensors] # Whether to save to safetensors format

Convert VAE:

python -m hcpdiff.tools.sd2diffusers \
    --vae_pt_path "path_to_VAE_model" \
    --original_config_file "path_to_config_file" \
    --dump_path "save_directory"
    [--from_safetensors]

Tutorials

Contributing

You are welcome to contribute more models and features to this toolbox!

Team

This toolbox is maintained by HCP-Lab, SYSU [GitHub].

Citation

@article{DBLP:journals/corr/abs-2211-11337,
  author    = {Ziyi Dong and
               Pengxu Wei and
               Liang Lin},
  title     = {DreamArtist: Towards Controllable One-Shot Text-to-Image Generation
               via Positive-Negative Prompt-Tuning},
  journal   = {CoRR},
  volume    = {abs/2211.11337},
  year      = {2022},
  doi       = {10.48550/arXiv.2211.11337},
  eprinttype = {arXiv},
  eprint    = {2211.11337},
}

hcp-diffusion's People

Contributors

chr1st0ph3rgg avatar coxy7 avatar hcplab-sysu avatar iamwangyabin avatar irisrainbowneko avatar kohakublueleaf avatar narugo1992 avatar ritsuyan avatar unrealmj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hcp-diffusion's Issues

RuntimeError: shape '[616, 1, 40]' is invalid for input of size 49280

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Traceback (most recent call last) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/runpy.py:196 in           โ”‚
โ”‚ _run_module_as_main                                                      โ”‚
โ”‚                                                                          โ”‚
โ”‚   193 โ”‚   main_globals = sys.modules["__main__"].__dict__                โ”‚
โ”‚   194 โ”‚   if alter_argv:                                                 โ”‚
โ”‚   195 โ”‚   โ”‚   sys.argv[0] = mod_spec.origin                              โ”‚
โ”‚ โฑ 196 โ”‚   return _run_code(code, main_globals, None,                     โ”‚
โ”‚   197 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚    "__main__", mod_spec)                         โ”‚
โ”‚   198                                                                    โ”‚
โ”‚   199 def run_module(mod_name, init_globals=None,                        โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/runpy.py:86 in _run_code  โ”‚
โ”‚                                                                          โ”‚
โ”‚    83 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚      __loader__ = loader,                        โ”‚
โ”‚    84 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚      __package__ = pkg_name,                     โ”‚
โ”‚    85 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚      __spec__ = mod_spec)                        โ”‚
โ”‚ โฑ  86 โ”‚   exec(code, run_globals)                                        โ”‚
โ”‚    87 โ”‚   return run_globals                                             โ”‚
โ”‚    88                                                                    โ”‚
โ”‚    89 def _run_module_code(code, init_globals=None,                      โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/hcpdiff/tra โ”‚
โ”‚ in_ac_single.py:105 in <module>                                          โ”‚
โ”‚                                                                          โ”‚
โ”‚   102 โ”‚                                                                  โ”‚
โ”‚   103 โ”‚   conf = load_config_with_cli(args.cfg, args_list=sys.argv[3:])  โ”‚
โ”‚   104 โ”‚   trainer = TrainerSingleCard(conf)                              โ”‚
โ”‚ โฑ 105 โ”‚   trainer.train()                                                โ”‚
โ”‚   106                                                                    โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/hcpdiff/tra โ”‚
โ”‚ in_ac.py:409 in train                                                    โ”‚
โ”‚                                                                          โ”‚
โ”‚   406 โ”‚   โ”‚                                                              โ”‚
โ”‚   407 โ”‚   โ”‚   loss_sum = np.ones(30)                                     โ”‚
โ”‚   408 โ”‚   โ”‚   for data_list in self.train_loader_group:                  โ”‚
โ”‚ โฑ 409 โ”‚   โ”‚   โ”‚   loss = self.train_one_step(data_list)                  โ”‚
โ”‚   410 โ”‚   โ”‚   โ”‚   loss_sum[self.global_step%len(loss_sum)] = loss        โ”‚
โ”‚   411 โ”‚   โ”‚   โ”‚                                                          โ”‚
โ”‚   412 โ”‚   โ”‚   โ”‚   self.global_step += 1                                  โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/hcpdiff/tra โ”‚
โ”‚ in_ac.py:501 in train_one_step                                           โ”‚
โ”‚                                                                          โ”‚
โ”‚   498 โ”‚   โ”‚   โ”‚   โ”‚   other_datas = {k:v.to(self.device, dtype=self.weig โ”‚
โ”‚   499 โ”‚   โ”‚   โ”‚   โ”‚                                                      โ”‚
โ”‚   500 โ”‚   โ”‚   โ”‚   โ”‚   latents = self.get_latents(image, self.train_loade โ”‚
โ”‚ โฑ 501 โ”‚   โ”‚   โ”‚   โ”‚   model_pred, target, timesteps = self.forward(laten โ”‚
โ”‚   502 โ”‚   โ”‚   โ”‚   โ”‚   loss = self.get_loss(model_pred, target, timesteps โ”‚
โ”‚   503 โ”‚   โ”‚   โ”‚   โ”‚   self.accelerator.backward(loss)                    โ”‚
โ”‚   504                                                                    โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/hcpdiff/tra โ”‚
โ”‚ in_ac.py:479 in forward                                                  โ”‚
โ”‚                                                                          โ”‚
โ”‚   476 โ”‚   โ”‚                                                              โ”‚
โ”‚   477 โ”‚   โ”‚   # CFG context for DreamArtist                              โ”‚
โ”‚   478 โ”‚   โ”‚   noisy_latents, timesteps = self.cfg_context.pre(noisy_late โ”‚
โ”‚ โฑ 479 โ”‚   โ”‚   model_pred = self.encode_decode(prompt_ids, noisy_latents, โ”‚
โ”‚   480 โ”‚   โ”‚   model_pred = self.cfg_context.post(model_pred)             โ”‚
โ”‚   481 โ”‚   โ”‚                                                              โ”‚
โ”‚   482 โ”‚   โ”‚   # Get the target for loss depending on the prediction type โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/hcpdiff/tra โ”‚
โ”‚ in_ac_single.py:78 in encode_decode                                      โ”‚
โ”‚                                                                          โ”‚
โ”‚    75 โ”‚   โ”‚   โ”‚   โ”‚   feeder(input_all)                                  โ”‚
โ”‚    76 โ”‚   โ”‚                                                              โ”‚
โ”‚    77 โ”‚   โ”‚   encoder_hidden_states = self.text_encoder(prompt_ids, outp โ”‚
โ”‚ โฑ  78 โ”‚   โ”‚   model_pred = self.unet(noisy_latents, timesteps, encoder_h โ”‚
โ”‚    79 โ”‚   โ”‚   return model_pred                                          โ”‚
โ”‚    80 โ”‚                                                                  โ”‚
โ”‚    81 โ”‚   def get_loss(self, model_pred, target, timesteps, att_mask):   โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/torch/nn/mo โ”‚
โ”‚ dules/module.py:1130 in _call_impl                                       โ”‚
โ”‚                                                                          โ”‚
โ”‚   1127 โ”‚   โ”‚   # this function, and just call forward.                   โ”‚
โ”‚   1128 โ”‚   โ”‚   if not (self._backward_hooks or self._forward_hooks or se โ”‚
โ”‚   1129 โ”‚   โ”‚   โ”‚   โ”‚   or _global_forward_hooks or _global_forward_pre_h โ”‚
โ”‚ โฑ 1130 โ”‚   โ”‚   โ”‚   return forward_call(*input, **kwargs)                 โ”‚
โ”‚   1131 โ”‚   โ”‚   # Do not call functions when jit is used                  โ”‚
โ”‚   1132 โ”‚   โ”‚   full_backward_hooks, non_full_backward_hooks = [], []     โ”‚
โ”‚   1133 โ”‚   โ”‚   if self._backward_hooks or _global_backward_hooks:        โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/accelerate/ โ”‚
โ”‚ utils/operations.py:553 in forward                                       โ”‚
โ”‚                                                                          โ”‚
โ”‚   550 โ”‚   model_forward = ConvertOutputsToFp32(model_forward)            โ”‚
โ”‚   551 โ”‚                                                                  โ”‚
โ”‚   552 โ”‚   def forward(*args, **kwargs):                                  โ”‚
โ”‚ โฑ 553 โ”‚   โ”‚   return model_forward(*args, **kwargs)                      โ”‚
โ”‚   554 โ”‚                                                                  โ”‚
โ”‚   555 โ”‚   # To act like a decorator so that it can be popped when doing  โ”‚
โ”‚   556 โ”‚   forward.__wrapped__ = model_forward                            โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/accelerate/ โ”‚
โ”‚ utils/operations.py:541 in __call__                                      โ”‚
โ”‚                                                                          โ”‚
โ”‚   538 โ”‚   โ”‚   update_wrapper(self, model_forward)                        โ”‚
โ”‚   539 โ”‚                                                                  โ”‚
โ”‚   540 โ”‚   def __call__(self, *args, **kwargs):                           โ”‚
โ”‚ โฑ 541 โ”‚   โ”‚   return convert_to_fp32(self.model_forward(*args, **kwargs) โ”‚
โ”‚   542 โ”‚                                                                  โ”‚
โ”‚   543 โ”‚   def __getstate__(self):                                        โ”‚
โ”‚   544 โ”‚   โ”‚   raise pickle.PicklingError(                                โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/torch/amp/a โ”‚
โ”‚ utocast_mode.py:12 in decorate_autocast                                  โ”‚
โ”‚                                                                          โ”‚
โ”‚     9 โ”‚   @functools.wraps(func)                                         โ”‚
โ”‚    10 โ”‚   def decorate_autocast(*args, **kwargs):                        โ”‚
โ”‚    11 โ”‚   โ”‚   with autocast_instance:                                    โ”‚
โ”‚ โฑ  12 โ”‚   โ”‚   โ”‚   return func(*args, **kwargs)                           โ”‚
โ”‚    13 โ”‚   decorate_autocast.__script_unsupported = '@autocast() decorato โ”‚
โ”‚    14 โ”‚   return decorate_autocast                                       โ”‚
โ”‚    15                                                                    โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/diffusers/m โ”‚
โ”‚ odels/unet_2d_condition.py:481 in forward                                โ”‚
โ”‚                                                                          โ”‚
โ”‚   478 โ”‚   โ”‚   down_block_res_samples = (sample,)                         โ”‚
โ”‚   479 โ”‚   โ”‚   for downsample_block in self.down_blocks:                  โ”‚
โ”‚   480 โ”‚   โ”‚   โ”‚   if hasattr(downsample_block, "has_cross_attention") an โ”‚
โ”‚ โฑ 481 โ”‚   โ”‚   โ”‚   โ”‚   sample, res_samples = downsample_block(            โ”‚
โ”‚   482 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   hidden_states=sample,                          โ”‚
โ”‚   483 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   temb=emb,                                      โ”‚
โ”‚   484 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   encoder_hidden_states=encoder_hidden_states,   โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/torch/nn/mo โ”‚
โ”‚ dules/module.py:1130 in _call_impl                                       โ”‚
โ”‚                                                                          โ”‚
โ”‚   1127 โ”‚   โ”‚   # this function, and just call forward.                   โ”‚
โ”‚   1128 โ”‚   โ”‚   if not (self._backward_hooks or self._forward_hooks or se โ”‚
โ”‚   1129 โ”‚   โ”‚   โ”‚   โ”‚   or _global_forward_hooks or _global_forward_pre_h โ”‚
โ”‚ โฑ 1130 โ”‚   โ”‚   โ”‚   return forward_call(*input, **kwargs)                 โ”‚
โ”‚   1131 โ”‚   โ”‚   # Do not call functions when jit is used                  โ”‚
โ”‚   1132 โ”‚   โ”‚   full_backward_hooks, non_full_backward_hooks = [], []     โ”‚
โ”‚   1133 โ”‚   โ”‚   if self._backward_hooks or _global_backward_hooks:        โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/diffusers/m โ”‚
โ”‚ odels/unet_2d_blocks.py:781 in forward                                   โ”‚
โ”‚                                                                          โ”‚
โ”‚    778 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   return custom_forward                         โ”‚
โ”‚    779 โ”‚   โ”‚   โ”‚   โ”‚                                                     โ”‚
โ”‚    780 โ”‚   โ”‚   โ”‚   โ”‚   hidden_states = torch.utils.checkpoint.checkpoint โ”‚
โ”‚ โฑ  781 โ”‚   โ”‚   โ”‚   โ”‚   hidden_states = torch.utils.checkpoint.checkpoint โ”‚
โ”‚    782 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   create_custom_forward(attn, return_dict=False โ”‚
โ”‚    783 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   hidden_states,                                โ”‚
โ”‚    784 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   encoder_hidden_states,                        โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/hcpdiff/tra โ”‚
โ”‚ in_ac.py:48 in checkpoint_fix                                            โ”‚
โ”‚                                                                          โ”‚
โ”‚    45 # fix checkpoint bug for train part of model                       โ”‚
โ”‚    46 import torch.utils.checkpoint                                      โ”‚
โ”‚    47 def checkpoint_fix(function, *args, use_reentrant: bool = False, c โ”‚
โ”‚ โฑ  48 โ”‚   return checkpoint_raw(function, *args, use_reentrant=use_reent โ”‚
โ”‚    49 torch.utils.checkpoint.checkpoint = checkpoint_fix                 โ”‚
โ”‚    50                                                                    โ”‚
โ”‚    51 class Trainer:                                                     โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/torch/utils โ”‚
โ”‚ /checkpoint.py:237 in checkpoint                                         โ”‚
โ”‚                                                                          โ”‚
โ”‚   234 โ”‚   if use_reentrant:                                              โ”‚
โ”‚   235 โ”‚   โ”‚   return CheckpointFunction.apply(function, preserve, *args) โ”‚
โ”‚   236 โ”‚   else:                                                          โ”‚
โ”‚ โฑ 237 โ”‚   โ”‚   return _checkpoint_without_reentrant(                      โ”‚
โ”‚   238 โ”‚   โ”‚   โ”‚   function,                                              โ”‚
โ”‚   239 โ”‚   โ”‚   โ”‚   preserve,                                              โ”‚
โ”‚   240 โ”‚   โ”‚   โ”‚   *args                                                  โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/torch/utils โ”‚
โ”‚ /checkpoint.py:383 in _checkpoint_without_reentrant                      โ”‚
โ”‚                                                                          โ”‚
โ”‚   380 โ”‚   โ”‚   return storage.pop(x)                                      โ”‚
โ”‚   381 โ”‚                                                                  โ”‚
โ”‚   382 โ”‚   with torch.autograd.graph.saved_tensors_hooks(pack, unpack):   โ”‚
โ”‚ โฑ 383 โ”‚   โ”‚   output = function(*args)                                   โ”‚
โ”‚   384 โ”‚   โ”‚   if torch.cuda._initialized and preserve_rng_state and not  โ”‚
โ”‚   385 โ”‚   โ”‚   โ”‚   # Cuda was not initialized before running the forward, โ”‚
โ”‚   386 โ”‚   โ”‚   โ”‚   # stash the CUDA state.                                โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/diffusers/m โ”‚
โ”‚ odels/unet_2d_blocks.py:774 in custom_forward                            โ”‚
โ”‚                                                                          โ”‚
โ”‚    771 โ”‚   โ”‚   โ”‚   โ”‚   def create_custom_forward(module, return_dict=Non โ”‚
โ”‚    772 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   def custom_forward(*inputs):                  โ”‚
โ”‚    773 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   if return_dict is not None:               โ”‚
โ”‚ โฑ  774 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   return module(*inputs, return_dict=re โ”‚
โ”‚    775 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   else:                                     โ”‚
โ”‚    776 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   return module(*inputs)                โ”‚
โ”‚    777                                                                   โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/torch/nn/mo โ”‚
โ”‚ dules/module.py:1130 in _call_impl                                       โ”‚
โ”‚                                                                          โ”‚
โ”‚   1127 โ”‚   โ”‚   # this function, and just call forward.                   โ”‚
โ”‚   1128 โ”‚   โ”‚   if not (self._backward_hooks or self._forward_hooks or se โ”‚
โ”‚   1129 โ”‚   โ”‚   โ”‚   โ”‚   or _global_forward_hooks or _global_forward_pre_h โ”‚
โ”‚ โฑ 1130 โ”‚   โ”‚   โ”‚   return forward_call(*input, **kwargs)                 โ”‚
โ”‚   1131 โ”‚   โ”‚   # Do not call functions when jit is used                  โ”‚
โ”‚   1132 โ”‚   โ”‚   full_backward_hooks, non_full_backward_hooks = [], []     โ”‚
โ”‚   1133 โ”‚   โ”‚   if self._backward_hooks or _global_backward_hooks:        โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/diffusers/m โ”‚
โ”‚ odels/transformer_2d.py:265 in forward                                   โ”‚
โ”‚                                                                          โ”‚
โ”‚   262 โ”‚   โ”‚                                                              โ”‚
โ”‚   263 โ”‚   โ”‚   # 2. Blocks                                                โ”‚
โ”‚   264 โ”‚   โ”‚   for block in self.transformer_blocks:                      โ”‚
โ”‚ โฑ 265 โ”‚   โ”‚   โ”‚   hidden_states = block(                                 โ”‚
โ”‚   266 โ”‚   โ”‚   โ”‚   โ”‚   hidden_states,                                     โ”‚
โ”‚   267 โ”‚   โ”‚   โ”‚   โ”‚   encoder_hidden_states=encoder_hidden_states,       โ”‚
โ”‚   268 โ”‚   โ”‚   โ”‚   โ”‚   timestep=timestep,                                 โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/torch/nn/mo โ”‚
โ”‚ dules/module.py:1130 in _call_impl                                       โ”‚
โ”‚                                                                          โ”‚
โ”‚   1127 โ”‚   โ”‚   # this function, and just call forward.                   โ”‚
โ”‚   1128 โ”‚   โ”‚   if not (self._backward_hooks or self._forward_hooks or se โ”‚
โ”‚   1129 โ”‚   โ”‚   โ”‚   โ”‚   or _global_forward_hooks or _global_forward_pre_h โ”‚
โ”‚ โฑ 1130 โ”‚   โ”‚   โ”‚   return forward_call(*input, **kwargs)                 โ”‚
โ”‚   1131 โ”‚   โ”‚   # Do not call functions when jit is used                  โ”‚
โ”‚   1132 โ”‚   โ”‚   full_backward_hooks, non_full_backward_hooks = [], []     โ”‚
โ”‚   1133 โ”‚   โ”‚   if self._backward_hooks or _global_backward_hooks:        โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/diffusers/m โ”‚
โ”‚ odels/attention.py:307 in forward                                        โ”‚
โ”‚                                                                          โ”‚
โ”‚   304 โ”‚   โ”‚   โ”‚   )                                                      โ”‚
โ”‚   305 โ”‚   โ”‚   โ”‚                                                          โ”‚
โ”‚   306 โ”‚   โ”‚   โ”‚   # 2. Cross-Attention                                   โ”‚
โ”‚ โฑ 307 โ”‚   โ”‚   โ”‚   attn_output = self.attn2(                              โ”‚
โ”‚   308 โ”‚   โ”‚   โ”‚   โ”‚   norm_hidden_states,                                โ”‚
โ”‚   309 โ”‚   โ”‚   โ”‚   โ”‚   encoder_hidden_states=encoder_hidden_states,       โ”‚
โ”‚   310 โ”‚   โ”‚   โ”‚   โ”‚   attention_mask=attention_mask,                     โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/torch/nn/mo โ”‚
โ”‚ dules/module.py:1130 in _call_impl                                       โ”‚
โ”‚                                                                          โ”‚
โ”‚   1127 โ”‚   โ”‚   # this function, and just call forward.                   โ”‚
โ”‚   1128 โ”‚   โ”‚   if not (self._backward_hooks or self._forward_hooks or se โ”‚
โ”‚   1129 โ”‚   โ”‚   โ”‚   โ”‚   or _global_forward_hooks or _global_forward_pre_h โ”‚
โ”‚ โฑ 1130 โ”‚   โ”‚   โ”‚   return forward_call(*input, **kwargs)                 โ”‚
โ”‚   1131 โ”‚   โ”‚   # Do not call functions when jit is used                  โ”‚
โ”‚   1132 โ”‚   โ”‚   full_backward_hooks, non_full_backward_hooks = [], []     โ”‚
โ”‚   1133 โ”‚   โ”‚   if self._backward_hooks or _global_backward_hooks:        โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/diffusers/m โ”‚
โ”‚ odels/cross_attention.py:160 in forward                                  โ”‚
โ”‚                                                                          โ”‚
โ”‚   157 โ”‚   โ”‚   # The `CrossAttention` class can call different attention  โ”‚
โ”‚   158 โ”‚   โ”‚   # here we simply pass along all tensors to the selected pr โ”‚
โ”‚   159 โ”‚   โ”‚   # For standard processors that are defined here, `**cross_ โ”‚
โ”‚ โฑ 160 โ”‚   โ”‚   return self.processor(                                     โ”‚
โ”‚   161 โ”‚   โ”‚   โ”‚   self,                                                  โ”‚
โ”‚   162 โ”‚   โ”‚   โ”‚   hidden_states,                                         โ”‚
โ”‚   163 โ”‚   โ”‚   โ”‚   encoder_hidden_states=encoder_hidden_states,           โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/diffusers/m โ”‚
โ”‚ odels/cross_attention.py:374 in __call__                                 โ”‚
โ”‚                                                                          โ”‚
โ”‚   371 โ”‚   โ”‚   key = attn.head_to_batch_dim(key).contiguous()             โ”‚
โ”‚   372 โ”‚   โ”‚   value = attn.head_to_batch_dim(value).contiguous()         โ”‚
โ”‚   373 โ”‚   โ”‚                                                              โ”‚
โ”‚ โฑ 374 โ”‚   โ”‚   hidden_states = xformers.ops.memory_efficient_attention(   โ”‚
โ”‚   375 โ”‚   โ”‚   โ”‚   query, key, value, attn_bias=attention_mask, op=self.a โ”‚
โ”‚   376 โ”‚   โ”‚   )                                                          โ”‚
โ”‚   377 โ”‚   โ”‚   hidden_states = hidden_states.to(query.dtype)              โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/xformers/op โ”‚
โ”‚ s/fmha/__init__.py:192 in memory_efficient_attention                     โ”‚
โ”‚                                                                          โ”‚
โ”‚   189 โ”‚   โ”‚   and options.                                               โ”‚
โ”‚   190 โ”‚   :return: multi-head attention Tensor with shape ``[B, Mq, H, K โ”‚
โ”‚   191 โ”‚   """                                                            โ”‚
โ”‚ โฑ 192 โ”‚   return _memory_efficient_attention(                            โ”‚
โ”‚   193 โ”‚   โ”‚   Inputs(                                                    โ”‚
โ”‚   194 โ”‚   โ”‚   โ”‚   query=query, key=key, value=value, p=p, attn_bias=attn โ”‚
โ”‚   195 โ”‚   โ”‚   ),                                                         โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/xformers/op โ”‚
โ”‚ s/fmha/__init__.py:295 in _memory_efficient_attention                    โ”‚
โ”‚                                                                          โ”‚
โ”‚   292 โ”‚   โ”‚   )                                                          โ”‚
โ”‚   293 โ”‚                                                                  โ”‚
โ”‚   294 โ”‚   output_shape = inp.normalize_bmhk()                            โ”‚
โ”‚ โฑ 295 โ”‚   return _fMHA.apply(                                            โ”‚
โ”‚   296 โ”‚   โ”‚   op, inp.query, inp.key, inp.value, inp.attn_bias, inp.p, i โ”‚
โ”‚   297 โ”‚   ).reshape(output_shape)                                        โ”‚
โ”‚   298                                                                    โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/xformers/op โ”‚
โ”‚ s/fmha/__init__.py:41 in forward                                         โ”‚
โ”‚                                                                          โ”‚
โ”‚    38 โ”‚   โ”‚   op_fw = op[0] if op is not None else None                  โ”‚
โ”‚    39 โ”‚   โ”‚   op_bw = op[1] if op is not None else None                  โ”‚
โ”‚    40 โ”‚   โ”‚                                                              โ”‚
โ”‚ โฑ  41 โ”‚   โ”‚   out, op_ctx = _memory_efficient_attention_forward_requires โ”‚
โ”‚    42 โ”‚   โ”‚   โ”‚   inp=inp, op=op_fw                                      โ”‚
โ”‚    43 โ”‚   โ”‚   )                                                          โ”‚
โ”‚    44                                                                    โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/xformers/op โ”‚
โ”‚ s/fmha/__init__.py:323 in                                                โ”‚
โ”‚ _memory_efficient_attention_forward_requires_grad                        โ”‚
โ”‚                                                                          โ”‚
โ”‚   320 โ”‚   โ”‚   op = _dispatch_fw(inp)                                     โ”‚
โ”‚   321 โ”‚   else:                                                          โ”‚
โ”‚   322 โ”‚   โ”‚   _ensure_op_supports_or_raise(ValueError, "memory_efficient โ”‚
โ”‚ โฑ 323 โ”‚   out = op.apply(inp, needs_gradient=True)                       โ”‚
โ”‚   324 โ”‚   assert out[1] is not None                                      โ”‚
โ”‚   325 โ”‚   return (out[0].reshape(output_shape), out[1])                  โ”‚
โ”‚   326                                                                    โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/xformers/op โ”‚
โ”‚ s/fmha/flash.py:235 in apply                                             โ”‚
โ”‚                                                                          โ”‚
โ”‚   232 โ”‚   โ”‚   โ”‚   max_seqlen_q,                                          โ”‚
โ”‚   233 โ”‚   โ”‚   โ”‚   cu_seqlens_k,                                          โ”‚
โ”‚   234 โ”‚   โ”‚   โ”‚   max_seqlen_k,                                          โ”‚
โ”‚ โฑ 235 โ”‚   โ”‚   ) = _convert_input_format(inp)                             โ”‚
โ”‚   236 โ”‚   โ”‚   out, softmax_lse, rng_state = cls.OPERATOR(                โ”‚
โ”‚   237 โ”‚   โ”‚   โ”‚   inp.query,                                             โ”‚
โ”‚   238 โ”‚   โ”‚   โ”‚   inp.key,                                               โ”‚
โ”‚                                                                          โ”‚
โ”‚ /home/ubuntu/miniconda3/envs/nd/lib/python3.10/site-packages/xformers/op โ”‚
โ”‚ s/fmha/flash.py:177 in _convert_input_format                             โ”‚
โ”‚                                                                          โ”‚
โ”‚   174 โ”‚   new_inp = replace(                                             โ”‚
โ”‚   175 โ”‚   โ”‚   inp,                                                       โ”‚
โ”‚   176 โ”‚   โ”‚   query=query.reshape([batch * seqlen_q, num_heads, head_dim โ”‚
โ”‚ โฑ 177 โ”‚   โ”‚   key=key.reshape([batch * seqlen_kv, num_heads, head_dim_q] โ”‚
โ”‚   178 โ”‚   โ”‚   value=value.reshape([batch * seqlen_kv, num_heads, head_di โ”‚
โ”‚   179 โ”‚   )                                                              โ”‚
โ”‚   180 โ”‚   softmax_scale = inp.query.shape[-1] ** (-0.5) if inp.scale is  โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
RuntimeError: shape '[616, 1, 40]' is invalid for input of size 49280       
``` `

lora_convert.py --to_webuiๆฒกๆœ‰ไฟๅญ˜่ฝฌๆขๅŽ็š„state่€Œๆ˜ฏไฟๅญ˜ไบ†่ฝฌๆขๅ‰็š„TextEncoder็š„state

่ฟ™้‡Œไป็„ถไฟๅญ˜ไบ†่ฝฌๆขๅ‰็š„sd_TE่€Œไธๆ˜ฏ่ฝฌๆขๅŽ็š„state

diff --git a/hcpdiff/tools/lora_convert.py b/hcpdiff/tools/lora_convert.py
index 8242ea9..25228eb 100644
--- a/hcpdiff/tools/lora_convert.py
+++ b/hcpdiff/tools/lora_convert.py
@@ -83,5 +83,5 @@ if __name__ == '__main__':
         sd_unet = ckpt_manager.load_ckpt(args.lora_path)
         sd_TE = ckpt_manager.load_ckpt(args.lora_path_TE)
         state = converter.convert_to_webui(sd_unet['lora'], sd_TE['lora'])
-        ckpt_manager._save_ckpt(sd_TE, save_path=args.dump_path)
+        ckpt_manager._save_ckpt(state, save_path=args.dump_path)
         print('save lora to:', args.dump_path)
\ No newline at end of file

training lora encouter error about Tensor

follow this article
Error Message:
File "/root/miniconda3/lib/python3.10/site-packages/torch/_subclasses/fake_tensor.py", line 1212, in validate
raise Exception(
Exception: Please convert all Tensors to FakeTensors first or instantiate FakeTensorMode with 'allow_non_fake_inputs'. Found in aten.clone.default(*(tensor([255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 82, 191, 1, 0, 0, 0, 0, 0, 72, 3, 0, 0,
0, 0, 0, 0], dtype=torch.uint8),), **{'memory_format': torch.contiguous_format})

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 324, in _compile
out_code = transform_code_object(code, transform)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/bytecode_transformation.py", line 445, in transform_code_object
transformations(instructions, code_options)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 311, in transform
tracer.run()
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1726, in run
super().run()
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 576, in run
and self.step()
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 540, in step
getattr(self, inst.opname)(inst)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1792, in RETURN_VALUE
self.output.compile_subgraph(
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 517, in compile_subgraph
self.compile_and_call_fx_graph(tx, list(reversed(stack_values)), root)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 588, in compile_and_call_fx_graph
compiled_fn = self.call_user_compiler(gm)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 163, in time_wrapper
r = func(args, **kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 675, in call_user_compiler
raise BackendCompilerFailed(self.compiler_fn, e) from e
torch._dynamo.exc.BackendCompilerFailed: debug_wrapper raised Exception: Please convert all Tensors to FakeTensors first or instantiate FakeTensorMode with 'allow_non_fake_inputs'. Found in aten.clone.default(
(tensor([255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 82, 191, 1, 0, 0, 0, 0, 0, 72, 3, 0, 0,
0, 0, 0, 0], dtype=torch.uint8),), **{'memory_format': torch.contiguous_format})

[2023-11-09 16:43:07,786] torch._dynamo.convert_frame: [ERROR] WON'T CONVERT custom_forward /root/miniconda3/lib/python3.10/site-packages/diffusers/models/unet_2d_blocks.py line 2203
2204 0 LOAD_DEREF 1 (return_dict)
2 LOAD_CONST 0 (None)
4 IS_OP 1
6 POP_JUMP_IF_FALSE 11 (to 22)

2205 8 LOAD_DEREF 0 (module)
10 LOAD_FAST 0 (inputs)
12 LOAD_CONST 1 ('return_dict')
14 LOAD_DEREF 1 (return_dict)
16 BUILD_MAP 1
18 CALL_FUNCTION_EX 1
20 RETURN_VALUE

2207 >> 22 LOAD_DEREF 0 (module)
24 LOAD_FAST 0 (inputs)
26 CALL_FUNCTION_EX 0
28 RETURN_VALUE

========== TorchDynamo Stack Trace ==========
Traceback (most recent call last):
File "/root/miniconda3/lib/python3.10/site-packages/torch/random.py", line 133, in fork_rng
yield
File "/root/miniconda3/lib/python3.10/site-packages/torch/utils/checkpoint.py", line 414, in unpack
set_device_states(fwd_gpu_devices, fwd_gpu_states)
File "/root/miniconda3/lib/python3.10/site-packages/torch/utils/checkpoint.py", line 58, in set_device_states
torch.cuda.set_rng_state(state)
File "/root/miniconda3/lib/python3.10/site-packages/torch/cuda/random.py", line 51, in set_rng_state
new_state_copy = new_state.clone(memory_format=torch.contiguous_format)
File "/root/miniconda3/lib/python3.10/site-packages/torch/utils/_stats.py", line 20, in wrapper
return fn(*args, **kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/fx/experimental/proxy_tensor.py", line 487, in torch_dispatch
return self.inner_torch_dispatch(func, types, args, kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/fx/experimental/proxy_tensor.py", line 512, in inner_torch_dispatch
out = proxy_call(self, func, args, kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/fx/experimental/proxy_tensor.py", line 345, in proxy_call
out = func(*args, **kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_ops.py", line 287, in call
return self._op(*args, **kwargs or {})
File "/root/miniconda3/lib/python3.10/site-packages/torch/utils/_stats.py", line 20, in wrapper
return fn(args, **kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_subclasses/fake_tensor.py", line 987, in torch_dispatch
return self.dispatch(func, types, args, kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_subclasses/fake_tensor.py", line 1066, in dispatch
args, kwargs = self.validate_and_convert_non_fake_tensors(
File "/root/miniconda3/lib/python3.10/site-packages/torch/_subclasses/fake_tensor.py", line 1220, in validate_and_convert_non_fake_tensors
return tree_map_only(
File "/root/miniconda3/lib/python3.10/site-packages/torch/utils/_pytree.py", line 266, in tree_map_only
return tree_map(map_only(ty)(fn), pytree)
File "/root/miniconda3/lib/python3.10/site-packages/torch/utils/_pytree.py", line 196, in tree_map
return tree_unflatten([fn(i) for i in flat_args], spec)
File "/root/miniconda3/lib/python3.10/site-packages/torch/utils/_pytree.py", line 196, in
return tree_unflatten([fn(i) for i in flat_args], spec)
File "/root/miniconda3/lib/python3.10/site-packages/torch/utils/_pytree.py", line 247, in inner
return f(x)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_subclasses/fake_tensor.py", line 1212, in validate
raise Exception(
Exception: Please convert all Tensors to FakeTensors first or instantiate FakeTensorMode with 'allow_non_fake_inputs'. Found in aten.clone.default(
(tensor([255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 82, 191, 1, 0, 0, 0, 0, 0, 72, 3, 0, 0,
0, 0, 0, 0], dtype=torch.uint8),), **{'memory_format': torch.contiguous_format})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/miniconda3/lib/python3.10/site-packages/torch/dynamo/output_graph.py", line 670, in call_user_compiler
compiled_fn = compiler_fn(gm, self.fake_example_inputs())
File "/root/miniconda3/lib/python3.10/site-packages/torch/dynamo/debug_utils.py", line 1055, in debug_wrapper
compiled_gm = compiler_fn(gm, example_inputs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/init.py", line 1390, in call
return compile_fx(model
, inputs
, config_patches=self.config)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 455, in compile_fx
return aot_autograd(
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/backends/common.py", line 48, in compiler_fn
cg = aot_module_simplified(gm, example_inputs, **kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 2822, in aot_module_simplified
compiled_fn = create_aot_dispatcher_function(
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 163, in time_wrapper
r = func(*args, **kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 2515, in create_aot_dispatcher_function
compiled_fn = compiler_fn(flat_fn, fake_flat_args, aot_config)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 1715, in aot_wrapper_dedupe
return compiler_fn(flat_fn, leaf_flat_args, aot_config)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 2104, in aot_dispatch_autograd
fx_g = make_fx(joint_forward_backward, aot_config.decompositions)(
File "/root/miniconda3/lib/python3.10/site-packages/torch/fx/experimental/proxy_tensor.py", line 714, in wrapped
t = dispatch_trace(wrap_key(func, args, fx_tracer), tracer=fx_tracer, concrete_args=tuple(phs))
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 209, in _fn
return fn(*args, **kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/fx/experimental/proxy_tensor.py", line 443, in dispatch_trace
graph = tracer.trace(root, concrete_args)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 209, in _fn
return fn(*args, **kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/fx/_symbolic_trace.py", line 778, in trace
(self.create_arg(fn(*args)),),
File "/root/miniconda3/lib/python3.10/site-packages/torch/fx/_symbolic_trace.py", line 652, in flatten_fn
tree_out = root_fn(*tree_args)
File "/root/miniconda3/lib/python3.10/site-packages/torch/fx/experimental/proxy_tensor.py", line 459, in wrapped
out = f(*tensors)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 1158, in traced_joint
return functionalized_f_helper(primals, tangents)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 1110, in functionalized_f_helper
f_outs = flat_fn_no_input_mutations(fn, f_primals, f_tangents, meta, keep_input_mutations)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 1078, in flat_fn_no_input_mutations
outs = flat_fn_with_synthetic_bases_expanded(fn, primals, primals_after_cloning, maybe_tangents, meta, keep_input_mutations)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 1050, in flat_fn_with_synthetic_bases_expanded
outs = forward_or_joint(fn, primals_before_cloning, primals, maybe_tangents, meta, keep_input_mutations)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 1019, in forward_or_joint
backward_out = torch.autograd.grad(
File "/root/miniconda3/lib/python3.10/site-packages/torch/autograd/init.py", line 269, in grad
return handle_torch_function(
File "/root/miniconda3/lib/python3.10/site-packages/torch/overrides.py", line 1534, in handle_torch_function
result = mode.torch_function(public_api, types, args, kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_inductor/overrides.py", line 38, in torch_function
return func(*args, **kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/autograd/init.py", line 303, in grad
return Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
File "/root/miniconda3/lib/python3.10/site-packages/torch/utils/checkpoint.py", line 410, in unpack
with torch.random.fork_rng(devices=rng_devices, enabled=preserve_rng_state):
File "/root/miniconda3/lib/python3.10/contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "/root/miniconda3/lib/python3.10/site-packages/torch/random.py", line 137, in fork_rng
torch.cuda.set_rng_state(gpu_rng_state, device)
File "/root/miniconda3/lib/python3.10/site-packages/torch/cuda/random.py", line 51, in set_rng_state
new_state_copy = new_state.clone(memory_format=torch.contiguous_format)
File "/root/miniconda3/lib/python3.10/site-packages/torch/utils/_stats.py", line 20, in wrapper
return fn(*args, **kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/fx/experimental/proxy_tensor.py", line 487, in torch_dispatch
return self.inner_torch_dispatch(func, types, args, kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/fx/experimental/proxy_tensor.py", line 512, in inner_torch_dispatch
out = proxy_call(self, func, args, kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/fx/experimental/proxy_tensor.py", line 345, in proxy_call
out = func(*args, **kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_ops.py", line 287, in call
return self._op(*args, **kwargs or {})
File "/root/miniconda3/lib/python3.10/site-packages/torch/utils/_stats.py", line 20, in wrapper
return fn(args, **kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_subclasses/fake_tensor.py", line 987, in torch_dispatch
return self.dispatch(func, types, args, kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_subclasses/fake_tensor.py", line 1066, in dispatch
args, kwargs = self.validate_and_convert_non_fake_tensors(
File "/root/miniconda3/lib/python3.10/site-packages/torch/_subclasses/fake_tensor.py", line 1220, in validate_and_convert_non_fake_tensors
return tree_map_only(
File "/root/miniconda3/lib/python3.10/site-packages/torch/utils/_pytree.py", line 266, in tree_map_only
return tree_map(map_only(ty)(fn), pytree)
File "/root/miniconda3/lib/python3.10/site-packages/torch/utils/_pytree.py", line 196, in tree_map
return tree_unflatten([fn(i) for i in flat_args], spec)
File "/root/miniconda3/lib/python3.10/site-packages/torch/utils/_pytree.py", line 196, in
return tree_unflatten([fn(i) for i in flat_args], spec)
File "/root/miniconda3/lib/python3.10/site-packages/torch/utils/_pytree.py", line 247, in inner
return f(x)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_subclasses/fake_tensor.py", line 1212, in validate
raise Exception(
Exception: Please convert all Tensors to FakeTensors first or instantiate FakeTensorMode with 'allow_non_fake_inputs'. Found in aten.clone.default(
(tensor([255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 82, 191, 1, 0, 0, 0, 0, 0, 72, 3, 0, 0,
0, 0, 0, 0], dtype=torch.uint8),), **{'memory_format': torch.contiguous_format})

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 324, in _compile
out_code = transform_code_object(code, transform)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/bytecode_transformation.py", line 445, in transform_code_object
transformations(instructions, code_options)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 311, in transform
tracer.run()
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1726, in run
super().run()
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 576, in run
and self.step()
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 540, in step
getattr(self, inst.opname)(inst)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1792, in RETURN_VALUE
self.output.compile_subgraph(
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 517, in compile_subgraph
self.compile_and_call_fx_graph(tx, list(reversed(stack_values)), root)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 588, in compile_and_call_fx_graph
compiled_fn = self.call_user_compiler(gm)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 163, in time_wrapper
r = func(args, **kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 675, in call_user_compiler
raise BackendCompilerFailed(self.compiler_fn, e) from e
torch._dynamo.exc.BackendCompilerFailed: debug_wrapper raised Exception: Please convert all Tensors to FakeTensors first or instantiate FakeTensorMode with 'allow_non_fake_inputs'. Found in aten.clone.default(
(tensor([255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 82, 191, 1, 0, 0, 0, 0, 0, 72, 3, 0, 0,
0, 0, 0, 0], dtype=torch.uint8),), **{'memory_format': torch.contiguous_format})

Traceback (most recent call last):
File "/root/miniconda3/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/root/miniconda3/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/root/HCP-Diffusion/hcpdiff/train_ac_single.py", line 48, in
trainer.train()
File "/root/HCP-Diffusion/hcpdiff/train_ac.py", line 405, in train
loss = self.train_one_step(data_list)
File "/root/HCP-Diffusion/hcpdiff/train_ac.py", line 488, in train_one_step
self.accelerator.backward(loss)
File "/root/miniconda3/lib/python3.10/site-packages/accelerate/accelerator.py", line 1983, in backward
self.scaler.scale(loss).backward(**kwargs)
File "/root/miniconda3/lib/python3.10/site-packages/torch/_tensor.py", line 487, in backward
torch.autograd.backward(
File "/root/miniconda3/lib/python3.10/site-packages/torch/autograd/init.py", line 200, in backward
Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
File "/root/miniconda3/lib/python3.10/site-packages/torch/utils/checkpoint.py", line 423, in unpack
raise RuntimeError(
RuntimeError: Attempt to retrieve a tensor saved by autograd multiple times without checkpoint recomputation being triggered in between, this is not currently supported. Please open an issue with details on your use case so that we can prioritize adding this.
Traceback (most recent call last):
File "/root/miniconda3/bin/accelerate", line 8, in
sys.exit(main())
File "/root/miniconda3/lib/python3.10/site-packages/accelerate/commands/accelerate_cli.py", line 47, in main
args.func(args)
File "/root/miniconda3/lib/python3.10/site-packages/accelerate/commands/launch.py", line 986, in launch_command
simple_launcher(args)
File "/root/miniconda3/lib/python3.10/site-packages/accelerate/commands/launch.py", line 628, in simple_launcher
raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['/root/miniconda3/bin/python', '-m', 'hcpdiff.train_ac_single', '--cfg', 'cfgs/train/examples/lora_anime_character.yaml', 'character_name=surtr_arknights', 'dataset_dir=data/surtr_dataset']' returned non-zero exit status 1.

DreamArtist++ ่ฎญ็ปƒๆŠฅ้”™

cfgs/train/examples/DreamArtist++.yaml

ๅˆ ้™ค ๆœ€ๅŽ dataไธญ็š„dataset_class

่ฟ่กŒ accelerate launch -m hcpdiff.train_ac_single --cfg cfgs/train/examples/DreamArtist++.yaml

ๆŠฅ้”™: Expected query.size(0) == key.size(0) to be true, but got false.

(hcpd) โžœ  HCP-Diffusion git:(main) โœ— accelerate launch -m hcpdiff.train_ac_single --cfg cfgs/train/examples/DreamArtist++2.yaml
[11:10:59] WARNING  The following values were not passed to `accelerate launch` and had defaults used instead:              launch.py:890
                            `--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'`
                            `--dynamo_backend` was set to a value of `'no'`
                    To avoid this warning pass in values for each of the problematic parameters or run `accelerate config`.
tensorboard is not available
wandb is not available
2023-05-15 11:11:01.927 | INFO     | hcpdiff.loggers.cli_logger:_info:30 - world_size: 1
2023-05-15 11:11:01.927 | INFO     | hcpdiff.loggers.cli_logger:_info:30 - accumulation: 1
You are using a model of type clip_text_model to instantiate a model of type . This is not supported for all configurations of models and can yield errors.
2023-05-15 11:11:08.818 | INFO     | hcpdiff.data.bucket:build_buckets_from_images:130 - build buckets from images
/data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/sklearn/cluster/_kmeans.py:870: FutureWarning: The default value of `n_init` will change from 10 to 'auto' in 1.4. Set the value of `n_init` explicitly to suppress the warning
  warnings.warn(
2023-05-15 11:11:08.841 | INFO     | hcpdiff.data.bucket:build_buckets_from_images:159 - buckets info: size:[512 512], num:1
2023-05-15 11:11:08.842 | INFO     | __main__:build_data:57 - len(train_dataset): 4
100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 4/4 [00:02<00:00,  1.87it/s]
2023-05-15 11:11:12.413 | INFO     | hcpdiff.loggers.cli_logger:_info:30 - ***** Running training *****
2023-05-15 11:11:12.414 | INFO     | hcpdiff.loggers.cli_logger:_info:30 -   Num batches each epoch = 1
2023-05-15 11:11:12.414 | INFO     | hcpdiff.loggers.cli_logger:_info:30 -   Num Steps = 1000
2023-05-15 11:11:12.414 | INFO     | hcpdiff.loggers.cli_logger:_info:30 -   Instantaneous batch size per device = 4
2023-05-15 11:11:12.414 | INFO     | hcpdiff.loggers.cli_logger:_info:30 -   Total train batch size (w. parallel, distributed & accumulation) = 4
2023-05-15 11:11:12.414 | INFO     | hcpdiff.loggers.cli_logger:_info:30 -   Gradient Accumulation steps = 1
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Traceback (most recent call last) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/runpy.py:196 in _run_module_as_main                โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   193 โ”‚   main_globals = sys.modules["__main__"].__dict__                                        โ”‚
โ”‚   194 โ”‚   if alter_argv:                                                                         โ”‚
โ”‚   195 โ”‚   โ”‚   sys.argv[0] = mod_spec.origin                                                      โ”‚
โ”‚ โฑ 196 โ”‚   return _run_code(code, main_globals, None,                                             โ”‚
โ”‚   197 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚    "__main__", mod_spec)                                                 โ”‚
โ”‚   198                                                                                            โ”‚
โ”‚   199 def run_module(mod_name, init_globals=None,                                                โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/runpy.py:86 in _run_code                           โ”‚
โ”‚                                                                                                  โ”‚
โ”‚    83 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚      __loader__ = loader,                                                โ”‚
โ”‚    84 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚      __package__ = pkg_name,                                             โ”‚
โ”‚    85 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚      __spec__ = mod_spec)                                                โ”‚
โ”‚ โฑ  86 โ”‚   exec(code, run_globals)                                                                โ”‚
โ”‚    87 โ”‚   return run_globals                                                                     โ”‚
โ”‚    88                                                                                            โ”‚
โ”‚    89 def _run_module_code(code, init_globals=None,                                              โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/HCP-Diffusion/hcpdiff/train_ac_single.py:105 in <module>                              โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   102 โ”‚                                                                                          โ”‚
โ”‚   103 โ”‚   conf = load_config_with_cli(args.cfg, args_list=sys.argv[3:]) # skip --cfg             โ”‚
โ”‚   104 โ”‚   trainer=TrainerSingleCard(conf)                                                        โ”‚
โ”‚ โฑ 105 โ”‚   trainer.train()                                                                        โ”‚
โ”‚   106                                                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/HCP-Diffusion/hcpdiff/train_ac.py:409 in train                                        โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   406 โ”‚   โ”‚                                                                                      โ”‚
โ”‚   407 โ”‚   โ”‚   loss_sum = np.ones(30)                                                             โ”‚
โ”‚   408 โ”‚   โ”‚   for data_list in self.train_loader_group:                                          โ”‚
โ”‚ โฑ 409 โ”‚   โ”‚   โ”‚   loss = self.train_one_step(data_list)                                          โ”‚
โ”‚   410 โ”‚   โ”‚   โ”‚   loss_sum[self.global_step%len(loss_sum)] = loss                                โ”‚
โ”‚   411 โ”‚   โ”‚   โ”‚                                                                                  โ”‚
โ”‚   412 โ”‚   โ”‚   โ”‚   self.global_step += 1                                                          โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/HCP-Diffusion/hcpdiff/train_ac.py:501 in train_one_step                               โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   498 โ”‚   โ”‚   โ”‚   โ”‚   other_datas = {k:v.to(self.device, dtype=self.weight_dtype) for k, v in    โ”‚
โ”‚   499 โ”‚   โ”‚   โ”‚   โ”‚                                                                              โ”‚
โ”‚   500 โ”‚   โ”‚   โ”‚   โ”‚   latents = self.get_latents(image, self.train_loader_group.get_dataset(id   โ”‚
โ”‚ โฑ 501 โ”‚   โ”‚   โ”‚   โ”‚   model_pred, target, timesteps = self.forward(latents, prompt_ids, **othe   โ”‚
โ”‚   502 โ”‚   โ”‚   โ”‚   โ”‚   loss = self.get_loss(model_pred, target, timesteps, att_mask) * self.tra   โ”‚
โ”‚   503 โ”‚   โ”‚   โ”‚   โ”‚   self.accelerator.backward(loss)                                            โ”‚
โ”‚   504                                                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/HCP-Diffusion/hcpdiff/train_ac.py:479 in forward                                      โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   476 โ”‚   โ”‚                                                                                      โ”‚
โ”‚   477 โ”‚   โ”‚   # CFG context for DreamArtist                                                      โ”‚
โ”‚   478 โ”‚   โ”‚   noisy_latents, timesteps = self.cfg_context.pre(noisy_latents, timesteps)          โ”‚
โ”‚ โฑ 479 โ”‚   โ”‚   model_pred = self.encode_decode(prompt_ids, noisy_latents, timesteps, **kwargs)    โ”‚
โ”‚   480 โ”‚   โ”‚   model_pred = self.cfg_context.post(model_pred)                                     โ”‚
โ”‚   481 โ”‚   โ”‚                                                                                      โ”‚
โ”‚   482 โ”‚   โ”‚   # Get the target for loss depending on the prediction type                         โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/HCP-Diffusion/hcpdiff/train_ac_single.py:78 in encode_decode                          โ”‚
โ”‚                                                                                                  โ”‚
โ”‚    75 โ”‚   โ”‚   โ”‚   โ”‚   feeder(input_all)                                                          โ”‚
โ”‚    76 โ”‚   โ”‚                                                                                      โ”‚
โ”‚    77 โ”‚   โ”‚   encoder_hidden_states = self.text_encoder(prompt_ids, output_hidden_states=True)   โ”‚
โ”‚ โฑ  78 โ”‚   โ”‚   model_pred = self.unet(noisy_latents, timesteps, encoder_hidden_states).sample     โ”‚
โ”‚    79 โ”‚   โ”‚   return model_pred                                                                  โ”‚
โ”‚    80 โ”‚                                                                                          โ”‚
โ”‚    81 โ”‚   def get_loss(self, model_pred, target, timesteps, att_mask):                           โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/torch/nn/modules/module.py:1130 in   โ”‚
โ”‚ _call_impl                                                                                       โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   1127 โ”‚   โ”‚   # this function, and just call forward.                                           โ”‚
โ”‚   1128 โ”‚   โ”‚   if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks o  โ”‚
โ”‚   1129 โ”‚   โ”‚   โ”‚   โ”‚   or _global_forward_hooks or _global_forward_pre_hooks):                   โ”‚
โ”‚ โฑ 1130 โ”‚   โ”‚   โ”‚   return forward_call(*input, **kwargs)                                         โ”‚
โ”‚   1131 โ”‚   โ”‚   # Do not call functions when jit is used                                          โ”‚
โ”‚   1132 โ”‚   โ”‚   full_backward_hooks, non_full_backward_hooks = [], []                             โ”‚
โ”‚   1133 โ”‚   โ”‚   if self._backward_hooks or _global_backward_hooks:                                โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/accelerate/utils/operations.py:521   โ”‚
โ”‚ in forward                                                                                       โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   518 โ”‚   model_forward = ConvertOutputsToFp32(model_forward)                                    โ”‚
โ”‚   519 โ”‚                                                                                          โ”‚
โ”‚   520 โ”‚   def forward(*args, **kwargs):                                                          โ”‚
โ”‚ โฑ 521 โ”‚   โ”‚   return model_forward(*args, **kwargs)                                              โ”‚
โ”‚   522 โ”‚                                                                                          โ”‚
โ”‚   523 โ”‚   # To act like a decorator so that it can be popped when doing `extract_model_from_pa   โ”‚
โ”‚   524 โ”‚   forward.__wrapped__ = model_forward                                                    โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/accelerate/utils/operations.py:509   โ”‚
โ”‚ in __call__                                                                                      โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   506 โ”‚   โ”‚   update_wrapper(self, model_forward)                                                โ”‚
โ”‚   507 โ”‚                                                                                          โ”‚
โ”‚   508 โ”‚   def __call__(self, *args, **kwargs):                                                   โ”‚
โ”‚ โฑ 509 โ”‚   โ”‚   return convert_to_fp32(self.model_forward(*args, **kwargs))                        โ”‚
โ”‚   510 โ”‚                                                                                          โ”‚
โ”‚   511 โ”‚   def __getstate__(self):                                                                โ”‚
โ”‚   512 โ”‚   โ”‚   raise pickle.PicklingError(                                                        โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/torch/amp/autocast_mode.py:12 in     โ”‚
โ”‚ decorate_autocast                                                                                โ”‚
โ”‚                                                                                                  โ”‚
โ”‚     9 โ”‚   @functools.wraps(func)                                                                 โ”‚
โ”‚    10 โ”‚   def decorate_autocast(*args, **kwargs):                                                โ”‚
โ”‚    11 โ”‚   โ”‚   with autocast_instance:                                                            โ”‚
โ”‚ โฑ  12 โ”‚   โ”‚   โ”‚   return func(*args, **kwargs)                                                   โ”‚
โ”‚    13 โ”‚   decorate_autocast.__script_unsupported = '@autocast() decorator is not supported in    โ”‚
โ”‚    14 โ”‚   return decorate_autocast                                                               โ”‚
โ”‚    15                                                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/diffusers/models/unet_2d_condition.p โ”‚
โ”‚ y:724 in forward                                                                                 โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   721 โ”‚   โ”‚   down_block_res_samples = (sample,)                                                 โ”‚
โ”‚   722 โ”‚   โ”‚   for downsample_block in self.down_blocks:                                          โ”‚
โ”‚   723 โ”‚   โ”‚   โ”‚   if hasattr(downsample_block, "has_cross_attention") and downsample_block.has   โ”‚
โ”‚ โฑ 724 โ”‚   โ”‚   โ”‚   โ”‚   sample, res_samples = downsample_block(                                    โ”‚
โ”‚   725 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   hidden_states=sample,                                                  โ”‚
โ”‚   726 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   temb=emb,                                                              โ”‚
โ”‚   727 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   encoder_hidden_states=encoder_hidden_states,                           โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/torch/nn/modules/module.py:1130 in   โ”‚
โ”‚ _call_impl                                                                                       โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   1127 โ”‚   โ”‚   # this function, and just call forward.                                           โ”‚
โ”‚   1128 โ”‚   โ”‚   if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks o  โ”‚
โ”‚   1129 โ”‚   โ”‚   โ”‚   โ”‚   or _global_forward_hooks or _global_forward_pre_hooks):                   โ”‚
โ”‚ โฑ 1130 โ”‚   โ”‚   โ”‚   return forward_call(*input, **kwargs)                                         โ”‚
โ”‚   1131 โ”‚   โ”‚   # Do not call functions when jit is used                                          โ”‚
โ”‚   1132 โ”‚   โ”‚   full_backward_hooks, non_full_backward_hooks = [], []                             โ”‚
โ”‚   1133 โ”‚   โ”‚   if self._backward_hooks or _global_backward_hooks:                                โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/diffusers/models/unet_2d_blocks.py:8 โ”‚
โ”‚ 59 in forward                                                                                    โ”‚
โ”‚                                                                                                  โ”‚
โ”‚    856 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   return custom_forward                                                 โ”‚
โ”‚    857 โ”‚   โ”‚   โ”‚   โ”‚                                                                             โ”‚
โ”‚    858 โ”‚   โ”‚   โ”‚   โ”‚   hidden_states = torch.utils.checkpoint.checkpoint(create_custom_forward(  โ”‚
โ”‚ โฑ  859 โ”‚   โ”‚   โ”‚   โ”‚   hidden_states = torch.utils.checkpoint.checkpoint(                        โ”‚
โ”‚    860 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   create_custom_forward(attn, return_dict=False),                       โ”‚
โ”‚    861 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   hidden_states,                                                        โ”‚
โ”‚    862 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   encoder_hidden_states,                                                โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/HCP-Diffusion/hcpdiff/train_ac.py:48 in checkpoint_fix                                โ”‚
โ”‚                                                                                                  โ”‚
โ”‚    45 # fix checkpoint bug for train part of model                                               โ”‚
โ”‚    46 import torch.utils.checkpoint                                                              โ”‚
โ”‚    47 def checkpoint_fix(function, *args, use_reentrant: bool = False, checkpoint_raw = torch.   โ”‚
โ”‚ โฑ  48 โ”‚   return checkpoint_raw(function, *args, use_reentrant=use_reentrant, **kwargs)          โ”‚
โ”‚    49 torch.utils.checkpoint.checkpoint = checkpoint_fix                                         โ”‚
โ”‚    50                                                                                            โ”‚
โ”‚    51 class Trainer:                                                                             โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/torch/utils/checkpoint.py:237 in     โ”‚
โ”‚ checkpoint                                                                                       โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   234 โ”‚   if use_reentrant:                                                                      โ”‚
โ”‚   235 โ”‚   โ”‚   return CheckpointFunction.apply(function, preserve, *args)                         โ”‚
โ”‚   236 โ”‚   else:                                                                                  โ”‚
โ”‚ โฑ 237 โ”‚   โ”‚   return _checkpoint_without_reentrant(                                              โ”‚
โ”‚   238 โ”‚   โ”‚   โ”‚   function,                                                                      โ”‚
โ”‚   239 โ”‚   โ”‚   โ”‚   preserve,                                                                      โ”‚
โ”‚   240 โ”‚   โ”‚   โ”‚   *args                                                                          โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/torch/utils/checkpoint.py:383 in     โ”‚
โ”‚ _checkpoint_without_reentrant                                                                    โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   380 โ”‚   โ”‚   return storage.pop(x)                                                              โ”‚
โ”‚   381 โ”‚                                                                                          โ”‚
โ”‚   382 โ”‚   with torch.autograd.graph.saved_tensors_hooks(pack, unpack):                           โ”‚
โ”‚ โฑ 383 โ”‚   โ”‚   output = function(*args)                                                           โ”‚
โ”‚   384 โ”‚   โ”‚   if torch.cuda._initialized and preserve_rng_state and not had_cuda_in_fwd:         โ”‚
โ”‚   385 โ”‚   โ”‚   โ”‚   # Cuda was not initialized before running the forward, so we didn't            โ”‚
โ”‚   386 โ”‚   โ”‚   โ”‚   # stash the CUDA state.                                                        โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/diffusers/models/unet_2d_blocks.py:8 โ”‚
โ”‚ 52 in custom_forward                                                                             โ”‚
โ”‚                                                                                                  โ”‚
โ”‚    849 โ”‚   โ”‚   โ”‚   โ”‚   def create_custom_forward(module, return_dict=None):                      โ”‚
โ”‚    850 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   def custom_forward(*inputs):                                          โ”‚
โ”‚    851 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   if return_dict is not None:                                       โ”‚
โ”‚ โฑ  852 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   return module(*inputs, return_dict=return_dict)               โ”‚
โ”‚    853 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   else:                                                             โ”‚
โ”‚    854 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   return module(*inputs)                                        โ”‚
โ”‚    855                                                                                           โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/torch/nn/modules/module.py:1130 in   โ”‚
โ”‚ _call_impl                                                                                       โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   1127 โ”‚   โ”‚   # this function, and just call forward.                                           โ”‚
โ”‚   1128 โ”‚   โ”‚   if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks o  โ”‚
โ”‚   1129 โ”‚   โ”‚   โ”‚   โ”‚   or _global_forward_hooks or _global_forward_pre_hooks):                   โ”‚
โ”‚ โฑ 1130 โ”‚   โ”‚   โ”‚   return forward_call(*input, **kwargs)                                         โ”‚
โ”‚   1131 โ”‚   โ”‚   # Do not call functions when jit is used                                          โ”‚
โ”‚   1132 โ”‚   โ”‚   full_backward_hooks, non_full_backward_hooks = [], []                             โ”‚
โ”‚   1133 โ”‚   โ”‚   if self._backward_hooks or _global_backward_hooks:                                โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/diffusers/models/transformer_2d.py:2 โ”‚
โ”‚ 65 in forward                                                                                    โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   262 โ”‚   โ”‚                                                                                      โ”‚
โ”‚   263 โ”‚   โ”‚   # 2. Blocks                                                                        โ”‚
โ”‚   264 โ”‚   โ”‚   for block in self.transformer_blocks:                                              โ”‚
โ”‚ โฑ 265 โ”‚   โ”‚   โ”‚   hidden_states = block(                                                         โ”‚
โ”‚   266 โ”‚   โ”‚   โ”‚   โ”‚   hidden_states,                                                             โ”‚
โ”‚   267 โ”‚   โ”‚   โ”‚   โ”‚   encoder_hidden_states=encoder_hidden_states,                               โ”‚
โ”‚   268 โ”‚   โ”‚   โ”‚   โ”‚   timestep=timestep,                                                         โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/torch/nn/modules/module.py:1130 in   โ”‚
โ”‚ _call_impl                                                                                       โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   1127 โ”‚   โ”‚   # this function, and just call forward.                                           โ”‚
โ”‚   1128 โ”‚   โ”‚   if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks o  โ”‚
โ”‚   1129 โ”‚   โ”‚   โ”‚   โ”‚   or _global_forward_hooks or _global_forward_pre_hooks):                   โ”‚
โ”‚ โฑ 1130 โ”‚   โ”‚   โ”‚   return forward_call(*input, **kwargs)                                         โ”‚
โ”‚   1131 โ”‚   โ”‚   # Do not call functions when jit is used                                          โ”‚
โ”‚   1132 โ”‚   โ”‚   full_backward_hooks, non_full_backward_hooks = [], []                             โ”‚
โ”‚   1133 โ”‚   โ”‚   if self._backward_hooks or _global_backward_hooks:                                โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/diffusers/models/attention.py:331 in โ”‚
โ”‚ forward                                                                                          โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   328 โ”‚   โ”‚   โ”‚   # TODO (Birch-San): Here we should prepare the encoder_attention mask correc   โ”‚
โ”‚   329 โ”‚   โ”‚   โ”‚   # prepare attention mask here                                                  โ”‚
โ”‚   330 โ”‚   โ”‚   โ”‚                                                                                  โ”‚
โ”‚ โฑ 331 โ”‚   โ”‚   โ”‚   attn_output = self.attn2(                                                      โ”‚
โ”‚   332 โ”‚   โ”‚   โ”‚   โ”‚   norm_hidden_states,                                                        โ”‚
โ”‚   333 โ”‚   โ”‚   โ”‚   โ”‚   encoder_hidden_states=encoder_hidden_states,                               โ”‚
โ”‚   334 โ”‚   โ”‚   โ”‚   โ”‚   attention_mask=encoder_attention_mask,                                     โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/torch/nn/modules/module.py:1130 in   โ”‚
โ”‚ _call_impl                                                                                       โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   1127 โ”‚   โ”‚   # this function, and just call forward.                                           โ”‚
โ”‚   1128 โ”‚   โ”‚   if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks o  โ”‚
โ”‚   1129 โ”‚   โ”‚   โ”‚   โ”‚   or _global_forward_hooks or _global_forward_pre_hooks):                   โ”‚
โ”‚ โฑ 1130 โ”‚   โ”‚   โ”‚   return forward_call(*input, **kwargs)                                         โ”‚
โ”‚   1131 โ”‚   โ”‚   # Do not call functions when jit is used                                          โ”‚
โ”‚   1132 โ”‚   โ”‚   full_backward_hooks, non_full_backward_hooks = [], []                             โ”‚
โ”‚   1133 โ”‚   โ”‚   if self._backward_hooks or _global_backward_hooks:                                โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/diffusers/models/attention_processor โ”‚
โ”‚ .py:267 in forward                                                                               โ”‚
โ”‚                                                                                                  โ”‚
โ”‚    264 โ”‚   โ”‚   # The `Attention` class can call different attention processors / attention func  โ”‚
โ”‚    265 โ”‚   โ”‚   # here we simply pass along all tensors to the selected processor class           โ”‚
โ”‚    266 โ”‚   โ”‚   # For standard processors that are defined here, `**cross_attention_kwargs` is e  โ”‚
โ”‚ โฑ  267 โ”‚   โ”‚   return self.processor(                                                            โ”‚
โ”‚    268 โ”‚   โ”‚   โ”‚   self,                                                                         โ”‚
โ”‚    269 โ”‚   โ”‚   โ”‚   hidden_states,                                                                โ”‚
โ”‚    270 โ”‚   โ”‚   โ”‚   encoder_hidden_states=encoder_hidden_states,                                  โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/diffusers/models/attention_processor โ”‚
โ”‚ .py:696 in __call__                                                                              โ”‚
โ”‚                                                                                                  โ”‚
โ”‚    693 โ”‚   โ”‚   key = attn.head_to_batch_dim(key).contiguous()                                    โ”‚
โ”‚    694 โ”‚   โ”‚   value = attn.head_to_batch_dim(value).contiguous()                                โ”‚
โ”‚    695 โ”‚   โ”‚                                                                                     โ”‚
โ”‚ โฑ  696 โ”‚   โ”‚   hidden_states = xformers.ops.memory_efficient_attention(                          โ”‚
โ”‚    697 โ”‚   โ”‚   โ”‚   query, key, value, attn_bias=attention_mask, op=self.attention_op, scale=att  โ”‚
โ”‚    698 โ”‚   โ”‚   )                                                                                 โ”‚
โ”‚    699 โ”‚   โ”‚   hidden_states = hidden_states.to(query.dtype)                                     โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/xformers/ops/fmha/__init__.py:192 in โ”‚
โ”‚ memory_efficient_attention                                                                       โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   189 โ”‚   โ”‚   and options.                                                                       โ”‚
โ”‚   190 โ”‚   :return: multi-head attention Tensor with shape ``[B, Mq, H, Kv]``                     โ”‚
โ”‚   191 โ”‚   """                                                                                    โ”‚
โ”‚ โฑ 192 โ”‚   return _memory_efficient_attention(                                                    โ”‚
โ”‚   193 โ”‚   โ”‚   Inputs(                                                                            โ”‚
โ”‚   194 โ”‚   โ”‚   โ”‚   query=query, key=key, value=value, p=p, attn_bias=attn_bias, scale=scale       โ”‚
โ”‚   195 โ”‚   โ”‚   ),                                                                                 โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/xformers/ops/fmha/__init__.py:295 in โ”‚
โ”‚ _memory_efficient_attention                                                                      โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   292 โ”‚   โ”‚   )                                                                                  โ”‚
โ”‚   293 โ”‚                                                                                          โ”‚
โ”‚   294 โ”‚   output_shape = inp.normalize_bmhk()                                                    โ”‚
โ”‚ โฑ 295 โ”‚   return _fMHA.apply(                                                                    โ”‚
โ”‚   296 โ”‚   โ”‚   op, inp.query, inp.key, inp.value, inp.attn_bias, inp.p, inp.scale                 โ”‚
โ”‚   297 โ”‚   ).reshape(output_shape)                                                                โ”‚
โ”‚   298                                                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/xformers/ops/fmha/__init__.py:41 in  โ”‚
โ”‚ forward                                                                                          โ”‚
โ”‚                                                                                                  โ”‚
โ”‚    38 โ”‚   โ”‚   op_fw = op[0] if op is not None else None                                          โ”‚
โ”‚    39 โ”‚   โ”‚   op_bw = op[1] if op is not None else None                                          โ”‚
โ”‚    40 โ”‚   โ”‚                                                                                      โ”‚
โ”‚ โฑ  41 โ”‚   โ”‚   out, op_ctx = _memory_efficient_attention_forward_requires_grad(                   โ”‚
โ”‚    42 โ”‚   โ”‚   โ”‚   inp=inp, op=op_fw                                                              โ”‚
โ”‚    43 โ”‚   โ”‚   )                                                                                  โ”‚
โ”‚    44                                                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/xformers/ops/fmha/__init__.py:323 in โ”‚
โ”‚ _memory_efficient_attention_forward_requires_grad                                                โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   320 โ”‚   โ”‚   op = _dispatch_fw(inp)                                                             โ”‚
โ”‚   321 โ”‚   else:                                                                                  โ”‚
โ”‚   322 โ”‚   โ”‚   _ensure_op_supports_or_raise(ValueError, "memory_efficient_attention", op, inp)    โ”‚
โ”‚ โฑ 323 โ”‚   out = op.apply(inp, needs_gradient=True)                                               โ”‚
โ”‚   324 โ”‚   assert out[1] is not None                                                              โ”‚
โ”‚   325 โ”‚   return (out[0].reshape(output_shape), out[1])                                          โ”‚
โ”‚   326                                                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/xformers/ops/fmha/cutlass.py:175 in  โ”‚
โ”‚ apply                                                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   172 โ”‚   โ”‚   if type(inp.attn_bias) not in FwOp.SUPPORTED_ATTN_BIAS_TYPES:                      โ”‚
โ”‚   173 โ”‚   โ”‚   โ”‚   raise NotImplementedError("Unsupported attn_bias type")                        โ”‚
โ”‚   174 โ”‚   โ”‚   seqstart_k, seqstart_q, max_seqlen_q, _ = _get_seqlen_info(inp)                    โ”‚
โ”‚ โฑ 175 โ”‚   โ”‚   out, lse, rng_seed, rng_offset = cls.OPERATOR(                                     โ”‚
โ”‚   176 โ”‚   โ”‚   โ”‚   query=inp.query,                                                               โ”‚
โ”‚   177 โ”‚   โ”‚   โ”‚   key=inp.key,                                                                   โ”‚
โ”‚   178 โ”‚   โ”‚   โ”‚   value=inp.value,                                                               โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/torch/_ops.py:143 in __call__        โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   140 โ”‚   โ”‚   # is still callable from JIT                                                       โ”‚
โ”‚   141 โ”‚   โ”‚   # We save the function ptr as the `op` attribute on                                โ”‚
โ”‚   142 โ”‚   โ”‚   # OpOverloadPacket to access it here.                                              โ”‚
โ”‚ โฑ 143 โ”‚   โ”‚   return self._op(*args, **kwargs or {})                                             โ”‚
โ”‚   144 โ”‚                                                                                          โ”‚
โ”‚   145 โ”‚   # TODO: use this to make a __dir__                                                     โ”‚
โ”‚   146 โ”‚   def overloads(self):                                                                   โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
RuntimeError: Expected query.size(0) == key.size(0) to be true, but got false.  (Could this error message be improved?  If so, please
report an enhancement request to PyTorch.)
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Traceback (most recent call last) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ /data/yoke/anaconda3/envs/hcpd/bin/accelerate:8 in <module>                                      โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   5 from accelerate.commands.accelerate_cli import main                                          โ”‚
โ”‚   6 if __name__ == '__main__':                                                                   โ”‚
โ”‚   7 โ”‚   sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])                         โ”‚
โ”‚ โฑ 8 โ”‚   sys.exit(main())                                                                         โ”‚
โ”‚   9                                                                                              โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/accelerate/commands/accelerate_cli.p โ”‚
โ”‚ y:45 in main                                                                                     โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   42 โ”‚   โ”‚   exit(1)                                                                             โ”‚
โ”‚   43 โ”‚                                                                                           โ”‚
โ”‚   44 โ”‚   # Run                                                                                   โ”‚
โ”‚ โฑ 45 โ”‚   args.func(args)                                                                         โ”‚
โ”‚   46                                                                                             โ”‚
โ”‚   47                                                                                             โ”‚
โ”‚   48 if __name__ == "__main__":                                                                  โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/accelerate/commands/launch.py:918 in โ”‚
โ”‚ launch_command                                                                                   โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   915 โ”‚   elif defaults is not None and defaults.compute_environment == ComputeEnvironment.AMA   โ”‚
โ”‚   916 โ”‚   โ”‚   sagemaker_launcher(defaults, args)                                                 โ”‚
โ”‚   917 โ”‚   else:                                                                                  โ”‚
โ”‚ โฑ 918 โ”‚   โ”‚   simple_launcher(args)                                                              โ”‚
โ”‚   919                                                                                            โ”‚
โ”‚   920                                                                                            โ”‚
โ”‚   921 def main():                                                                                โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /data/yoke/anaconda3/envs/hcpd/lib/python3.10/site-packages/accelerate/commands/launch.py:580 in โ”‚
โ”‚ simple_launcher                                                                                  โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   577 โ”‚   process.wait()                                                                         โ”‚
โ”‚   578 โ”‚   if process.returncode != 0:                                                            โ”‚
โ”‚   579 โ”‚   โ”‚   if not args.quiet:                                                                 โ”‚
โ”‚ โฑ 580 โ”‚   โ”‚   โ”‚   raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)    โ”‚
โ”‚   581 โ”‚   โ”‚   else:                                                                              โ”‚
โ”‚   582 โ”‚   โ”‚   โ”‚   sys.exit(1)                                                                    โ”‚
โ”‚   583                                                                                            โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
CalledProcessError: Command '['/data/yoke/anaconda3/envs/hcpd/bin/python', '-m', 'hcpdiff.train_ac_single', '--cfg',
'cfgs/train/examples/DreamArtist++2.yaml']' returned non-zero exit status 1.

BUGreport:[Rank 0] Watchdog caught collective operation timeout

ๅ•ๆœบๅคšๅก่ฎญ็ปƒ่ฟ‡็จ‹ไธญๅ‡บ็Žฐaccelerate ProcessGroupNCCL ่ถ…ๆ—ถ้—ฎ้ข˜ใ€‚

ๅฝ“ๅ‰ไฝฟ็”จ่ฎญ็ปƒๅ‘ฝไปค๏ผš
torchrun --nproc_per_node 8 -m hcpdiff.train_colo --cfg cfgs/train/examples/fine-tuning.yaml

่ฎญ็ปƒ้…็ฝฎ๏ผš
base: [cfgs/train/train_base.yaml, cfgs/train/tuning_base.yaml]

      unet:
        -
          lr: 1e-6
          layers:
            - '' # fine-tuning all layers in unet
      
      ## fine-tuning text-encoder
      text_encoder:
       - lr: 1e-6
         layers:
           - ''
      
      tokenizer_pt:
        train: null
      
      train:
        gradient_accumulation_steps: 1
        save_step: 100
      
        scheduler:
          name: 'constant_with_warmup'
          num_warmup_steps: 50
          num_training_steps: 600
      
      model:
        pretrained_model_name_or_path: '/home/jovyan/data-vol-polefs-1/sd-webui/model/stable-diffusion-v1-5'
        tokenizer_repeats: 1
        ema_unet: 0
        ema_text_encoder: 0
      
      data:
        batch_size: 4
        prompt_template: 'prompt_tuning_template/object.txt'
        caption_file: null
        cache_latents: True
        tag_transforms:
          transforms:
            - _target_: hcpdiff.utils.caption_tools.TagShuffle
            - _target_: hcpdiff.utils.caption_tools.TagDropout
              p: 0.1
            - _target_: hcpdiff.utils.caption_tools.TemplateFill
              word_names: {}
        bucket:
          _target_: hcpdiff.data.bucket.RatioBucket.from_files # aspect ratio bucket
          img_root: '/home/jovyan/data-vol-polefs-1/sd-webui/Data/GOODONES/'
          target_area: {_target_: "builtins.eval", _args_: ['512*512']}
          num_bucket: 10
      
      data_class: null

ๆŠฅ้”™ๅ†…ๅฎน๏ผš

      [E ProcessGroupNCCL.cpp:821] [Rank 0] Watchdog caught collective operation timeout: WorkNCCL(SeqNum=106, OpType=ALLREDUCE, Timeout(ms)=1800000) ran for 1801455 milliseconds before timing out.
      [E ProcessGroupNCCL.cpp:456] Some NCCL operations have failed or timed out. Due to the asynchronous nature of CUDA kernels, subsequent GPU operations might run on corrupted/incomplete data.
      [E ProcessGroupNCCL.cpp:461] To avoid data inconsistency, we are taking the entire process down.
      terminate called after throwing an instance of 'std::runtime_error'
        what():  [Rank 0] Watchdog caught collective operation timeout: WorkNCCL(SeqNum=106, OpType=ALLREDUCE, Timeout(ms)=1800000) ran for 1801455 milliseconds before timing out.
      WARNING:torch.distributed.elastic.multiprocessing.api:Sending process 102175 closing signal SIGTERM
      WARNING:torch.distributed.elastic.multiprocessing.api:Sending process 102176 closing signal SIGTERM
      WARNING:torch.distributed.elastic.multiprocessing.api:Sending process 102177 closing signal SIGTERM
      WARNING:torch.distributed.elastic.multiprocessing.api:Sending process 102178 closing signal SIGTERM
      WARNING:torch.distributed.elastic.multiprocessing.api:Sending process 102179 closing signal SIGTERM
      WARNING:torch.distributed.elastic.multiprocessing.api:Sending process 102180 closing signal SIGTERM
      WARNING:torch.distributed.elastic.multiprocessing.api:Sending process 102181 closing signal SIGTERM
      ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: -6) local_rank: 0 (pid: 102174) of binary: /home/jovyan/miniconda3/envs/sd-webui2/bin/python
      Traceback (most recent call last):
        File "/home/jovyan/miniconda3/envs/sd-webui2/bin/torchrun", line 8, in <module>
          sys.exit(main())
        File "/home/jovyan/miniconda3/envs/sd-webui2/lib/python3.10/site-packages/torch/distributed/elastic/multiprocessing/errors/__init__.py", line 346, in wrapper
          return f(*args, **kwargs)
        File "/home/jovyan/miniconda3/envs/sd-webui2/lib/python3.10/site-packages/torch/distributed/run.py", line 762, in main
          run(args)
        File "/home/jovyan/miniconda3/envs/sd-webui2/lib/python3.10/site-packages/torch/distributed/run.py", line 753, in run
          elastic_launch(
        File "/home/jovyan/miniconda3/envs/sd-webui2/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 132, in __call__
          return launch_agent(self._config, self._entrypoint, list(args))
        File "/home/jovyan/miniconda3/envs/sd-webui2/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 246, in launch_agent
          raise ChildFailedError(
      torch.distributed.elastic.multiprocessing.errors.ChildFailedError: 
      =======================================================
      hcpdiff.train_colo FAILED
      -------------------------------------------------------
      Failures:
        <NO_OTHER_FAILURES>
      -------------------------------------------------------

=======================================================

้ขๅค–ๅ†…ๅฎน๏ผš
ๆŠฅ้”™ๅ‘็”Ÿๅœจ่ฎญ็ปƒ่ฟ›่กŒไธญๅกไฝๅคงๆฆ‚ๅŠๅฐๆ—ถๅŽๆŠฅ้”™ใ€‚

่ฎญ็ปƒๆ—ฅๅฟ—ๅฆ‚ไธ‹๏ผš
2023-04-21 17:46:45.897 | INFO | hcpdiff.train_ac:init:59 - world_size: 8
2023-04-21 17:46:45.897 | INFO | hcpdiff.train_ac:init:60 - accumulation: 1
2023-04-21 17:49:29.190 | INFO | hcpdiff.train_ac:build_data:265 - len(train_dataset): 352
2023-04-21 17:54:20.501 | INFO | hcpdiff.train_ac:train:338 - ***** Running training *****
2023-04-21 17:54:20.502 | INFO | hcpdiff.train_ac:train:339 - Num batches each epoch = 11
2023-04-21 17:54:20.504 | INFO | hcpdiff.train_ac:train:340 - Num Steps = 600
2023-04-21 17:54:20.504 | INFO | hcpdiff.train_ac:train:341 - Instantaneous batch size per device = 4
2023-04-21 17:54:20.505 | INFO | hcpdiff.train_ac:train:342 - Total train batch size (w. parallel, distributed & accumulation) = 32
2023-04-21 17:54:20.506 | INFO | hcpdiff.train_ac:train:343 - Gradient Accumulation steps = 1
2023-04-21 17:54:51.571 | INFO | hcpdiff.train_ac:train:363 - Step [20/600], LR_model: 1.28e-05, LR_word: 0.00e+00, Loss: 0.14078
2023-04-21 17:55:14.095 | INFO | hcpdiff.train_ac:train:363 - Step [40/600], LR_model: 2.56e-05, LR_word: 0.00e+00, Loss: 0.10552
2023-04-21 17:55:35.954 | INFO | hcpdiff.train_ac:train:363 - Step [60/600], LR_model: 3.20e-05, LR_word: 0.00e+00, Loss: 0.12115
2023-04-21 17:55:57.702 | INFO | hcpdiff.train_ac:train:363 - Step [80/600], LR_model: 3.20e-05, LR_word: 0.00e+00, Loss: 0.14846

Bug Report: Fine-tuning & Dreambooth collapse when using multi-gpus

2023-04-17 16:36:29.428 | INFO     | __main__:build_data:283 - len(train_dataset): 40
100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 40/40 [00:08<00:00,  4.65it/s]
2023-04-17 16:36:41.156 | INFO     | __main__:train:355 - ***** Running training *****
2023-04-17 16:36:41.157 | INFO     | __main__:train:356 -   Num batches each epoch = 2
2023-04-17 16:36:41.157 | INFO     | __main__:train:357 -   Num Steps = 20000
2023-04-17 16:36:41.157 | INFO     | __main__:train:358 -   Instantaneous batch size per device = 1
2023-04-17 16:36:41.157 | INFO     | __main__:train:359 -   Total train batch size (w. parallel, distributed & accumulation) = 5
2023-04-17 16:36:41.157 | INFO     | __main__:train:360 -   Gradient Accumulation steps = 1
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Traceback (most recent call last) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ /home/yabin/miniconda3/envs/hcp/lib/python3.10/runpy.py:196 in _run_module_as_main               โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   193 โ”‚   main_globals = sys.modules["__main__"].__dict__                                        โ”‚
โ”‚   194 โ”‚   if alter_argv:                                                                         โ”‚
โ”‚   195 โ”‚   โ”‚   sys.argv[0] = mod_spec.origin                                                      โ”‚
โ”‚ โฑ 196 โ”‚   return _run_code(code, main_globals, None,                                             โ”‚
โ”‚   197 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚    "__main__", mod_spec)                                                 โ”‚
โ”‚   198                                                                                            โ”‚
โ”‚   199 def run_module(mod_name, init_globals=None,                                                โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/yabin/miniconda3/envs/hcp/lib/python3.10/runpy.py:86 in _run_code                          โ”‚
โ”‚                                                                                                  โ”‚
โ”‚    83 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚      __loader__ = loader,                                                โ”‚
โ”‚    84 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚      __package__ = pkg_name,                                             โ”‚
โ”‚    85 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚      __spec__ = mod_spec)                                                โ”‚
โ”‚ โฑ  86 โ”‚   exec(code, run_globals)                                                                โ”‚
โ”‚    87 โ”‚   return run_globals                                                                     โ”‚
โ”‚    88                                                                                            โ”‚
โ”‚    89 def _run_module_code(code, init_globals=None,                                              โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/yabin/HCP-Diffusion/hcpdiff/train_ac.py:532 in <module>                                    โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   529 โ”‚                                                                                          โ”‚
โ”‚   530 โ”‚   conf = load_config_with_cli(args.cfg, args_list=sys.argv[3:]) # skip --cfg             โ”‚
โ”‚   531 โ”‚   trainer=Trainer(conf)                                                                  โ”‚
โ”‚ โฑ 532 โ”‚   trainer.train()                                                                        โ”‚
โ”‚   533                                                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/yabin/HCP-Diffusion/hcpdiff/train_ac.py:370 in train                                       โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   367 โ”‚   โ”‚                                                                                      โ”‚
โ”‚   368 โ”‚   โ”‚   loss_sum=0                                                                         โ”‚
โ”‚   369 โ”‚   โ”‚   for image, att_mask, prompt_ids in cycle_data(self.train_loader, arb=self.arb_is   โ”‚
โ”‚ โฑ 370 โ”‚   โ”‚   โ”‚   loss=self.train_one_step(image, att_mask, prompt_ids)                          โ”‚
โ”‚   371 โ”‚   โ”‚   โ”‚   loss_sum+=loss                                                                 โ”‚
โ”‚   372 โ”‚   โ”‚   โ”‚                                                                                  โ”‚
โ”‚   373 โ”‚   โ”‚   โ”‚   self.global_step += 1                                                          โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/yabin/HCP-Diffusion/hcpdiff/train_ac.py:463 in train_one_step                              โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   460 โ”‚   โ”‚   โ”‚   else:                                                                          โ”‚
โ”‚   461 โ”‚   โ”‚   โ”‚   โ”‚   loss = self.get_loss(model_pred, target, att_mask)                         โ”‚
โ”‚   462 โ”‚   โ”‚   โ”‚                                                                                  โ”‚
โ”‚ โฑ 463 โ”‚   โ”‚   โ”‚   self.accelerator.backward(loss)                                                โ”‚
โ”‚   464 โ”‚   โ”‚   โ”‚                                                                                  โ”‚
โ”‚   465 โ”‚   โ”‚   โ”‚   if hasattr(self, 'optimizer'):                                                 โ”‚
โ”‚   466 โ”‚   โ”‚   โ”‚   โ”‚   if self.accelerator.sync_gradients: # fine-tuning                          โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/yabin/miniconda3/envs/hcp/lib/python3.10/site-packages/accelerate/accelerator.py:1681 in   โ”‚
โ”‚ backward                                                                                         โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   1678 โ”‚   โ”‚   elif self.distributed_type == DistributedType.MEGATRON_LM:                        โ”‚
โ”‚   1679 โ”‚   โ”‚   โ”‚   return                                                                        โ”‚
โ”‚   1680 โ”‚   โ”‚   elif self.scaler is not None:                                                     โ”‚
โ”‚ โฑ 1681 โ”‚   โ”‚   โ”‚   self.scaler.scale(loss).backward(**kwargs)                                    โ”‚
โ”‚   1682 โ”‚   โ”‚   else:                                                                             โ”‚
โ”‚   1683 โ”‚   โ”‚   โ”‚   loss.backward(**kwargs)                                                       โ”‚
โ”‚   1684                                                                                           โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/yabin/miniconda3/envs/hcp/lib/python3.10/site-packages/torch/_tensor.py:487 in backward    โ”‚
โ”‚                                                                                                  โ”‚
โ”‚    484 โ”‚   โ”‚   โ”‚   โ”‚   create_graph=create_graph,                                                โ”‚
โ”‚    485 โ”‚   โ”‚   โ”‚   โ”‚   inputs=inputs,                                                            โ”‚
โ”‚    486 โ”‚   โ”‚   โ”‚   )                                                                             โ”‚
โ”‚ โฑ  487 โ”‚   โ”‚   torch.autograd.backward(                                                          โ”‚
โ”‚    488 โ”‚   โ”‚   โ”‚   self, gradient, retain_graph, create_graph, inputs=inputs                     โ”‚
โ”‚    489 โ”‚   โ”‚   )                                                                                 โ”‚
โ”‚    490                                                                                           โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/yabin/miniconda3/envs/hcp/lib/python3.10/site-packages/torch/autograd/__init__.py:200 in   โ”‚
โ”‚ backward                                                                                         โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   197 โ”‚   # The reason we repeat same the comment below is that                                  โ”‚
โ”‚   198 โ”‚   # some Python versions print out the first line of a multi-line function               โ”‚
โ”‚   199 โ”‚   # calls in the traceback and some print out the last line                              โ”‚
โ”‚ โฑ 200 โ”‚   Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the bac   โ”‚
โ”‚   201 โ”‚   โ”‚   tensors, grad_tensors_, retain_graph, create_graph, inputs,                        โ”‚
โ”‚   202 โ”‚   โ”‚   allow_unreachable=True, accumulate_grad=True)  # Calls into the C++ engine to ru   โ”‚
โ”‚   203                                                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/yabin/miniconda3/envs/hcp/lib/python3.10/site-packages/torch/autograd/function.py:274 in   โ”‚
โ”‚ apply                                                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   271 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚      "Function is not allowed. You should only implement one "   โ”‚
โ”‚   272 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚      "of them.")                                                 โ”‚
โ”‚   273 โ”‚   โ”‚   user_fn = vjp_fn if vjp_fn is not Function.vjp else backward_fn                    โ”‚
โ”‚ โฑ 274 โ”‚   โ”‚   return user_fn(self, *args)                                                        โ”‚
โ”‚   275 โ”‚                                                                                          โ”‚
โ”‚   276 โ”‚   def apply_jvp(self, *args):                                                            โ”‚
โ”‚   277 โ”‚   โ”‚   # _forward_cls is defined by derived class                                         โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/yabin/miniconda3/envs/hcp/lib/python3.10/site-packages/torch/utils/checkpoint.py:157 in    โ”‚
โ”‚ backward                                                                                         โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   154 โ”‚   โ”‚   โ”‚   raise RuntimeError(                                                            โ”‚
โ”‚   155 โ”‚   โ”‚   โ”‚   โ”‚   "none of output has requires_grad=True,"                                   โ”‚
โ”‚   156 โ”‚   โ”‚   โ”‚   โ”‚   " this checkpoint() is not necessary")                                     โ”‚
โ”‚ โฑ 157 โ”‚   โ”‚   torch.autograd.backward(outputs_with_grad, args_with_grad)                         โ”‚
โ”‚   158 โ”‚   โ”‚   grads = tuple(inp.grad if isinstance(inp, torch.Tensor) else None                  โ”‚
โ”‚   159 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚     for inp in detached_inputs)                                          โ”‚
โ”‚   160                                                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/yabin/miniconda3/envs/hcp/lib/python3.10/site-packages/torch/autograd/__init__.py:200 in   โ”‚
โ”‚ backward                                                                                         โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   197 โ”‚   # The reason we repeat same the comment below is that                                  โ”‚
โ”‚   198 โ”‚   # some Python versions print out the first line of a multi-line function               โ”‚
โ”‚   199 โ”‚   # calls in the traceback and some print out the last line                              โ”‚
โ”‚ โฑ 200 โ”‚   Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the bac   โ”‚
โ”‚   201 โ”‚   โ”‚   tensors, grad_tensors_, retain_graph, create_graph, inputs,                        โ”‚
โ”‚   202 โ”‚   โ”‚   allow_unreachable=True, accumulate_grad=True)  # Calls into the C++ engine to ru   โ”‚
โ”‚   203                                                                                            โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
RuntimeError: Expected to mark a variable ready only once. This error is caused by one of the following
reasons: 1) Use of a module parameter outside the `forward` function. Please make sure model parameters are
not shared across multiple concurrent forward-backward passes. or try to use _set_static_graph() as a
workaround if this module graph does not change during training loop.2) Reused parameters in multiple
reentrant backward passes. For example, if you use multiple `checkpoint` functions to wrap the same part of
your model, it would result in the same set of parameters been used by different reentrant backward passes
multiple times, and hence marking a variable ready multiple times. DDP does not support such use cases in
default. You can try to use _set_static_graph() as a workaround if your module graph does not change over
iterations.
Parameter at index 598 has been marked as ready twice. This means that multiple autograd engine  hooks have
fired for this particular parameter during this iteration. You can set the environment variable
TORCH_DISTRIBUTED_DEBUG to either INFO or DETAIL to print parameter names for further debugging.

Config files I use:

_base_: [cfgs/train/train_base.yaml, cfgs/train/tuning_base.yaml]

unet:
  -
    lr: 1e-6
    layers:
      - ''

text_encoder:
  - lr: 1e-6
    layers:
      - ''

lora_unet: null
lora_text_encoder: null

tokenizer_pt:
  train: null

train:
  gradient_accumulation_steps: 1
  save_step: 100

  scheduler:
    name: 'constant_with_warmup'
    num_warmup_steps: 50
    num_training_steps: 600

model:
  pretrained_model_name_or_path: 'runwayml/stable-diffusion-v1-5'
  tokenizer_repeats: 1
  ema_unet: 0
  ema_text_encoder: 0
  enable_xformers: False

data:
  batch_size: 1
  prompt_template: 'prompt_tuning_template/object.txt'
  caption_file: null
  cache_latents: True
  tag_transforms:
    transforms:
      - _target_: hcpdiff.utils.caption_tools.TagShuffle
      - _target_: hcpdiff.utils.caption_tools.TagDropout
        p: 0.1
      - _target_: hcpdiff.utils.caption_tools.TemplateFill
        word_names:
          pt1: sks
          class: dog
  bucket:
    _target_: hcpdiff.data.bucket.RatioBucket.from_files
    img_root: '/home/yabin/datasets/custom/enma_ai/'
    target_area: {_target_: "builtins.eval", _args_: ['512*512']}
    num_bucket: 1

data_class:
  null
_base_: [cfgs/train/train_base.yaml, cfgs/train/tuning_base.yaml]

unet:
  - lr: 1e-6
    layers:
      - '' # fine-tuning all layers in unet

# fine-tuning text-encoder
text_encoder:
  - lr: 1e-6
    layers:
      - ''

tokenizer_pt:
  train: null

train:
  gradient_accumulation_steps: 1
  save_step: 100

  scheduler:
    name: 'constant_with_warmup'
    num_warmup_steps: 500
    num_training_steps: 20000

model:
  pretrained_model_name_or_path: 'stabilityai/stable-diffusion-2-1'
#  pretrained_model_name_or_path: '/home/yabin/HCP-Diffusion/converted_models/realismengine'
  tokenizer_repeats: 1
  ema_unet: 0
  ema_text_encoder: 0
  enable_xformers: False

data:
  batch_size: 1
  prompt_template: 'prompt_tuning_template/object.txt'
  caption_file: null
  cache_latents: True
  tag_transforms:
    transforms:
      - _target_: hcpdiff.utils.caption_tools.TagShuffle
      - _target_: hcpdiff.utils.caption_tools.TagDropout
        p: 0.1
      - _target_: hcpdiff.utils.caption_tools.TemplateFill
        word_names: {}
  bucket:
    _target_: hcpdiff.data.bucket.RatioBucket.from_files # aspect ratio bucket
    img_root: '/home/yabin/datasets/custom/enma_ai/'
    target_area: {_target_: "builtins.eval", _args_: ['1024*1024']}
    num_bucket: 1

data_class: null

Single card training and multi-gpu training with LoRA work fine.

ๅญฆไน ๆ–‡ๆกฃ็คบไพ‹๏ผŒWEBUIๆ ผๅผๆจกๅž‹่ฝฌๆขๆŠฅ้”™๏ผšUnpicklingError: invalid load key, '\xa0'.

็”จ็š„ๆ˜ฏๆ–‡ๆกฃ็š„็คบไพ‹
https://hcpdiff.readthedocs.io/zh-cn/latest/user_guides/model_convert.html

ๆœ€็ปˆๆŠฅ้”™๏ผš

magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '\xa0'.

windows ็ณป็ปŸ๏ผŒ
HCP-Diffusion็‰ˆๆœฌ๏ผšcommit 9573c9b
Date: Tue Nov 14 20:47:31 2023 +0800

ๆƒ…ๅ†ต่ฏดๆ˜Žๅฆ‚ไธ‹๏ผŒๆˆ‘git clone HCP-Diffusionไน‹ๅŽ๏ผŒ็”จpython -m venv venv ๆ–ฐๅปบ่™šๆ‹Ÿ็Žฏๅขƒ๏ผŒ็„ถๅŽๆฟ€ๆดป่™šๆ‹Ÿ็Žฏๅขƒ๏ผŒ่พ“ๅ…ฅๆ–‡ๆกฃ็š„ไปฃ็ ๏ผŒ
ๅนถๅฐ†ๅ…ถไธญๆจกๅž‹็›ฎๅฝ•ๆขๆˆๆˆ‘่‡ชๅทฑ็š„ใ€‚
ๅฎƒ่ฟ™ไธชๆŠฅ้”™๏ผŒ ๆ˜ฏๆˆ‘่พ“ๅ…ฅ็š„ๅ‚ๆ•ฐๆœ‰้—ฎ้ข˜ๅ˜›๏ผŸ

ๅฎŒๆ•ดไปฃ็ ๅฆ‚ไธ‹๏ผš

(venv) E:\AI\HCP-diffusion\HCP-Diffusion-webui\HCP-Diffusion>python -m hcpdiff.tools.sd2diffusers ^
More? --checkpoint_path "E:\AI\HCP-diffusion\erwin-demo\SD_to_Diffuse_Model\CKPT\meinamix_meinaV11.safetensors" ^
More? --original_config_file "E:\AI\HCP-diffusion\erwin-demo\SD_to_Diffuse_Model\SD1.5-v1-inference.yaml" ^
More? --dump_path "E:\AI\HCP-diffusion\erwin-demo\SD_to_Diffuse_Model\Diffuse_Output"
A matching Triton is not available, some optimizations will not be enabled.
Error caught was: No module named 'triton'
wandb is not available
Traceback (most recent call last):
  File "C:\Users\erwin\.pyenv\pyenv-win\versions\3.10.9\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\erwin\.pyenv\pyenv-win\versions\3.10.9\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "E:\AI\HCP-diffusion\HCP-Diffusion-webui\HCP-Diffusion\hcpdiff\tools\sd2diffusers.py", line 385, in <module>
    convert_ckpt(args)
  File "E:\AI\HCP-diffusion\HCP-Diffusion-webui\HCP-Diffusion\hcpdiff\tools\sd2diffusers.py", line 212, in convert_ckpt
    pipe = load_sd_ckpt(
  File "C:\Users\erwin\.pyenv\pyenv-win\versions\3.10.9\lib\site-packages\diffusers\pipelines\stable_diffusion\convert_from_ckpt.py", line 1258, in download_from_original_stable_diffusion_ckpt
    checkpoint = torch.load(checkpoint_path_or_dict, map_location=device)
  File "C:\Users\erwin\.pyenv\pyenv-win\versions\3.10.9\lib\site-packages\torch\serialization.py", line 1028, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "C:\Users\erwin\.pyenv\pyenv-win\versions\3.10.9\lib\site-packages\torch\serialization.py", line 1246, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '\xa0'.

RuntimeError: unscale_() has already been called on this optimizer since the last update().

I'm trying to train a lora with multiple embeddings, but I keep getting this error. I have tried to change a bunch of stuff in the YAML configuration to see if I could get any futher, but I haven't been able to get past this error. Any ideas on what is going wrong?
Contents of hcp-test folder: settings.zip

PS R:\lora-test\hcp-test> accelerate launch -m hcpdiff.train_ac_single --cfg .\lora_anime_character.yaml
bin F:\python\lib\site-packages\bitsandbytes\libbitsandbytes_cuda117.dll
The 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'
--dynamo_backend was set to a value of 'no'
To avoid this warning pass in values for each of the problematic parameters or run accelerate config.
bin F:\python\lib\site-packages\bitsandbytes\libbitsandbytes_cuda117.dll
F:\python\lib\runpy.py:126: RuntimeWarning: 'hcpdiff.train_ac_single' found in sys.modules after import of package 'hcpdiff', but prior to execution of 'hcpdiff.train_ac_single'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
2023-11-13 01:24:24.563 | INFO | hcpdiff.loggers.cli_logger:_info:30 - world_size: 1
2023-11-13 01:24:24.563 | INFO | hcpdiff.loggers.cli_logger:_info:30 - accumulation: 1
You are using a model of type clip_text_model to instantiate a model of type . This is not supported for all configurations of models and can yield errors.
2023-11-13 01:24:28.321 | INFO | hcpdiff.models.text_emb_ex:hook:86 - hook: black_san_magnolia, len: 4, id: 49408
2023-11-13 01:24:28.322 | INFO | hcpdiff.models.text_emb_ex:hook:86 - hook: bloody_reina, len: 2, id: 49409
2023-11-13 01:24:28.322 | INFO | hcpdiff.models.text_emb_ex:hook:86 - hook: blue_san_magnolia, len: 4, id: 49410
2023-11-13 01:24:28.322 | INFO | hcpdiff.models.text_emb_ex:hook:86 - hook: formal_giad, len: 4, id: 49411
2023-11-13 01:24:28.322 | INFO | hcpdiff.models.text_emb_ex:hook:86 - hook: neck_scar, len: 2, id: 49412
2023-11-13 01:24:28.323 | INFO | hcpdiff.models.text_emb_ex:hook:86 - hook: personal_room, len: 4, id: 49413
2023-11-13 01:24:28.323 | INFO | hcpdiff.models.text_emb_ex:hook:86 - hook: shinei_nouzen, len: 3, id: 49414
2023-11-13 01:24:28.323 | INFO | hcpdiff.models.text_emb_ex:hook:86 - hook: undertaker, len: 4, id: 49415
2023-11-13 01:24:28.323 | INFO | hcpdiff.models.text_emb_ex:hook:86 - hook: vladilena_millize, len: 3, id: 49416
A matching Triton is not available, some optimizations will not be enabled.
Error caught was: No module named 'triton'
2023-11-13 01:24:29.182 | INFO | hcpdiff.data.caption_loader:load:18 - 144 record(s) loaded with TXTCaptionLoader, from path 'L:/waifu_diffusion/anime-tagger/out/86/512x512'
2023-11-13 01:24:29.183 | INFO | hcpdiff.data.bucket:build_buckets_from_images:241 - build buckets from images size
F:\python\lib\site-packages\sklearn\cluster_kmeans.py:1412: FutureWarning: The default value of n_init will change from 10 to 'auto' in 1.4. Set the value of n_init explicitly to suppress the warning
super()._check_params_vs_input(X, default_n_init=10)
2023-11-13 01:24:29.632 | INFO | hcpdiff.data.bucket:build_buckets_from_images:262 - buckets info: size:[512 512], num:144
2023-11-13 01:24:29.666 | INFO | hcpdiff.loggers.cli_logger:_info:30 - len(train_dataset): 144
F:\python\lib\site-packages\diffusers\pipelines\stable_diffusion\pipeline_stable_diffusion.py:128: FutureWarning: The configuration file of this scheduler: PNDMScheduler {
"_class_name": "PNDMScheduler",
"_diffusers_version": "0.19.3",
"beta_end": 0.012,
"beta_schedule": "scaled_linear",
"beta_start": 0.00085,
"num_train_timesteps": 1000,
"prediction_type": "epsilon",
"set_alpha_to_one": false,
"skip_prk_steps": false,
"steps_offset": 0,
"timestep_spacing": "leading",
"trained_betas": null
}
is outdated. steps_offset should be set to 1 instead of 0. Please make sure to update the config accordingly as leaving steps_offset might led to incorrect results in future versions. If you have downloaded this checkpoint from the Hugging Face Hub, it would be very nice if you could open a Pull request for the scheduler/scheduler_config.json file
deprecate("steps_offset!=1", "1.0.0", deprecation_message, standard_warn=False)
2023-11-13 01:24:30.572 | INFO | hcpdiff.loggers.cli_logger:_info:30 - ***** Running training *****
2023-11-13 01:24:30.572 | INFO | hcpdiff.loggers.cli_logger:_info:30 - Num batches each epoch = 144
2023-11-13 01:24:30.573 | INFO | hcpdiff.loggers.cli_logger:_info:30 - Num Steps = 1000
2023-11-13 01:24:30.573 | INFO | hcpdiff.loggers.cli_logger:info:30 - Instantaneous batch size per device = 1
2023-11-13 01:24:30.573 | INFO | hcpdiff.loggers.cli_logger:info:30 - Total train batch size (w. parallel, distributed & accumulation) = 1
2023-11-13 01:24:30.573 | INFO | hcpdiff.loggers.cli_logger:info:30 - Gradient Accumulation steps = 1
bin F:\python\lib\site-packages\bitsandbytes\libbitsandbytes_cuda117.dll
F:\python\lib\runpy.py:126: RuntimeWarning: 'hcpdiff.train_ac_single' found in sys.modules after import of package 'hcpdiff', but prior to execution of 'hcpdiff.train_ac_single'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
bin F:\python\lib\site-packages\bitsandbytes\libbitsandbytes_cuda117.dll
F:\python\lib\runpy.py:126: RuntimeWarning: 'hcpdiff.train_ac_single' found in sys.modules after import of package 'hcpdiff', but prior to execution of 'hcpdiff.train_ac_single'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
bin F:\python\lib\site-packages\bitsandbytes\libbitsandbytes_cuda117.dll
F:\python\lib\runpy.py:126: RuntimeWarning: 'hcpdiff.train_ac_single' found in sys.modules after import of package 'hcpdiff', but prior to execution of 'hcpdiff.train_ac_single'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
bin F:\python\lib\site-packages\bitsandbytes\libbitsandbytes_cuda117.dll
F:\python\lib\runpy.py:126: RuntimeWarning: 'hcpdiff.train_ac_single' found in sys.modules after import of package 'hcpdiff', but prior to execution of 'hcpdiff.train_ac_single'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
F:\python\lib\site-packages\hcpdiff\train_ac.py:425: FutureWarning: Accessing config attribute scaling_factor directly via 'AutoencoderKL' object attribute is deprecated. Please access 'scaling_factor' over 'AutoencoderKL's config object instead, e.g. 'unet.config.scaling_factor'.
latents = latents*self.vae.scaling_factor
F:\python\lib\site-packages\torch\utils\checkpoint.py:31: UserWarning: None of the inputs have requires_grad=True. Gradients will be None
warnings.warn("None of the inputs have requires_grad=True. Gradients will be None")
Traceback (most recent call last):
File "F:\python\lib\runpy.py", line 196, in run_module_as_main
return run_code(code, main_globals, None,
File "F:\python\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "F:\python\lib\site-packages\hcpdiff\train_ac_single.py", line 61, in
trainer.train()
File "F:\python\lib\site-packages\hcpdiff\train_ac.py", line 391, in train
loss = self.train_one_step(data_list)
File "F:\python\lib\site-packages\hcpdiff\train_ac.py", line 481, in train_one_step
self.accelerator.clip_grad_norm
(clip_param, self.cfgs.train.max_grad_norm)
File "F:\python\lib\site-packages\accelerate\accelerator.py", line 1916, in clip_grad_norm

self.unscale_gradients()
File "F:\python\lib\site-packages\accelerate\accelerator.py", line 1879, in unscale_gradients
self.scaler.unscale
(opt)
File "F:\python\lib\site-packages\torch\cuda\amp\grad_scaler.py", line 275, in unscale

raise RuntimeError("unscale
() has already been called on this optimizer since the last update().")
RuntimeError: unscale
() has already been called on this optimizer since the last update().
Traceback (most recent call last):
File "F:\python\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "F:\python\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "F:\python\Scripts\accelerate.exe_main
.py", line 7, in
File "F:\python\lib\site-packages\accelerate\commands\accelerate_cli.py", line 45, in main
args.func(args)
File "F:\python\lib\site-packages\accelerate\commands\launch.py", line 959, in launch_command
simple_launcher(args)
File "F:\python\lib\site-packages\accelerate\commands\launch.py", line 624, in simple_launcher
raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['F:\python\python.exe', '-m', 'hcpdiff.train_ac_single', '--cfg', '.\lora_anime_character.yaml']' returned non-zero exit status 1.

้‡‡็”จ้ป˜่ฎค้…็ฝฎ่ฎญ็ปƒ้€Ÿๅบฆๆ…ขaccelerate launch -m hcpdiff.train_ac_single

ๅคงไฝฌๆˆ‘ๅœจไฝฟ็”จ้ป˜่ฎคๆŒ‡ไปคๅœจ่ฎญ็ปƒloraๆ—ถ๏ผŒๅ‘็Žฐ้€Ÿๅบฆๅพˆๆ…ข๏ผšaccelerate launch -m hcpdiff.train_ac_single --cfg cfgs/train/examples/lora_conventional.yaml --model.pretrained_model_name_or_path "C://res/meta" dataset_dir="C://res/data/train"

ๆ‰“ๅผ€ไปปๅŠก็ฎก็†ๅ™จๅ‘็ŽฐCudaไฝฟ็”จ็Ž‡ไธ€้˜ตไธ€้˜ต็š„๏ผŒ่ฟ™้‡Œๆ˜ฏๆˆ‘ๅ“ช้‡Œ้…็ฝฎๆœ‰้—ฎ้ข˜ๅ—๏ผŒๆˆ‘็š„้…็ฝฎๆ˜ฏ3090 24G ,Windows 10

QQๅ›พ็‰‡20230903044522

Tutorial Section links from Readme are not linking to the correct pages

When trying to access the links found in https://github.com/7eu7d7/HCP-Diffusion#tutorials the links turn up a 404 error as they have been moved around into /en/ and /zh_cn/ folders.
The links in the Tutorial section should be updated to the following for the English language:

[Model Training Tutorial](https://github.com/7eu7d7/HCP-Diffusion/blob/main/doc/guide_train.md) -> [Model Training Tutorial](https://github.com/7eu7d7/HCP-Diffusion/blob/main/doc/en/user_guides/train.md)
[DreamArtist++ Tutorial](https://github.com/7eu7d7/HCP-Diffusion/blob/main/doc/guide_DA.md) -> [DreamArtist++ Tutorial](https://github.com/7eu7d7/HCP-Diffusion/blob/main/doc/en/tutorial/DA.md)
[Model Inference Tutorial](https://github.com/7eu7d7/HCP-Diffusion/blob/main/doc/guide_infer.md) -> [Model Inference Tutorial](https://github.com/7eu7d7/HCP-Diffusion/blob/main/doc/en/user_guides/infer.md)
[Configuration File Explanation](https://github.com/7eu7d7/HCP-Diffusion/blob/main/doc/guide_cfg.md) -> [Configuration File Explanation](https://github.com/7eu7d7/HCP-Diffusion/blob/main/doc/en/user_guides/cfg.md)
[webui Model Conversion Tutorial](https://github.com/7eu7d7/HCP-Diffusion/blob/main/doc/guide_webui_lora.md) -> [webui Model Conversion Tutorial](https://github.com/7eu7d7/HCP-Diffusion/blob/main/doc/en/user_guides/model_convert.md)

Unfortunately I do not speak Chinese and cannot make recommendations for that.

Posting the updated links here without code brackets for temporary use by viewers of this issue until the update is made:

With this out of the way, I can't wait to test your scripts. Hopefully they work on AMD.

webui support

proper web ui support, or a gui would be a very welcomed addition to this.

sdxl่ฎญ็ปƒๆŠฅ้”™๏ผŒtime_idsไธบNone

Traceback (most recent call last):
File "/home/inuyaxia/anaconda3/envs/hcpdiff/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/inuyaxia/anaconda3/envs/hcpdiff/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/mnt/ssd-array/xx-volume/develop/MLLM/HCP-Diffusion/hcpdiff/train_ac_single.py", line 45, in
trainer.train()
File "/mnt/ssd-array/xx-volume/develop/MLLM/HCP-Diffusion/hcpdiff/train_ac.py", line 397, in train
loss = self.train_one_step(data_list)
File "/mnt/ssd-array/xx-volume/develop/MLLM/HCP-Diffusion/hcpdiff/train_ac.py", line 479, in train_one_step
model_pred, target, timesteps = self.forward(latents, prompt_ids, **other_datas)
File "/mnt/ssd-array/xx-volume/develop/MLLM/HCP-Diffusion/hcpdiff/train_ac.py", line 455, in forward
model_pred = self.TE_unet(prompt_ids, noisy_latents, timesteps, **kwargs)
File "/home/inuyaxia/anaconda3/envs/hcpdiff/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/inuyaxia/anaconda3/envs/hcpdiff/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/home/inuyaxia/anaconda3/envs/hcpdiff/lib/python3.10/site-packages/accelerate/utils/operations.py", line 659, in forward
return model_forward(*args, **kwargs)
File "/home/inuyaxia/anaconda3/envs/hcpdiff/lib/python3.10/site-packages/accelerate/utils/operations.py", line 647, in call
return convert_to_fp32(self.model_forward(*args, **kwargs))
File "/home/inuyaxia/anaconda3/envs/hcpdiff/lib/python3.10/site-packages/torch/amp/autocast_mode.py", line 16, in decorate_autocast
return func(*args, **kwargs)
File "/mnt/ssd-array/xx-volume/develop/MLLM/HCP-Diffusion/hcpdiff/models/wrapper.py", line 72, in forward
model_pred = self.unet(noisy_latents, timesteps, encoder_hidden_states, added_cond_kwargs=added_cond_kwargs).sample # Predict the noise residual
File "/home/inuyaxia/anaconda3/envs/hcpdiff/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/inuyaxia/anaconda3/envs/hcpdiff/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/home/inuyaxia/anaconda3/envs/hcpdiff/lib/python3.10/site-packages/diffusers/models/unet_2d_condition.py", line 977, in forward
time_embeds = self.add_time_proj(time_ids.flatten())
AttributeError: 'NoneType' object has no attribute 'flatten'

image

text2img_sdxl.yaml ๆŽจ็†ๆŠฅ้”™

ๆˆ‘ๅนถไธๆ˜ฏไธ“ไธšไบบๅฃซ๏ผŒ่ฟ™ไธชๆŠฅ้”™่ฎฉๆˆ‘ๅพˆๅ›ฐๆƒ‘๏ผŒๅธŒๆœ›็Ÿฅ้“ๅฆ‚ไฝ•่งฃๅ†ณ

(HCP) C:\webui_git\HCP-Diffusion>python -m hcpdiff.visualizer --cfg cfgs/infer/text2img.yaml pretrained_model=stabilityai/stable-diffusion-xl-base-1.0 prompt=1girl neg_prompt=bad seed=42
2023-12-26 14:43:07.146482: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0.
WARNING:tensorflow:From C:\Users\momo\AppData\Local\anaconda3\envs\HCP\lib\site-packages\keras\src\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.

C:\Users\momo\AppData\Local\anaconda3\envs\HCP\lib\runpy.py:126: RuntimeWarning: 'hcpdiff.visualizer' found in sys.modules after import of package 'hcpdiff', but prior to execution of 'hcpdiff.visualizer'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
You are using a model of type clip_text_model to instantiate a model of type . This is not supported for all configurations of models and can yield errors.
Loading pipeline components...: 100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 5/5 [00:01<00:00, 2.98it/s]
C:\Users\momo\AppData\Local\anaconda3\envs\HCP\lib\site-packages\diffusers\pipelines\pipeline_utils.py:761: FutureWarning: torch_dtype is deprecated and will be removed in version 0.25.0.
deprecate("torch_dtype", "0.25.0", "")
2023-12-26 14:43:18.309 | INFO | hcpdiff.models.compose.compose_hook:hook:49 - compose hook: clip_B
2023-12-26 14:43:18.312 | INFO | hcpdiff.models.text_emb_ex:hook:86 - hook: hatsune_miku_bluearchive, len: 4, id: 49408
2023-12-26 14:43:18.312 | INFO | hcpdiff.models.compose.compose_hook:hook:49 - compose hook: clip_bigG
2023-12-26 14:43:18.314 | INFO | hcpdiff.models.text_emb_ex:hook:86 - hook: hatsune_miku_bluearchive, len: 4, id: 49408
Traceback (most recent call last):
File "C:\Users\momo\AppData\Local\anaconda3\envs\HCP\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\momo\AppData\Local\anaconda3\envs\HCP\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\webui_git\HCP-Diffusion\hcpdiff\visualizer.py", line 257, in
viser.vis_to_dir(prompt=prompt, negative_prompt=negative_prompt,
File "C:\webui_git\HCP-Diffusion\hcpdiff\visualizer.py", line 235, in vis_to_dir
images = self.vis_images(prompt, negative_prompt, seeds=seeds, **kwargs)
File "C:\Users\momo\AppData\Local\anaconda3\envs\HCP\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "C:\webui_git\HCP-Diffusion\hcpdiff\visualizer.py", line 196, in vis_images
emb, pooled_output, attention_mask = self.te_hook.encode_prompt_to_emb(clean_text_n+clean_text_p)
File "C:\webui_git\HCP-Diffusion\hcpdiff\models\compose\compose_hook.py", line 104, in encode_prompt_to_emb
encoder_hidden_states, pooled_output = list(zip(*emb_list))
ValueError: too many values to unpack (expected 2)

ๅธŒๆœ›ๆ”ฏๆŒLyCORIS็š„็›ธๅ…ณๆจกๅž‹่ฎญ็ปƒๆ–นๆณ•

้กน็›ฎ้“พๆŽฅๅœจ่ฟ™้‡Œ
https://github.com/KohakuBlueleaf/LyCORIS

LyCORISๆ˜ฏไธ€ไธชๅŸบไบŽLoRA่ฎญ็ปƒ็š„ๆ‰ฉๅฑ•้กน็›ฎ๏ผŒๅŒ…ๆ‹ฌไธ€ไบ›ๅ…ถไป–็ฎ—ๆณ•็š„ๅŸบไบŽlora็š„ๆจกๅž‹๏ผŒๅŒ…ๆ‹ฌๅท็งฏloconใ€ๅ“ˆ่พพ็Ž›็งฏlohaไปฅๅŠๆœ€ๆ–ฐ็š„ๅ…‹็ฝ—ๅ†…ๅ…‹็งฏlokr.
ๅฆๅค–่ฟ˜ๆœ‰ไธ€ไธช็ฑปไผผTi็š„ๆ–‡ๆœฌๅฑ‚ๆจกๅž‹๏ผŒIA3

linux support

ๅธŒๆœ›่ƒฝๆ”ฏๆŒlinux่ฎญ็ปƒ

How to use a safetensors model from civit.ai?

I'm following the tutorial from https://github.com/7eu7d7/HCP-Diffusion/blob/main/doc/en/tutorial/lora_anime.md

It mentions using "deepghs/animefull-latest" but is there a way to make it use a safetensors checkpoint on my machine that's not hosted in huggingface? I tried simply replacing "deepghs/animefull-latest" with the path to my safetensors file but it did not work.

I'm thinking I could use runwayml/stable-diffusion-v1-5 but then manually replace the downloaded v1-5-pruned.safetensors with mine, is that the recommended way?

Thanks

Automatic model format recognition and conversion

Add model automatic recognition and conversion features.

  • Automatically convert models in SD official format.
  • Automatically convert lora in kohya-ss format.
  • Automatically convert controlnet in official format.

readme file not desc of train, I hope get some help! And I meet err.

Readme file not desc of train, I hope get some help!
I run accelerate launch -m hcpdiff.train_ac_single --cfg cfgs/train/examples/DreamArtist.yaml

I meet a err. I modify this "pretrained_model_name_or_path" config in DreamArtist.yaml
Is there anything else that needs to be modified?
or give a yaml is direct run ! thanks! thanks! thanks!

Traceback (most recent call last):
  File "/home/image1325_user/anaconda3/envs/yudongjian_23_ldm/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/image1325_user/anaconda3/envs/yudongjian_23_ldm/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/image1325_user/ssd_disk1/yudongjian_23/HCP-Diffusion-main/hcpdiff/train_ac_single.py", line 44, in <module>
    trainer = TrainerSingleCard(conf)
  File "/home/image1325_user/ssd_disk1/yudongjian_23/HCP-Diffusion-main/hcpdiff/train_ac.py", line 78, in __init__
    self.build_optimizer_scheduler()
  File "/home/image1325_user/ssd_disk1/yudongjian_23/HCP-Diffusion-main/hcpdiff/train_ac.py", line 366, in build_optimizer_scheduler
    parameters, parameters_pt = self.get_param_group_train()
  File "/home/image1325_user/ssd_disk1/yudongjian_23/HCP-Diffusion-main/hcpdiff/train_ac.py", line 356, in get_param_group_train
    word_emb = self.ex_words_emb[v.name]
KeyError: 'pt-catgirl1'

็”Ÿๆˆๅ›พๅƒๆ—ถๆŠฅ้”™

  • ็”Ÿๆˆๅ›พๅƒๆ—ถๆœ€ๅŽvae decode็š„ๆ—ถๅ€™ๆŠฅ้”™
  • ๅค็Žฐ๏ผš่ฟ่กŒColab example็š„Generate Images้ƒจๅˆ†
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Traceback (most recent call last) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ in <cell line: 16>:16                                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py:115 in decorate_context       โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   112 โ”‚   @functools.wraps(func)                                                                 โ”‚
โ”‚   113 โ”‚   def decorate_context(*args, **kwargs):                                                 โ”‚
โ”‚   114 โ”‚   โ”‚   with ctx_factory():                                                                โ”‚
โ”‚ โฑ 115 โ”‚   โ”‚   โ”‚   return func(*args, **kwargs)                                                   โ”‚
โ”‚   116 โ”‚                                                                                          โ”‚
โ”‚   117 โ”‚   return decorate_context                                                                โ”‚
โ”‚   118                                                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /usr/local/lib/python3.10/dist-packages/hcpdiff/visualizer.py:202 in vis_images                  โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   199 โ”‚   โ”‚   โ”‚   โ”‚   for feeder in self.pipe.unet.input_feeder:                                 โ”‚
โ”‚   200 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   feeder(ex_input_dict)                                                  โ”‚
โ”‚   201 โ”‚   โ”‚   โ”‚                                                                                  โ”‚
โ”‚ โฑ 202 โ”‚   โ”‚   โ”‚   images = self.pipe(prompt_embeds=emb_p, negative_prompt_embeds=emb_n, **kwar   โ”‚
โ”‚   203 โ”‚   โ”‚   return images                                                                      โ”‚
โ”‚   204 โ”‚                                                                                          โ”‚
โ”‚   205 โ”‚   def save_images(self, images, root, prompt, negative_prompt='', save_cfg=True):        โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py:115 in decorate_context       โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   112 โ”‚   @functools.wraps(func)                                                                 โ”‚
โ”‚   113 โ”‚   def decorate_context(*args, **kwargs):                                                 โ”‚
โ”‚   114 โ”‚   โ”‚   with ctx_factory():                                                                โ”‚
โ”‚ โฑ 115 โ”‚   โ”‚   โ”‚   return func(*args, **kwargs)                                                   โ”‚
โ”‚   116 โ”‚                                                                                          โ”‚
โ”‚   117 โ”‚   return decorate_context                                                                โ”‚
โ”‚   118                                                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /usr/local/lib/python3.10/dist-packages/diffusers/pipelines/stable_diffusion/pipeline_stable_dif โ”‚
โ”‚ fusion.py:755 in __call__                                                                        โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   752 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   callback(i, t, latents)                                            โ”‚
โ”‚   753 โ”‚   โ”‚                                                                                      โ”‚
โ”‚   754 โ”‚   โ”‚   if not output_type == "latent":                                                    โ”‚
โ”‚ โฑ 755 โ”‚   โ”‚   โ”‚   image = self.vae.decode(latents / self.vae.config.scaling_factor, return_dic   โ”‚
โ”‚   756 โ”‚   โ”‚   โ”‚   image, has_nsfw_concept = self.run_safety_checker(image, device, prompt_embe   โ”‚
โ”‚   757 โ”‚   โ”‚   else:                                                                              โ”‚
โ”‚   758 โ”‚   โ”‚   โ”‚   image = latents                                                                โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /usr/local/lib/python3.10/dist-packages/diffusers/utils/accelerate_utils.py:46 in wrapper        โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   43 โ”‚   def wrapper(self, *args, **kwargs):                                                     โ”‚
โ”‚   44 โ”‚   โ”‚   if hasattr(self, "_hf_hook") and hasattr(self._hf_hook, "pre_forward"):             โ”‚
โ”‚   45 โ”‚   โ”‚   โ”‚   self._hf_hook.pre_forward(self)                                                 โ”‚
โ”‚ โฑ 46 โ”‚   โ”‚   return method(self, *args, **kwargs)                                                โ”‚
โ”‚   47 โ”‚                                                                                           โ”‚
โ”‚   48 โ”‚   return wrapper                                                                          โ”‚
โ”‚   49                                                                                             โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /usr/local/lib/python3.10/dist-packages/diffusers/models/autoencoder_kl.py:191 in decode         โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   188 โ”‚   โ”‚   โ”‚   decoded_slices = [self._decode(z_slice).sample for z_slice in z.split(1)]      โ”‚
โ”‚   189 โ”‚   โ”‚   โ”‚   decoded = torch.cat(decoded_slices)                                            โ”‚
โ”‚   190 โ”‚   โ”‚   else:                                                                              โ”‚
โ”‚ โฑ 191 โ”‚   โ”‚   โ”‚   decoded = self._decode(z).sample                                               โ”‚
โ”‚   192 โ”‚   โ”‚                                                                                      โ”‚
โ”‚   193 โ”‚   โ”‚   if not return_dict:                                                                โ”‚
โ”‚   194 โ”‚   โ”‚   โ”‚   return (decoded,)                                                              โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /usr/local/lib/python3.10/dist-packages/diffusers/models/autoencoder_kl.py:177 in _decode        โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   174 โ”‚   โ”‚   if self.use_tiling and (z.shape[-1] > self.tile_latent_min_size or z.shape[-2] >   โ”‚
โ”‚   175 โ”‚   โ”‚   โ”‚   return self.tiled_decode(z, return_dict=return_dict)                           โ”‚
โ”‚   176 โ”‚   โ”‚                                                                                      โ”‚
โ”‚ โฑ 177 โ”‚   โ”‚   z = self.post_quant_conv(z)                                                        โ”‚
โ”‚   178 โ”‚   โ”‚   dec = self.decoder(z)                                                              โ”‚
โ”‚   179 โ”‚   โ”‚                                                                                      โ”‚
โ”‚   180 โ”‚   โ”‚   if not return_dict:                                                                โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py:1501 in _call_impl            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   1498 โ”‚   โ”‚   if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks   โ”‚
โ”‚   1499 โ”‚   โ”‚   โ”‚   โ”‚   or _global_backward_pre_hooks or _global_backward_hooks                   โ”‚
โ”‚   1500 โ”‚   โ”‚   โ”‚   โ”‚   or _global_forward_hooks or _global_forward_pre_hooks):                   โ”‚
โ”‚ โฑ 1501 โ”‚   โ”‚   โ”‚   return forward_call(*args, **kwargs)                                          โ”‚
โ”‚   1502 โ”‚   โ”‚   # Do not call functions when jit is used                                          โ”‚
โ”‚   1503 โ”‚   โ”‚   full_backward_hooks, non_full_backward_hooks = [], []                             โ”‚
โ”‚   1504 โ”‚   โ”‚   backward_pre_hooks = []                                                           โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /usr/local/lib/python3.10/dist-packages/torch/nn/modules/conv.py:463 in forward                  โ”‚
โ”‚                                                                                                  โ”‚
โ”‚    460 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   self.padding, self.dilation, self.groups)                         โ”‚
โ”‚    461 โ”‚                                                                                         โ”‚
โ”‚    462 โ”‚   def forward(self, input: Tensor) -> Tensor:                                           โ”‚
โ”‚ โฑ  463 โ”‚   โ”‚   return self._conv_forward(input, self.weight, self.bias)                          โ”‚
โ”‚    464                                                                                           โ”‚
โ”‚    465 class Conv3d(_ConvNd):                                                                    โ”‚
โ”‚    466 โ”‚   __doc__ = r"""Applies a 3D convolution over an input signal composed of several inpu  โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /usr/local/lib/python3.10/dist-packages/torch/nn/modules/conv.py:459 in _conv_forward            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚    456 โ”‚   โ”‚   โ”‚   return F.conv2d(F.pad(input, self._reversed_padding_repeated_twice, mode=sel  โ”‚
โ”‚    457 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   weight, bias, self.stride,                                    โ”‚
โ”‚    458 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   _pair(0), self.dilation, self.groups)                         โ”‚
โ”‚ โฑ  459 โ”‚   โ”‚   return F.conv2d(input, weight, bias, self.stride,                                 โ”‚
โ”‚    460 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   self.padding, self.dilation, self.groups)                         โ”‚
โ”‚    461 โ”‚                                                                                         โ”‚
โ”‚    462 โ”‚   def forward(self, input: Tensor) -> Tensor:                                           โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
RuntimeError: Input type (torch.cuda.HalfTensor) and weight type (torch.HalfTensor) should be the same

Bug Report: ConfigAttributeError: Missing key clip_skip

Please add clip_skip=2 in the cfgs/infer/v1.yaml

Below is my inference config, using enma_ai's lora trained by HCP Diffusion.

pretrained_model: /home/yabin/HCP-Diffusion/converted_models/Acertain
prompt: enma_ai, 1girl, tree, solo, plant, bush, outdoors, grass, garden, nature,
  branch, day, sky,
neg_prompt: lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit,
  fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts,
  signature, watermark, username, blurry
out_dir: output/
emb_dir: embs/
N_repeats: 1
bs: 4
num: 1
seed: null
fp16: true
clip_skip: 2
save:
  save_cfg: true
  image_type: png
  quality: 95
infer_args:
  width: 512
  height: 768
  guidance_scale: 7.5
new_components: {}
merge:
  exp_dir: 2023-04-17-21-59-53
  alpha: 0.8
  group1:
    type: unet
    base_model_alpha: 1.0
    lora:
    - path: exps/${....exp_dir}/ckpts/unet-2000.safetensors
      alpha: ${....alpha}
      layers: all
      mask: null
    part: null
  group2:
    type: TE
    base_model_alpha: 1.0
    lora:
    - path: exps/${....exp_dir}/ckpts/text_encoder-2000.safetensors
      alpha: ${....alpha}
      layers: all
      mask: null
    part: null

Below is the generated image with ACertain, which is also the base model I trained on.

0-enma_ai, 1girl, tree, solo, plant, bush, outdoors, grass, garden, nature, branch, day, sky,

Currently, I am unable to evaluate the quality of this LoRa model compared to my previous LoRa model trained using sd-script, mainly because there are numerous training script settings in this repository that I do not understand. However, I am confident that this is an excellent project. The code is clean and easy to use, with support for training on Linux systems and multiple GPUs. There are many algorithms available (although I am not sure of the exact number of methods that have been implemented).

Expected to see convertion scripts to transfer this lora format to general lora format, which can be used in Webui with more controlable parameters.

By the way, I'm curious about the Rank parameter in the configuration file. Initially, I thought it meant dim in sd-script, but when I set it to 128, the final output model's size was more than 200MB (while this dim setting is only 144MB in sd-script). I also noticed that the scale parameter is available in the code, but currently, I am unable to set it using the configuration file. I believe that the scale is equivalent to 'alpha'.

An error occurs when using DreamArtist with SDXL.

I was able to use DreamArtist with SD1.5, but an error occurs with SDXL.

RuntimeError: split_with_sizes expects split_sizes to sum exactly to 768 (input tensor's size at dimension 1), but got split_sizes=[768, 1280]

Do you know what's causing it?
error2023-12-08_115130

Model conversion error

Model conversion from webui to diffusers framework wont work with diffusers==0.18.x
Trying to do so will yield the following error:
"TypeError: convert_ldm_clip_checkpoint() got an unexpected keyword argument 'text_encoder'"
Downgrading to diffusers==0.17.1 fixes this issue.
Perhaps the requirements should be modified to enforce the use of 0.17.x diffusers lib.

lora่ฎญ็ปƒ็”Ÿๆˆๅ›พ็‰‡

cfgs/infer/anime/text2img_anime_lora.yaml
ๆ–‡ไปถไธญ็š„_base_่ฟ่กŒไผšๆŠฅ้”™๏ผšๆฒกๆœ‰cfgs/infer/text2img_anime.yamlๆ–‡ไปถ
ๆ”นไธบcfgs/infer/anime/text2img_anime.yamlๅฐฑไธไผšๆŠฅ่ฟ™ไธช้”™่ฏฏ

Errors at the start of training

/workspace/HCP-Diffusion# accelerate launch -m hcpdiff.train_ac_single
--cfg cfgs/train/examples/lora_anime_character.yaml
character_name=noah
dataset_dir=/workspace/HCP-Diffusion/data/noah
wandb is not available
/usr/lib/python3.10/runpy.py:126: RuntimeWarning: 'hcpdiff.train_ac_single' found in sys.modules after import of package 'hcpdiff', but prior to execution of 'hcpdiff.train_ac_single'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
2023-10-13 08:03:42.162 | INFO | hcpdiff.loggers.cli_logger:_info:30 - world_size: 1
2023-10-13 08:03:42.162 | INFO | hcpdiff.loggers.cli_logger:_info:30 - accumulation: 1
You are using a model of type clip_text_model to instantiate a model of type . This is not supported for all configurations of models and can yield errors.
2023-10-13 08:03:45.678 | INFO | hcpdiff.models.text_emb_ex:hook:86 - hook: noah, len: 4, id: 28806
2023-10-13 08:03:45.830 | INFO | hcpdiff.data.caption_loader:load:18 - 2 record(s) loaded with JsonCaptionLoader, from path '/workspace/HCP-Diffusion/data/noah/image_captions.json'
2023-10-13 08:03:45.831 | INFO | hcpdiff.data.bucket:build_buckets_from_images:241 - build buckets from images size
/usr/local/lib/python3.10/dist-packages/sklearn/cluster/_kmeans.py:1416: FutureWarning: The default value of n_init will change from 10 to 'auto' in 1.4. Set the value of n_init explicitly to suppress the warning
super()._check_params_vs_input(X, default_n_init=10)
2023-10-13 08:03:45.851 | INFO | hcpdiff.data.bucket:build_buckets_from_images:262 - buckets info: size:[640 896], num:2
2023-10-13 08:03:45.851 | INFO | hcpdiff.loggers.cli_logger:_info:30 - len(train_dataset): 4
0%| | 0/4 [00:00<?, ?it/s]/workspace/HCP-Diffusion/hcpdiff/data/pair_dataset.py:107: FutureWarning: Accessing config attribute scaling_factor directly via 'AutoencoderKL' object attribute is deprecated. Please access 'scaling_factor' over 'AutoencoderKL's config object instead, e.g. 'unet.config.scaling_factor'.
data['img'] = (latents*vae.scaling_factor).cpu()
100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 4/4 [00:00<00:00, 11.16it/s]
/usr/local/lib/python3.10/dist-packages/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py:128: FutureWarning: The configuration file of this scheduler: PNDMScheduler {
"_class_name": "PNDMScheduler",
"_diffusers_version": "0.21.4",
"beta_end": 0.012,
"beta_schedule": "scaled_linear",
"beta_start": 0.00085,
"num_train_timesteps": 1000,
"prediction_type": "epsilon",
"set_alpha_to_one": false,
"skip_prk_steps": false,
"steps_offset": 0,
"timestep_spacing": "leading",
"trained_betas": null
}
is outdated. steps_offset should be set to 1 instead of 0. Please make sure to update the config accordingly as leaving steps_offset might led to incorrect results in future versions. If you have downloaded this checkpoint from the Hugging Face Hub, it would be very nice if you could open a Pull request for the scheduler/scheduler_config.json file
deprecate("steps_offset!=1", "1.0.0", deprecation_message, standard_warn=False)
2023-10-13 08:03:46.798 | INFO | hcpdiff.loggers.cli_logger:_info:30 - ***** Running training *****
2023-10-13 08:03:46.798 | INFO | hcpdiff.loggers.cli_logger:_info:30 - Num batches each epoch = 1
2023-10-13 08:03:46.798 | INFO | hcpdiff.loggers.cli_logger:_info:30 - Num Steps = 1000
2023-10-13 08:03:46.798 | INFO | hcpdiff.loggers.cli_logger:_info:30 - Instantaneous batch size per device = 4
2023-10-13 08:03:46.799 | INFO | hcpdiff.loggers.cli_logger:_info:30 - Total train batch size (w. parallel, distributed & accumulation) = 4
2023-10-13 08:03:46.799 | INFO | hcpdiff.loggers.cli_logger:_info:30 - Gradient Accumulation steps = 1
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/workspace/HCP-Diffusion/hcpdiff/train_ac_single.py", line 61, in
trainer.train()
File "/workspace/HCP-Diffusion/hcpdiff/train_ac.py", line 383, in train
loss = self.train_one_step(data_list)
File "/workspace/HCP-Diffusion/hcpdiff/train_ac.py", line 480, in train_one_step
self.optimizer_pt.step()
File "/usr/local/lib/python3.10/dist-packages/accelerate/optimizer.py", line 132, in step
self.scaler.step(self.optimizer, closure)
File "/usr/local/lib/python3.10/dist-packages/torch/cuda/amp/grad_scaler.py", line 372, in step
assert len(optimizer_state["found_inf_per_device"]) > 0, "No inf checks were recorded for this optimizer."
AssertionError: No inf checks were recorded for this optimizer.
Traceback (most recent call last):
File "/usr/local/bin/accelerate", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.10/dist-packages/accelerate/commands/accelerate_cli.py", line 47, in main
args.func(args)
File "/usr/local/lib/python3.10/dist-packages/accelerate/commands/launch.py", line 986, in launch_command
simple_launcher(args)
File "/usr/local/lib/python3.10/dist-packages/accelerate/commands/launch.py", line 628, in simple_launcher
raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python', '-m', 'hcpdiff.train_ac_single', '--cfg', 'cfgs/train/examples/lora_anime_character.yaml', 'character_name=noah', 'dataset_dir=/workspace/HCP-Diffusion/data/noah']' returned non-zero exit status 1.

I've been trying all day and haven't been able to solve it.
OS: Ubuntu 22.04.2 LTS

how to train with controlnet

Hi,
may i ask how to train controlnet with this repo? as I see that training controlnet is mentioned in readme.
many thanks!

sd2diffusers ่„šๆœฌ่ฝฌๆขๅˆฐ diffusers ๆŠฅ้”™

่ฝฌๆขsd1.5ๆจกๅž‹ๆ—ถๆŠฅ้”™
็‰ˆๆœฌ๏ผš14bfef5e2e6b6f30bcaa492fb5292982c8ab78ec
ๅ †ๆ ˆ๏ผš

Traceback (most recent call last):
  File "/root/git/hcp_proj/env/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/root/git/hcp_proj/env/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/root/git/hcp_proj/HCP-Diffusion/hcpdiff/tools/sd2diffusers.py", line 372, in <module>
    convert_ckpt(args)
  File "/root/git/hcp_proj/HCP-Diffusion/hcpdiff/tools/sd2diffusers.py", line 210, in convert_ckpt
    pipe = load_sd_ckpt(
TypeError: download_from_original_stable_diffusion_ckpt() got an unexpected keyword argument 'checkpoint_path'

download_from_original_stable_diffusion_ckpt ๆฒกๆœ‰ checkpoint_path ๅ‚ๆ•ฐ

DreamArtist่ฎญ็ปƒ็š„safetensorsๅชๆœ‰1KB

ๆˆ‘็š„่ฎญ็ปƒๆญฅ้ชค๏ผš

  1. ไฝฟ็”จrunwayml/stable-diffusion-v1-5็”Ÿๆˆไบ†ไธคไธชembedding
    image
  2. ไฟฎๆ”นyamlๆ–‡ไปถ
    image
    image
  3. ่ฎญ็ปƒ
    ้—ฎ้ข˜๏ผš
    ่ฎญ็ปƒ็š„็ป“ๆžœ
    image
    ๅœจ็”Ÿๆˆๅ›พ็‰‡ๆ—ถไผšๆŠฅ้”™
    image

Does this work well for SDXL training?

I can't tell if it does or doesn't since I need to go back to university just to be able to use it from what I am seeing. Hardest SD based tool I have yet to attempt to try AND it has no real help on it. No vids, no guides, and nothing to help a new user to your tool, just a blinding white wiki documentation page that holds no real value of helping.

image
Even the tutorial section are all 404 errors.

I searched the Internet and came up empty-handed for any info, regardless of which version, for help on your tool.,

Who uses this tool, and does it work well for SDXL training types?

ๆ— ๆณ•้€š่ฟ‡ JsonCaptionLoader ๆญฃ็กฎๅŠ ่ฝฝ็”ฑ gen_from_ptlist ่„šๆœฌ็”Ÿๆˆ็š„ caption

gen_from_ptlist ็”Ÿๆˆ็š„ json keyๅธฆๆ–‡ไปถๆ‰ฉๅฑ•ๅใ€‚TXTCaptionLoader ๅŠ ่ฝฝ็š„ๆ—ถๅ€™้ป˜่ฎคๅ‰”้™คไบ†ๆ–‡ไปถๆ‰ฉๅฑ•ๅใ€‚JsonCaptionLoader / YamlCaptionLoaderๆฒกๆœ‰ๅ‰”้™คๆ–‡ไปถๆ‰ฉๅฑ•ๅใ€‚

ๅ„ไธชๆจกๅ—ไผผไนŽๆฒกๆœ‰็ปŸไธ€ๅธฆไธๅธฆๆ‰ฉๅฑ•ๅใ€‚

Bug report. I think we need MSELoss.

Please do no remove mse_loss.py. I noticed that the file "mse_loss.py" has been removed, specifically the MSELoss module. However, this removal has caused some unexpected errors in the current version.

image

image

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.