Skip to content

Unable to run the code for training HunyuanDiT:AttributeError: 'NoneType' object has no attribute 'train' #584

@mihongyu

Description

@mihongyu

export CUDA_VISIBLE_DEVICES="0"
python examples/train/hunyuan_dit/train_hunyuan_dit_lora.py --pretrained_path /home/ps/AI/images/Tencent-Hunyuan/HunyuanDiT-v1.2/t2i --dataset_path /home/ps/AI/video2/lora/DiffSynth-Studio/lora-stable-diffusion-finetune/data/dog --output_path /home/ps/AI/video2/lora/DiffSynth-Studio/lora-stable-diffusion-finetune/output --max_epochs 1 --steps_per_epoch 500 --height 1024 --width 1024 --center_crop --precision "16-mixed" --learning_rate 1e-4 --lora_rank 4 --lora_alpha 4 --use_gradient_checkpointing

Always prompt the following error message:

Loading models from: /home/ps/AI/images/Tencent-Hunyuan/HunyuanDiT-v1.2/t2i/clip_text_encoder/pytorch_model.bin
model_name: hunyuan_dit_clip_text_encoder model_class: HunyuanDiTCLIPTextEncoder
The following models are loaded: ['hunyuan_dit_clip_text_encoder'].
Loading models from: /home/ps/AI/images/Tencent-Hunyuan/HunyuanDiT-v1.2/t2i/mt5/pytorch_model.bin
model_name: hunyuan_dit_t5_text_encoder model_class: HunyuanDiTT5TextEncoder
The following models are loaded: ['hunyuan_dit_t5_text_encoder'].
Loading models from: /home/ps/AI/images/Tencent-Hunyuan/HunyuanDiT-v1.2/t2i/model/pytorch_model_ema.pt
We cannot detect the model type. No models are loaded.
Loading models from: /home/ps/AI/images/Tencent-Hunyuan/HunyuanDiT-v1.2/t2i/sdxl-vae-fp16-fix/diffusion_pytorch_model.bin
model_name: sdxl_vae_encoder model_class: SDXLVAEEncoder
This model is initialized with extra kwargs: {'upcast_to_float32': True}
model_name: sdxl_vae_decoder model_class: SDXLVAEDecoder
This model is initialized with extra kwargs: {'upcast_to_float32': True}
The following models are loaded: ['sdxl_vae_encoder', 'sdxl_vae_decoder'].
Using hunyuan_dit_clip_text_encoder from /home/ps/AI/images/Tencent-Hunyuan/HunyuanDiT-v1.2/t2i/clip_text_encoder/pytorch_model.bin.
Using hunyuan_dit_t5_text_encoder from /home/ps/AI/images/Tencent-Hunyuan/HunyuanDiT-v1.2/t2i/mt5/pytorch_model.bin.
No hunyuan_dit models available.
Using sdxl_vae_decoder from /home/ps/AI/images/Tencent-Hunyuan/HunyuanDiT-v1.2/t2i/sdxl-vae-fp16-fix/diffusion_pytorch_model.bin.
Using sdxl_vae_encoder from /home/ps/AI/images/Tencent-Hunyuan/HunyuanDiT-v1.2/t2i/sdxl-vae-fp16-fix/diffusion_pytorch_model.bin.
Traceback (most recent call last):
File "/home/ps/disk/nvme1TB/AI/video2/lora/DiffSynth-Studio/examples/train/hunyuan_dit/train_hunyuan_dit_lora.py", line 54, in
model = LightningModel(
File "/home/ps/disk/nvme1TB/AI/video2/lora/DiffSynth-Studio/examples/train/hunyuan_dit/train_hunyuan_dit_lora.py", line 21, in init
self.freeze_parameters()
File "/home/ps/disk/nvme1TB/AI/video2/DiffSynth-Studio-1.1.7/diffsynth/trainers/text_to_image.py", line 34, in freeze_parameters
self.pipe.denoising_model().train()
AttributeError: 'NoneType' object has no attribute 'train'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions