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

Add tests for ColQwen2 #75

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Add tests for ColQwen2 #75

wants to merge 4 commits into from

Conversation

tonywu71
Copy link
Collaborator

Description

  • Add tests for ColQwen2
  • Add table with available models in colpali-engine

@tonywu71 tonywu71 self-assigned this Sep 27, 2024
Comment on lines +34 to +40
## Supported models

| Model | Score on [ViDoRe](https://huggingface.co/spaces/vidore/vidore-leaderboard) 🏆 | License | Comments |
| -------------------------------------------- | ------------------------------------------------------------ | ---------- | -------- |
| [vidore/colpali-v1.2](vidore/colpali-v1.2) | 83.1 | Gemma | |
| [vidore/colqwen2-base](vidore/colqwen2-base) | 86.6 | Apache 2.0 | |

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ManuelFay Can you help me complete this table today if you've got some time pls? There a few models missing + the comments column to fill.

Comment on lines +71 to +94
# TODO: fix this test
@pytest.mark.slow
def test_forward_queries(
model_from_pretrained: ColQwen2,
processor: ColQwen2Processor,
):
queries = [
"Is attention really all you need?",
"Are Benjamin, Antoine, Merve, and Jo best friends?",
]

# Process the queries
batch_queries = processor.process_queries(queries).to(model_from_pretrained.device)

# Forward pass
with torch.no_grad():
outputs = model_from_pretrained(**batch_queries).to(model_from_pretrained.device)

# Assertions
assert isinstance(outputs, torch.Tensor)
assert outputs.dim() == 3
batch_size, n_query_tokens, emb_dim = outputs.shape
assert batch_size == len(queries)
assert emb_dim == model_from_pretrained.dim
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ManuelFay I've got an error when running this test. Can you help me with this pls?


@pytest.fixture(scope="module")
def model_name() -> str:
return "vidore/colqwen2-base"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ManuelFay Actually just noticed this model is the non-trained version of ColQwen2. We can keep this now, FYI I'll change it to your new checkpoint when you'll be happy with it!

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

Successfully merging this pull request may close these issues.

1 participant