You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from imagebind import data
from imagebind.models import imagebind_model
from imagebind.models.imagebind_model import ModalityType
def getEmbeddingVector(inputs):
with torch.no_grad():
embedding = imagebind_model(inputs)
for key, value in embedding.items():
vec = value.reshape(-1)
return(vec)
def imageToEmbedding(path, device):
inputs = { ModalityType.VISION: data.load_and_transform_vision_data(path, device) }
vec = getEmbeddingVector(inputs)
return(vec)
def textToEmbedding(txt, device):
text_list = [txt]
inputs = {ModalityType.TEXT: data.load_and_transform_text(text_list, device)}
vec = getEmbeddingVector(inputs)
return(vec)
if __name__ == "__main__":
device = "cuda:0" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
imagebind = imagebind_model.imagebind_huge(pretrained=False)
checkpoint_path = "~/.checkpoints/imagebind_huge.pth"
imagebind.load_state_dict(torch.load(checkpoint_path, map_location=device, weights_only=True))
imagebind.eval()
imagebind.to(device)
txt_list = ['This is a cat']
textToEmbedding(txt_list, device)
but I am getting the following error:
Traceback (most recent call last):
File "~/jtr_tqa.py", line 442, in <module>
textToEmbedding(txt_list, device)
File "~/jtr_tqa.py", line 69, in textToEmbedding
vec = getEmbeddingVector(inputs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "~/jtr_tqa.py", line 54, in getEmbeddingVector
embedding = imagebind_model(inputs)
^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'module' object is not callable
please help
The text was updated successfully, but these errors were encountered:
Hello,
I am trying to do the following:
but I am getting the following error:
please help
The text was updated successfully, but these errors were encountered: