fixed open-clip-torch version
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ av
|
||||
opencv-python
|
||||
easydict
|
||||
einops
|
||||
open-clip-torch
|
||||
open-clip-torch==2.20.0
|
||||
fairscale
|
||||
torchsde
|
||||
pytorch-lightning
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Copyright (c) Alibaba, Inc. and its affiliates.
|
||||
|
||||
import os
|
||||
from functools import wraps
|
||||
|
||||
import numpy as np
|
||||
import open_clip
|
||||
@@ -60,9 +61,7 @@ class FrozenOpenCLIPEmbedder(nn.Module):
|
||||
x = self.model.token_embedding(text)
|
||||
x = x + self.model.positional_embedding
|
||||
x = x.permute(1, 0, 2)
|
||||
# Fix for PyTorch compatibility: use None for attn_mask to avoid shape mismatch errors
|
||||
# The causal masking will be handled internally by the attention mechanism
|
||||
x = self.text_transformer_forward(x, attn_mask=None)
|
||||
x = self.text_transformer_forward(x, attn_mask=self.model.attn_mask)
|
||||
x = x.permute(1, 0, 2)
|
||||
x = self.model.ln_final(x)
|
||||
return x
|
||||
|
||||
Reference in New Issue
Block a user