modelscope / modelscope/DiffSynth-Studio

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

Open
#584 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13.1k
Forks
1.3k
Avg merge
13h 12m
Merged PRs (30d)
45

Description

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'

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the command from the issue and inspect examples/train/hunyuan_dit/train_hunyuan_dit_lora.py alongside diffsynth/trainers/text_to_image.py. Start with the model-loading output showing that no hunyuan_dit model is loaded, then trace the denoising_model() call. Done means the HunyuanDiT model is recognized and training starts without the NoneType train error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.