Image-Text-to-Text
Safetensors
ColPali
sentence-transformers
sauerkrautlm-colpali
qwen3_vl
document-retrieval
vision-language-model
multi-vector
late-interaction
visual-retrieval
qwen3-vl
mteb
vidore
conversational
Instructions to use VAGOsolutions/SauerkrautLM-ColQwen3-4b-v0.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ColPali
How to use VAGOsolutions/SauerkrautLM-ColQwen3-4b-v0.1 with ColPali:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- sentence-transformers
How to use VAGOsolutions/SauerkrautLM-ColQwen3-4b-v0.1 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("VAGOsolutions/SauerkrautLM-ColQwen3-4b-v0.1") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Integrate with Sentence Transformers via MultiVectorEncoder
Browse files- 1_Dense/config.json +8 -0
- 1_Dense/model.safetensors +3 -0
- 2_Normalize/config.json +4 -0
- 3_MultiVectorMask/config.json +5 -0
- README.md +40 -0
- additional_chat_templates/sentence_transformers.jinja +17 -0
- config_sentence_transformers.json +9 -0
- modules.json +26 -0
- processor_config.json +3 -0
- sentence_bert_config.json +27 -0
- tokenizer_config.json +2 -1
1_Dense/config.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"in_features": 2560,
|
| 3 |
+
"out_features": 128,
|
| 4 |
+
"bias": true,
|
| 5 |
+
"activation_function": "torch.nn.modules.linear.Identity",
|
| 6 |
+
"module_input_name": "token_embeddings",
|
| 7 |
+
"module_output_name": "token_embeddings"
|
| 8 |
+
}
|
1_Dense/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1dc6f35f67a99e1146d9464051d2cbc8bb5c4b7085ebcf95ba45cf285793a346
|
| 3 |
+
size 1311392
|
2_Normalize/config.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"module_input_name": "token_embeddings",
|
| 3 |
+
"module_output_name": "token_embeddings"
|
| 4 |
+
}
|
3_MultiVectorMask/config.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"skiplist_words": [],
|
| 3 |
+
"skiplist_tasks": [],
|
| 4 |
+
"keep_only_token_ids": null
|
| 5 |
+
}
|
README.md
CHANGED
|
@@ -18,6 +18,7 @@ tags:
|
|
| 18 |
- qwen3-vl
|
| 19 |
- mteb
|
| 20 |
- vidore
|
|
|
|
| 21 |
base_model: Qwen/Qwen3-VL-4B
|
| 22 |
pipeline_tag: image-text-to-text
|
| 23 |
datasets:
|
|
@@ -199,6 +200,45 @@ Traditional OCR-based retrieval **loses layout, tables, and visual context**. Ou
|
|
| 199 |
|
| 200 |
## Installation & Usage
|
| 201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
> ⚠️ **Important**: Install our package first before loading the model:
|
| 203 |
|
| 204 |
```bash
|
|
|
|
| 18 |
- qwen3-vl
|
| 19 |
- mteb
|
| 20 |
- vidore
|
| 21 |
+
- sentence-transformers
|
| 22 |
base_model: Qwen/Qwen3-VL-4B
|
| 23 |
pipeline_tag: image-text-to-text
|
| 24 |
datasets:
|
|
|
|
| 200 |
|
| 201 |
## Installation & Usage
|
| 202 |
|
| 203 |
+
### Sentence Transformers
|
| 204 |
+
|
| 205 |
+
This model can be used with [Sentence Transformers](https://www.sbert.net/) as a multi-vector (ColBERT-style late interaction) retriever via the `MultiVectorEncoder`:
|
| 206 |
+
|
| 207 |
+
```bash
|
| 208 |
+
pip install "sentence-transformers[image]>=6.0.0"
|
| 209 |
+
```
|
| 210 |
+
|
| 211 |
+
```python
|
| 212 |
+
from sentence_transformers import MultiVectorEncoder
|
| 213 |
+
|
| 214 |
+
model = MultiVectorEncoder(
|
| 215 |
+
"VAGOsolutions/SauerkrautLM-ColQwen3-4b-v0.1",
|
| 216 |
+
model_kwargs={"dtype": "bfloat16"},
|
| 217 |
+
)
|
| 218 |
+
|
| 219 |
+
queries = [
|
| 220 |
+
"What is the variable represented on the y-axis of the graph?",
|
| 221 |
+
"Total outlay is maximum in which year?",
|
| 222 |
+
]
|
| 223 |
+
images = [
|
| 224 |
+
"https://huggingface.co/datasets/sentence-transformers/example-documents/resolve/main/doc1.jpg",
|
| 225 |
+
"https://huggingface.co/datasets/sentence-transformers/example-documents/resolve/main/doc2.jpg",
|
| 226 |
+
]
|
| 227 |
+
|
| 228 |
+
query_embeddings = model.encode_query(queries)
|
| 229 |
+
image_embeddings = model.encode_document(images)
|
| 230 |
+
print(query_embeddings[0].shape, image_embeddings[0].shape)
|
| 231 |
+
# torch.Size([25, 128]) torch.Size([1251, 128])
|
| 232 |
+
|
| 233 |
+
# Diagonal should have higher scores
|
| 234 |
+
scores = model.similarity(query_embeddings, image_embeddings)
|
| 235 |
+
print(scores)
|
| 236 |
+
# tensor([[16.3877, 8.1367],
|
| 237 |
+
# [ 5.8350, 15.3848]], device='cuda:0')
|
| 238 |
+
```
|
| 239 |
+
|
| 240 |
+
### SauerkrautLM ColPali
|
| 241 |
+
|
| 242 |
> ⚠️ **Important**: Install our package first before loading the model:
|
| 243 |
|
| 244 |
```bash
|
additional_chat_templates/sentence_transformers.jinja
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- for message in messages -%}
|
| 2 |
+
{%- set ns = namespace(text='') -%}
|
| 3 |
+
{%- if message['content'] is string -%}
|
| 4 |
+
{%- set ns.text = message['content'] -%}
|
| 5 |
+
{%- else -%}
|
| 6 |
+
{%- for item in message['content'] -%}
|
| 7 |
+
{%- if 'text' in item -%}
|
| 8 |
+
{%- set ns.text = ns.text + item.text -%}
|
| 9 |
+
{%- endif -%}
|
| 10 |
+
{%- endfor -%}
|
| 11 |
+
{%- endif -%}
|
| 12 |
+
{%- if task is defined and task == 'query' -%}
|
| 13 |
+
{{- 'Query: ' + ns.text + '<|endoftext|>' * 10 -}}
|
| 14 |
+
{%- else -%}
|
| 15 |
+
{{- '<|im_start|>user\n<|vision_start|><|image_pad|><|vision_end|>Describe the image.<|im_end|><|endoftext|>' -}}
|
| 16 |
+
{%- endif -%}
|
| 17 |
+
{%- endfor -%}
|
config_sentence_transformers.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "MultiVectorEncoder",
|
| 3 |
+
"similarity_fn_name": "maxsim",
|
| 4 |
+
"prompts": {},
|
| 5 |
+
"default_prompt_name": null,
|
| 6 |
+
"__version__": {
|
| 7 |
+
"sentence_transformers": "6.0.0"
|
| 8 |
+
}
|
| 9 |
+
}
|
modules.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"idx": 0,
|
| 4 |
+
"name": "0",
|
| 5 |
+
"path": "",
|
| 6 |
+
"type": "sentence_transformers.base.modules.transformer.Transformer"
|
| 7 |
+
},
|
| 8 |
+
{
|
| 9 |
+
"idx": 1,
|
| 10 |
+
"name": "1",
|
| 11 |
+
"path": "1_Dense",
|
| 12 |
+
"type": "sentence_transformers.base.modules.dense.Dense"
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"idx": 2,
|
| 16 |
+
"name": "2",
|
| 17 |
+
"path": "2_Normalize",
|
| 18 |
+
"type": "sentence_transformers.base.modules.normalize.Normalize"
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"idx": 3,
|
| 22 |
+
"name": "3",
|
| 23 |
+
"path": "3_MultiVectorMask",
|
| 24 |
+
"type": "sentence_transformers.multi_vector_encoder.modules.multi_vector_mask.MultiVectorMask"
|
| 25 |
+
}
|
| 26 |
+
]
|
processor_config.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"processor_class": "Qwen3VLProcessor"
|
| 3 |
+
}
|
sentence_bert_config.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"transformer_task": "feature-extraction",
|
| 3 |
+
"modality_config": {
|
| 4 |
+
"text": {
|
| 5 |
+
"method": "forward",
|
| 6 |
+
"method_output_name": "last_hidden_state"
|
| 7 |
+
},
|
| 8 |
+
"image": {
|
| 9 |
+
"method": "forward",
|
| 10 |
+
"method_output_name": "last_hidden_state"
|
| 11 |
+
},
|
| 12 |
+
"message": {
|
| 13 |
+
"method": "forward",
|
| 14 |
+
"method_output_name": "last_hidden_state",
|
| 15 |
+
"format": "structured"
|
| 16 |
+
}
|
| 17 |
+
},
|
| 18 |
+
"module_output_name": "token_embeddings",
|
| 19 |
+
"processing_kwargs": {
|
| 20 |
+
"chat_template": {
|
| 21 |
+
"chat_template": "sentence_transformers"
|
| 22 |
+
},
|
| 23 |
+
"text": {
|
| 24 |
+
"return_mm_token_type_ids": true
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
}
|
tokenizer_config.json
CHANGED
|
@@ -237,5 +237,6 @@
|
|
| 237 |
"processor_class": "ColQwen3Processor",
|
| 238 |
"split_special_tokens": false,
|
| 239 |
"tokenizer_class": "Qwen2Tokenizer",
|
| 240 |
-
"unk_token": null
|
|
|
|
| 241 |
}
|
|
|
|
| 237 |
"processor_class": "ColQwen3Processor",
|
| 238 |
"split_special_tokens": false,
|
| 239 |
"tokenizer_class": "Qwen2Tokenizer",
|
| 240 |
+
"unk_token": null,
|
| 241 |
+
"padding_side": "left"
|
| 242 |
}
|