Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

colpali-document-retrieval-vision-language-models-cloud is buggy #977

Closed
suhjohn opened this issue Nov 20, 2024 · 2 comments
Closed

colpali-document-retrieval-vision-language-models-cloud is buggy #977

suhjohn opened this issue Nov 20, 2024 · 2 comments
Assignees

Comments

@suhjohn
Copy link

suhjohn commented Nov 20, 2024

Screenshot 2024-11-20 at 5 03 40 PM
@suhjohn
Copy link
Author

suhjohn commented Nov 20, 2024


for pdf in sample_pdfs:
    page_embeddings = []
    dataloader = DataLoader(
        pdf["images"],
        batch_size=2,
        shuffle=False,
        collate_fn=lambda x: process_images(processor, x),
    )
    for batch_doc in tqdm(dataloader):
        batch_doc = {k: v.to(device) for k, v in batch_doc.items()}
        with torch.no_grad():
            with torch.cuda.amp.autocast():
                embeddings_doc = model(**batch_doc)
        page_embeddings.extend(list(torch.unbind(embeddings_doc.cpu())))
    pdf["embeddings"] = page_embeddings

fix

@thomasht86
Copy link
Collaborator

Thanks for reporting!
Sorry about that - our tests run without GPU, so we didn't catch that one.
I will add a PR with fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants