Skip to content

Commit

Permalink
fix: minor error
Browse files Browse the repository at this point in the history
  • Loading branch information
numb3r3 committed Aug 10, 2022
1 parent e30aeb0 commit a72b3fd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/clip_server/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ def attention(self, x: torch.Tensor, attn_mask: Optional[torch.Tensor] = None):
return self.attn(x, x, x, need_weights=False, attn_mask=attn_mask)[0]

def forward(self, x: torch.Tensor, attn_mask: Optional[torch.Tensor] = None):
attn_mask = attn_mask.to(dtype=x.dtype, device=x.device) if attn_mask else None
if attn_mask is not None:
attn_mask = attn_mask.to(dtype=x.dtype, device=x.device)
x = x + self.attention(self.ln_1(x), attn_mask=attn_mask)
x = x + self.mlp(self.ln_2(x))
return x
Expand Down

0 comments on commit a72b3fd

Please sign in to comment.