This model can be used with
Sentence Transformers as a multi-vector (ColBERT-style late interaction) retriever via the
MultiVectorEncoder:
1from sentence_transformers import MultiVectorEncoder
2
3model = MultiVectorEncoder(
4 "VAGOsolutions/SauerkrautLM-ColQwen3-2b-v0.1",
5 model_kwargs={"dtype": "bfloat16"},
6)
7
8queries = [
9 "What is the variable represented on the y-axis of the graph?",
10 "Total outlay is maximum in which year?",
11]
12images = [
13 "https://huggingface.co/datasets/sentence-transformers/example-documents/resolve/main/doc1.jpg",
14 "https://huggingface.co/datasets/sentence-transformers/example-documents/resolve/main/doc2.jpg",
15]
16
17query_embeddings = model.encode_query(queries)
18image_embeddings = model.encode_document(images)
19print(query_embeddings[0].shape, image_embeddings[0].shape)
20# torch.Size([25, 128]) torch.Size([1251, 128])
21
22# Diagonal should have higher scores
23scores = model.similarity(query_embeddings, image_embeddings)
24print(scores)
25# tensor([[15.1758, 9.4717],
26# [ 4.1470, 14.3262]], device='cuda:0')
1import torch
2from PIL import Image
3from sauerkrautlm_colpali.models import ColQwen3, ColQwen3Processor
4
5model_name = "VAGOsolutions/SauerkrautLM-ColQwen3-2b-v0.1"
6
7model = ColQwen3.from_pretrained(
8 model_name,
9 torch_dtype=torch.bfloat16,
10 attn_implementation="flash_attention_2",
11 device_map="cuda:0",
12).eval()
13
14processor = ColQwen3Processor.from_pretrained(model_name)
15
16images = [Image.open("document.png")]
17queries = ["What is the main topic?"]
18
19batch_images = processor.process_images(images).to(model.device)
20batch_queries = processor.process_queries(queries).to(model.device)
21
22with torch.no_grad():
23 image_embeddings = model(**batch_images)
24 query_embeddings = model(**batch_queries)
25
26scores = processor.score(query_embeddings, image_embeddings)
1@misc{sauerkrautlm-colpali-2025,
2 title={SauerkrautLM-ColPali: Multi-Vector Vision Retrieval Models},
3 author={David Golchinfar},
4 organization={VAGO Solutions},
5 year={2025},
6 url={https://github.com/VAGOsolutions/sauerkrautlm-colpali}
7}