2

I’m trying to use Cache-DiT to accelerate inference for the Wan2.2 model. However, when I run the example script,

python run_wan_2.2_i2v.py --steps 28 --cache

I get the following error.

Namespace(cache=True, compile=False, fuse_lora=False, quantize=False, quantize_type='fp8_w8a8_dq', steps=28, Fn=8, Bn=0, rdt=0.08, max_warmup_steps=8, max_cached_steps=-1, max_continuous_cached_steps=-1, taylorseer=False, taylorseer_order=1, height=None, width=None, parallel_type=None)
Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████| 5/5 [00:05<00:00,  1.05s/it]
Loading pipeline components...:  60%|█████████████████████████████████▌                      | 3/5 [00:05<00:03,  1.55s/it]The config attributes {'clip_output': False} were passed to AutoencoderKLWan, but are not expected and will be ignored. Please verify your config.json configuration file.
Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 10.46it/s]
Loading pipeline components...: 100%|████████████████████████████████████████████████████████| 5/5 [00:07<00:00,  1.46s/it]
Enable model cpu offload for low memory device.
Traceback (most recent call last):
  File "/home/ella/1141/cache-dit/examples/pipeline/run_wan_2.2_i2v.py", line 61, in <module>
    pipe.transformer_2.blocks,
AttributeError: 'NoneType' object has no attribute 'blocks'

I set the model via environment variable:

export WAN_MODEL_NAME="Wan-AI/Wan2.2-TI2V-5B-Diffusers"

Then I ran the example script directly from: examples/pipeline/run_wan_2.2_i2v.py

What I’ve Tried

  • Running without --cache → works fine

  • Switching to Wan2.2-T2V-14B → works fine

What does this error mean? Does it indicate that my model isn’t compatible with Cache-DiT, or is there something wrong with the example script?

1 Answer 1

1

The error occurs because the current run_wan_2.2_i2v.py example in Cache-DiT assumes that the loaded pipeline contains two Transformer modules — pipe.transformer and pipe.transformer_2.

However, the Wan2.2-TI2V-5B model only includes a single transformer, so pipe.transformer_2 is None. When the script tries to run:

pipe.transformer_2.blocks,

it fails with:

AttributeError: 'NoneType' object has no attribute 'blocks'

Root Cause :

  • 14B (T2V) models → dual-transformer architecture (text + video).
  • 5B (TI2V) models → single-transformer architecture. The Cache-DiT example was written for models with two transformers. To make the example work with the 5B model, you can modify the script to handle both cases dynamically. Open examples/pipeline/run_wan_2.2_i2v.py and find the section where Cache-DiT is initialized (around line 61). Replace this part:
pipe.transformer_2.blocks,

with this conditional logic:

if getattr(pipe, "transformer_2", None) is not None:
    cache_dit = CacheDiT([pipe.transformer.blocks, pipe.transformer_2.blocks])
else:
    cache_dit = CacheDiT([pipe.transformer.blocks])

This ensures that Cache-DiT initializes correctly whether the model has one or two transformer modules.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.