-
Notifications
You must be signed in to change notification settings - Fork 65
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
base: main
Are you sure you want to change the base?
Conversation
## 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 | | | ||
|
There was a problem hiding this comment.
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.
# 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 |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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!
Description
colpali-engine