IrisRainbowNeko / HCP-Diffusion

A universal Stable-Diffusion toolbox
Apache License 2.0
903 stars 77 forks source link

sdxl训练报错,time_ids为None #50

Closed Yimi81 closed 11 months ago

Yimi81 commented 11 months ago

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

Yimi81 commented 11 months ago

已解决,应该使用lora_sdxl的配置文件,其数据集类是hcpdiff.data.CropInfoPairDataset