modelscope / modelscope/DiffSynth-Studio

Timestep changes when use bfloat16

Open
#562 1 comment 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

Hi, thanks for the great job!

When I run the wan video code, I found some questions about bfloat16, you use timestep = timestep.unsqueeze(0).to(dtype=self.torch_dtype, device=self.device), but the flowmatch scheduler timesteps in your code are in float format like 988.4937, but when changing it to bloat16, the timestep will become weird:

999.3986->1000.
988.4937->988.
987.1741 -> 988.
...

And in original wan, they cast time embedding and layernorm in float32 while you don't, will these reduce the performance?
Looking forward to your reply, thanks!

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

Start with the Wan video code at the timestep conversion shown in the issue, then inspect the flowmatch scheduler values and the time-embedding and layer-normalization paths. Compare bfloat16 and float32 behavior against the original Wan implementation; done means the precision impact and any required change are established with supporting tests or measurements.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.