Skip to content
Open
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
8 changes: 4 additions & 4 deletions diffsynth/models/wan_video_image_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from .wan_video_dit import flash_attention


class SelfAttention(nn.Module):
class XLMRobertaSelfAttention(nn.Module):

def __init__(self, dim, num_heads, dropout=0.1, eps=1e-5):
assert dim % num_heads == 0
Expand Down Expand Up @@ -50,7 +50,7 @@ def forward(self, x, mask):
return x


class AttentionBlock(nn.Module):
class XLMRobertaAttentionBlock(nn.Module):

def __init__(self, dim, num_heads, post_norm, dropout=0.1, eps=1e-5):
super().__init__()
Expand All @@ -60,7 +60,7 @@ def __init__(self, dim, num_heads, post_norm, dropout=0.1, eps=1e-5):
self.eps = eps

# layers
self.attn = SelfAttention(dim, num_heads, dropout, eps)
self.attn = XLMRobertaSelfAttention(dim, num_heads, dropout, eps)
self.norm1 = nn.LayerNorm(dim, eps=eps)
self.ffn = nn.Sequential(
nn.Linear(dim, dim * 4), nn.GELU(), nn.Linear(dim * 4, dim),
Expand Down Expand Up @@ -112,7 +112,7 @@ def __init__(self,

# blocks
self.blocks = nn.ModuleList([
AttentionBlock(dim, num_heads, post_norm, dropout, eps)
XLMRobertaAttentionBlock(dim, num_heads, post_norm, dropout, eps)
for _ in range(num_layers)
])

Expand Down