aigc-apps / aigc-apps/VideoX-Fun

Inconsistent Handling of Zero-Initialized CLIP Context Between Training and Inference in i2v

Open
#218 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.3k
Forks
188
Avg merge
2d 22h
Merged PRs (30d)
3

Description

Description

I noticed an inconsistency in the way _clip_context is zero-initialized during training versus inference when using cfg in the i2v codebase:

  1. Training
    In scripts/wan2.1_fun/train.py, there is a 10% probability of zero-initializing the CLIP context:

    zero_init_clip_in = np.random.choice([True, False], p=[0.1, 0.9])
    clip_context.append(_clip_context if not zero_init_clip_in else torch.zeros_like(_clip_context))
    
  2. Inference
    During inference with cfg in videox_fun/pipeline/pipeline_wan_fun_inpaint.py, both halves of the context vector are concatenated identically, regardless of zero initialization:

    clip_context_input = (
        torch.cat([clip_context] * 2) if do_classifier_free_guidance 
        else clip_context
    )
    

Question

Is this discrepancy between training and inference intentional? If not, should the inference phase also zero out the conditioning context to better match the training behavior? Thank you!

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

Compare the zero-initialization logic in scripts/wan2.1_fun/train.py with CFG context handling in videox_fun/pipeline/pipeline_wan_fun_inpaint.py. Determine whether the discrepancy is intentional and identify the expected inference behavior; the issue does not name a test or a specific completion criterion.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.