Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
build/
imagebind.egg-info
.DS_Store
venv/
venv/
.checkpoints
9 changes: 7 additions & 2 deletions imagebind/models/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def __init__(self, dim: int) -> None:
self.dim = dim

def forward(self, x):
if x.is_quantized:
x = x.dequantize()

return torch.nn.functional.normalize(x, dim=self.dim, p=2)


Expand All @@ -42,8 +45,10 @@ def forward(self, x):
return torch.clip(self.log_logit_scale.exp(), max=self.max_logit_scale) * x

def extra_repr(self):
st = f"logit_scale_init={self.logit_scale_init},learnable={self.learnable}," \
f" max_logit_scale={self.max_logit_scale}"
st = (
f"logit_scale_init={self.logit_scale_init},learnable={self.learnable},"
f" max_logit_scale={self.max_logit_scale}"
)
return st


Expand Down
Loading