Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SD3.5 - Workaround for Do not promote FP8 error #2220

Draft
wants to merge 1 commit into
base: sd35
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion modules/models/sd35/mmditx.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,10 @@ def forward(
hw = x.shape[-2:]
# The line below should be unnecessary when full integrated.
x = x[:1,:16,:,:]
x = self.x_embedder(x) + self.cropped_pos_embed(hw).to("cuda")
# Workaround for unable to promote FP8 error with FP8 models
x_embed = self.x_embedder(x).to(torch.float32)
pos_embed = self.cropped_pos_embed(hw).to(torch.float32).to("cuda")
x = x_embed + pos_embed
c = self.t_embedder(t, dtype=x.dtype) # (N, D)
if y is not None:
y = self.y_embedder(y) # (N, D)
Expand Down