Skip to content

Commit dcc5cdd

Browse files
committed
upate
1 parent b62fedf commit dcc5cdd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llm2clip/eva_clip/model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,9 @@ def lock(self, unlocked_layers, freeze_layer_norm):
242242
def set_grad_checkpointing(self, enable=True):
243243
self.grad_checkpointing = enable
244244

245-
def forward(self, text, return_all_features: bool=False):
245+
def forward(self, text, return_all_features: bool=False, l2_norm: bool=True):
246+
if l2_norm:
247+
x = torch.nn.functional.normalize(x, p=2, dim=-1)
246248
x = self.text_adaptor(text)
247249
return x
248250

0 commit comments

Comments
 (0)