Skip to content

Commit b5fe392

Browse files
Remove some useless code.
1 parent e946667 commit b5fe392

File tree

2 files changed

+13
-199
lines changed

2 files changed

+13
-199
lines changed

comfy/ldm/pixart/pixart.py

Lines changed: 0 additions & 196 deletions
This file was deleted.

comfy/ldm/pixart/pixartms.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,20 @@
1212
T2IFinalLayer,
1313
SizeEmbedder,
1414
)
15-
from comfy.ldm.modules.diffusionmodules.mmdit import TimestepEmbedder, PatchEmbed, Mlp
16-
from .pixart import PixArt, get_2d_sincos_pos_embed_torch
15+
from comfy.ldm.modules.diffusionmodules.mmdit import TimestepEmbedder, PatchEmbed, Mlp, get_1d_sincos_pos_embed_from_grid_torch
1716

1817

18+
def get_2d_sincos_pos_embed_torch(embed_dim, w, h, pe_interpolation=1.0, base_size=16, device=None, dtype=torch.float32):
19+
grid_h, grid_w = torch.meshgrid(
20+
torch.arange(h, device=device, dtype=dtype) / (h/base_size) / pe_interpolation,
21+
torch.arange(w, device=device, dtype=dtype) / (w/base_size) / pe_interpolation,
22+
indexing='ij'
23+
)
24+
emb_h = get_1d_sincos_pos_embed_from_grid_torch(embed_dim // 2, grid_h, device=device, dtype=dtype)
25+
emb_w = get_1d_sincos_pos_embed_from_grid_torch(embed_dim // 2, grid_w, device=device, dtype=dtype)
26+
emb = torch.cat([emb_w, emb_h], dim=1) # (H*W, D)
27+
return emb
28+
1929
class PixArtMSBlock(nn.Module):
2030
"""
2131
A PixArt block with adaptive layer norm zero (adaLN-Zero) conditioning.
@@ -53,7 +63,7 @@ def forward(self, x, y, t, mask=None, HW=None, **kwargs):
5363

5464

5565
### Core PixArt Model ###
56-
class PixArtMS(PixArt):
66+
class PixArtMS(nn.Module):
5767
"""
5868
Diffusion model with a Transformer backbone.
5969
"""

0 commit comments

Comments
 (0)