Visual Document Retrieval
ColPali
Safetensors
sentence-transformers
English
colsmolvlm
vidore-experimental
vidore
multi-vector
Instructions to use vidore/colSmol-256M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ColPali
How to use vidore/colSmol-256M 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 vidore/colSmol-256M with sentence-transformers:
from sentence_transformers import MultiVectorEncoder model = MultiVectorEncoder("vidore/colSmol-256M") queries = ["Which planet is known as the Red Planet?"] documents = [ "Venus is often called Earth's twin because of its similar size and proximity.", "Mars, known for its reddish appearance, is often referred to as the Red Planet.", "Jupiter, the largest planet in our solar system, has a prominent red spot.", ] query_embeddings = model.encode_query(queries) document_embeddings = model.encode_document(documents) similarities = model.similarity(query_embeddings, document_embeddings) print(similarities) - Notebooks
- Google Colab
- Kaggle
Integrate with Sentence Transformers via MultiVectorEncoder
#2
by tomaarsen HF Staff - opened
- 1_Dense/config.json +9 -0
- 1_Dense/model.safetensors +3 -0
- 2_Normalize/config.json +4 -0
- 3_MultiVectorMask/config.json +3 -0
- README.md +49 -0
- adapter_config.json +1 -1
- additional_chat_templates/sentence_transformers.jinja +25 -0
- chat_template.jinja +2 -0
- chat_template.json +0 -3
- config.json +0 -266
- config_sentence_transformers.json +18 -0
- modules.json +26 -0
- preprocessor_config.json +1 -1
- sentence_bert_config.json +29 -0
- tokenizer_config.json +1 -2
1_Dense/config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"in_features": 576,
|
| 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 |
+
"use_residual": false
|
| 9 |
+
}
|
1_Dense/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ce211361ebcef24a459e172f5683999ea6323b04fea0171c9caf6cd5e2cf4579
|
| 3 |
+
size 295584
|
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,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"skiplist_words": []
|
| 3 |
+
}
|
README.md
CHANGED
|
@@ -8,6 +8,8 @@ tags:
|
|
| 8 |
- colsmolvlm
|
| 9 |
- vidore-experimental
|
| 10 |
- vidore
|
|
|
|
|
|
|
| 11 |
pipeline_tag: visual-document-retrieval
|
| 12 |
---
|
| 13 |
# ColSmolVLM-Instruct-256M: Visual Retriever based on SmolVLM-Instruct-250M with ColBERT strategy
|
|
@@ -45,6 +47,53 @@ We train on a 4 GPU setup with data parallelism, a learning rate of 5e-4 with li
|
|
| 45 |
|
| 46 |
## Usage
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
Make sure `colpali-engine` is installed from source or with a version superior to 0.3.5 (main branch from the repo currently).
|
| 49 |
`transformers` version must be > 4.46.2.
|
| 50 |
|
|
|
|
| 8 |
- colsmolvlm
|
| 9 |
- vidore-experimental
|
| 10 |
- vidore
|
| 11 |
+
- sentence-transformers
|
| 12 |
+
- multi-vector
|
| 13 |
pipeline_tag: visual-document-retrieval
|
| 14 |
---
|
| 15 |
# ColSmolVLM-Instruct-256M: Visual Retriever based on SmolVLM-Instruct-250M with ColBERT strategy
|
|
|
|
| 47 |
|
| 48 |
## Usage
|
| 49 |
|
| 50 |
+
### Using Sentence Transformers
|
| 51 |
+
|
| 52 |
+
ColSmolVLM can be used as a multi-vector (ColBERT-style late interaction) retriever directly with Sentence Transformers via the `MultiVectorEncoder`:
|
| 53 |
+
|
| 54 |
+
```bash
|
| 55 |
+
pip install "sentence-transformers[image]>=6.0.0"
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
```python
|
| 59 |
+
from sentence_transformers import MultiVectorEncoder
|
| 60 |
+
|
| 61 |
+
model = MultiVectorEncoder("vidore/colSmol-256M")
|
| 62 |
+
|
| 63 |
+
queries = [
|
| 64 |
+
"What is the variable represented on the y-axis of the graph?",
|
| 65 |
+
"Total outlay is maximum in which year?",
|
| 66 |
+
]
|
| 67 |
+
images = [
|
| 68 |
+
"https://huggingface.co/datasets/sentence-transformers/example-documents/resolve/main/doc1.jpg",
|
| 69 |
+
"https://huggingface.co/datasets/sentence-transformers/example-documents/resolve/main/doc2.jpg",
|
| 70 |
+
"https://huggingface.co/datasets/sentence-transformers/example-documents/resolve/main/doc3.jpg",
|
| 71 |
+
"https://huggingface.co/datasets/sentence-transformers/example-documents/resolve/main/doc4.jpg",
|
| 72 |
+
]
|
| 73 |
+
|
| 74 |
+
query_embeddings = model.encode_query(queries, convert_to_tensor=True)
|
| 75 |
+
document_embeddings = model.encode_document(images, convert_to_tensor=True)
|
| 76 |
+
print(f"Query 0 shape: {tuple(query_embeddings[0].shape)}")
|
| 77 |
+
print(f"Document 0 shape: {tuple(document_embeddings[0].shape)}")
|
| 78 |
+
# Query 0 shape: (27, 128)
|
| 79 |
+
# Document 0 shape: (1135, 128)
|
| 80 |
+
|
| 81 |
+
# MaxSim late-interaction scoring (rows = queries, columns = images)
|
| 82 |
+
scores = model.similarity(query_embeddings, document_embeddings)
|
| 83 |
+
print(scores)
|
| 84 |
+
# tensor([[18.1855, 16.2119, 11.7363, 9.7974],
|
| 85 |
+
# [ 9.2637, 15.1357, 10.4395, 8.0791]])
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
### Using ColPali Engine
|
| 89 |
+
|
| 90 |
+
> [!WARNING]
|
| 91 |
+
> Note: current `colpali-engine` no longer sends the query prefix and trailing newline that this checkpoint
|
| 92 |
+
> was trained with. The trailing newline went in 0.3.11 (illuin-tech/colpali#280) and the `"Query: "` prefix
|
| 93 |
+
> in 0.3.13 (illuin-tech/colpali#339), and the image document prompt was rewritten in 0.3.9 and again in
|
| 94 |
+
> 0.3.11. The Sentence Transformers configuration in this repository reproduces the original training-time
|
| 95 |
+
> format, so its embeddings differ from current `colpali-engine` output.
|
| 96 |
+
|
| 97 |
Make sure `colpali-engine` is installed from source or with a version superior to 0.3.5 (main branch from the repo currently).
|
| 98 |
`transformers` version must be > 4.46.2.
|
| 99 |
|
adapter_config.json
CHANGED
|
@@ -22,7 +22,7 @@
|
|
| 22 |
"r": 32,
|
| 23 |
"rank_pattern": {},
|
| 24 |
"revision": null,
|
| 25 |
-
"target_modules": "(.*(
|
| 26 |
"task_type": "FEATURE_EXTRACTION",
|
| 27 |
"use_dora": false,
|
| 28 |
"use_rslora": false
|
|
|
|
| 22 |
"r": 32,
|
| 23 |
"rank_pattern": {},
|
| 24 |
"revision": null,
|
| 25 |
+
"target_modules": "(.*(text_model).*(down_proj|gate_proj|up_proj|k_proj|q_proj|v_proj|o_proj).*$|.*(custom_text_proj).*$)",
|
| 26 |
"task_type": "FEATURE_EXTRACTION",
|
| 27 |
"use_dora": false,
|
| 28 |
"use_rslora": false
|
additional_chat_templates/sentence_transformers.jinja
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- for message in messages -%}
|
| 2 |
+
{%- if message['content'] is string -%}
|
| 3 |
+
{%- if task is defined and task == 'query' -%}
|
| 4 |
+
{{- 'Query: ' + message['content'] -}}
|
| 5 |
+
{%- for _ in range(10) -%}{{- '<end_of_utterance>' -}}{%- endfor -%}
|
| 6 |
+
{{- '\n' -}}
|
| 7 |
+
{%- else -%}
|
| 8 |
+
{{- message['content'] -}}
|
| 9 |
+
{%- endif -%}
|
| 10 |
+
{%- else -%}
|
| 11 |
+
{%- for content in message['content'] -%}
|
| 12 |
+
{%- if content['type'] == 'image' -%}
|
| 13 |
+
{{- '<|im_start|>User: Describe the image.<image><end_of_utterance>' -}}
|
| 14 |
+
{%- elif content['type'] == 'text' -%}
|
| 15 |
+
{%- if task is defined and task == 'query' -%}
|
| 16 |
+
{{- 'Query: ' + content['text'] -}}
|
| 17 |
+
{%- for _ in range(10) -%}{{- '<end_of_utterance>' -}}{%- endfor -%}
|
| 18 |
+
{{- '\n' -}}
|
| 19 |
+
{%- else -%}
|
| 20 |
+
{{- content['text'] -}}
|
| 21 |
+
{%- endif -%}
|
| 22 |
+
{%- endif -%}
|
| 23 |
+
{%- endfor -%}
|
| 24 |
+
{%- endif -%}
|
| 25 |
+
{%- endfor -%}
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<|im_start|>{% for message in messages %}{{message['role'] | capitalize}}{% if message['content'][0]['type'] == 'image' %}{{':'}}{% else %}{{': '}}{% endif %}{% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% elif line['type'] == 'image' %}{{ '<image>' }}{% endif %}{% endfor %}<end_of_utterance>
|
| 2 |
+
{% endfor %}{% if add_generation_prompt %}{{ 'Assistant:' }}{% endif %}
|
chat_template.json
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"chat_template": "<|im_start|>{% for message in messages %}{{message['role'] | capitalize}}{% if message['content'][0]['type'] == 'image' %}{{':'}}{% else %}{{': '}}{% endif %}{% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% elif line['type'] == 'image' %}{{ '<image>' }}{% endif %}{% endfor %}<end_of_utterance>\n{% endfor %}{% if add_generation_prompt %}{{ 'Assistant:' }}{% endif %}"
|
| 3 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
config.json
DELETED
|
@@ -1,266 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"_name_or_path": "models/SmolVLM-Instruct-250M",
|
| 3 |
-
"architectures": [
|
| 4 |
-
"ColIdefics3"
|
| 5 |
-
],
|
| 6 |
-
"image_token_id": 49190,
|
| 7 |
-
"model_type": "idefics3",
|
| 8 |
-
"scale_factor": 4,
|
| 9 |
-
"text_config": {
|
| 10 |
-
"_attn_implementation_autoset": false,
|
| 11 |
-
"_flash_attn_2_enabled": true,
|
| 12 |
-
"_name_or_path": "None",
|
| 13 |
-
"add_cross_attention": false,
|
| 14 |
-
"architectures": [
|
| 15 |
-
"VLlama3ForCausalLM"
|
| 16 |
-
],
|
| 17 |
-
"attention_bias": false,
|
| 18 |
-
"attention_dropout": 0.0,
|
| 19 |
-
"bad_words_ids": null,
|
| 20 |
-
"begin_suppress_tokens": null,
|
| 21 |
-
"bos_token_id": 1,
|
| 22 |
-
"chunk_size_feed_forward": 0,
|
| 23 |
-
"cross_attention_hidden_size": null,
|
| 24 |
-
"decoder_start_token_id": null,
|
| 25 |
-
"diversity_penalty": 0.0,
|
| 26 |
-
"do_sample": false,
|
| 27 |
-
"early_stopping": false,
|
| 28 |
-
"encoder_no_repeat_ngram_size": 0,
|
| 29 |
-
"eos_token_id": 2,
|
| 30 |
-
"exponential_decay_length_penalty": null,
|
| 31 |
-
"finetuning_task": null,
|
| 32 |
-
"forced_bos_token_id": null,
|
| 33 |
-
"forced_eos_token_id": null,
|
| 34 |
-
"head_dim": 64,
|
| 35 |
-
"hidden_act": "silu",
|
| 36 |
-
"hidden_size": 576,
|
| 37 |
-
"id2label": {
|
| 38 |
-
"0": "LABEL_0",
|
| 39 |
-
"1": "LABEL_1"
|
| 40 |
-
},
|
| 41 |
-
"initializer_range": 0.041666666666666664,
|
| 42 |
-
"intermediate_size": 1536,
|
| 43 |
-
"is_decoder": false,
|
| 44 |
-
"is_encoder_decoder": false,
|
| 45 |
-
"is_llama_config": true,
|
| 46 |
-
"label2id": {
|
| 47 |
-
"LABEL_0": 0,
|
| 48 |
-
"LABEL_1": 1
|
| 49 |
-
},
|
| 50 |
-
"length_penalty": 1.0,
|
| 51 |
-
"max_length": 20,
|
| 52 |
-
"max_position_embeddings": 8192,
|
| 53 |
-
"min_length": 0,
|
| 54 |
-
"mlp_bias": false,
|
| 55 |
-
"model_type": "llama",
|
| 56 |
-
"neftune_noise_alpha": 0.0,
|
| 57 |
-
"no_repeat_ngram_size": 0,
|
| 58 |
-
"num_attention_heads": 9,
|
| 59 |
-
"num_beam_groups": 1,
|
| 60 |
-
"num_beams": 1,
|
| 61 |
-
"num_hidden_layers": 30,
|
| 62 |
-
"num_key_value_heads": 3,
|
| 63 |
-
"num_return_sequences": 1,
|
| 64 |
-
"output_attentions": false,
|
| 65 |
-
"output_hidden_states": false,
|
| 66 |
-
"output_scores": false,
|
| 67 |
-
"pad_token_id": 2,
|
| 68 |
-
"perceiver_config": {
|
| 69 |
-
"_attn_implementation_autoset": false,
|
| 70 |
-
"_name_or_path": "",
|
| 71 |
-
"add_cross_attention": false,
|
| 72 |
-
"architectures": null,
|
| 73 |
-
"attention_dropout": 0.0,
|
| 74 |
-
"bad_words_ids": null,
|
| 75 |
-
"begin_suppress_tokens": null,
|
| 76 |
-
"bos_token_id": null,
|
| 77 |
-
"chunk_size_feed_forward": 0,
|
| 78 |
-
"cross_attention_hidden_size": null,
|
| 79 |
-
"decoder_start_token_id": null,
|
| 80 |
-
"diversity_penalty": 0.0,
|
| 81 |
-
"do_sample": false,
|
| 82 |
-
"early_stopping": false,
|
| 83 |
-
"encoder_no_repeat_ngram_size": 0,
|
| 84 |
-
"eos_token_id": null,
|
| 85 |
-
"exponential_decay_length_penalty": null,
|
| 86 |
-
"finetuning_task": null,
|
| 87 |
-
"forced_bos_token_id": null,
|
| 88 |
-
"forced_eos_token_id": null,
|
| 89 |
-
"hidden_act": "silu",
|
| 90 |
-
"id2label": {
|
| 91 |
-
"0": "LABEL_0",
|
| 92 |
-
"1": "LABEL_1"
|
| 93 |
-
},
|
| 94 |
-
"is_decoder": false,
|
| 95 |
-
"is_encoder_decoder": false,
|
| 96 |
-
"label2id": {
|
| 97 |
-
"LABEL_0": 0,
|
| 98 |
-
"LABEL_1": 1
|
| 99 |
-
},
|
| 100 |
-
"length_penalty": 1.0,
|
| 101 |
-
"max_length": 20,
|
| 102 |
-
"min_length": 0,
|
| 103 |
-
"model_type": "vllama3",
|
| 104 |
-
"no_repeat_ngram_size": 0,
|
| 105 |
-
"num_beam_groups": 1,
|
| 106 |
-
"num_beams": 1,
|
| 107 |
-
"num_key_value_heads": 1,
|
| 108 |
-
"num_return_sequences": 1,
|
| 109 |
-
"output_attentions": false,
|
| 110 |
-
"output_hidden_states": false,
|
| 111 |
-
"output_scores": false,
|
| 112 |
-
"pad_token_id": null,
|
| 113 |
-
"prefix": null,
|
| 114 |
-
"problem_type": null,
|
| 115 |
-
"pruned_heads": {},
|
| 116 |
-
"qk_layer_norms_perceiver": false,
|
| 117 |
-
"remove_invalid_values": false,
|
| 118 |
-
"repetition_penalty": 1.0,
|
| 119 |
-
"resampler_depth": 6,
|
| 120 |
-
"resampler_head_dim": 96,
|
| 121 |
-
"resampler_n_heads": 16,
|
| 122 |
-
"resampler_n_latents": 64,
|
| 123 |
-
"return_dict": true,
|
| 124 |
-
"return_dict_in_generate": false,
|
| 125 |
-
"sep_token_id": null,
|
| 126 |
-
"suppress_tokens": null,
|
| 127 |
-
"task_specific_params": null,
|
| 128 |
-
"temperature": 1.0,
|
| 129 |
-
"tf_legacy_loss": false,
|
| 130 |
-
"tie_encoder_decoder": false,
|
| 131 |
-
"tie_word_embeddings": true,
|
| 132 |
-
"tokenizer_class": null,
|
| 133 |
-
"top_k": 50,
|
| 134 |
-
"top_p": 1.0,
|
| 135 |
-
"torch_dtype": null,
|
| 136 |
-
"torchscript": false,
|
| 137 |
-
"transformers_version": "4.46.0",
|
| 138 |
-
"typical_p": 1.0,
|
| 139 |
-
"use_bfloat16": false
|
| 140 |
-
},
|
| 141 |
-
"pixel_shuffle_factor": 4,
|
| 142 |
-
"prefix": null,
|
| 143 |
-
"pretraining_tp": 1,
|
| 144 |
-
"problem_type": null,
|
| 145 |
-
"pruned_heads": {},
|
| 146 |
-
"qk_layer_norms": false,
|
| 147 |
-
"remove_invalid_values": false,
|
| 148 |
-
"repetition_penalty": 1.0,
|
| 149 |
-
"return_dict": true,
|
| 150 |
-
"return_dict_in_generate": false,
|
| 151 |
-
"rms_norm_eps": 1e-05,
|
| 152 |
-
"rope_interleaved": false,
|
| 153 |
-
"rope_scaling": null,
|
| 154 |
-
"rope_theta": 100000,
|
| 155 |
-
"sep_token_id": null,
|
| 156 |
-
"suppress_tokens": null,
|
| 157 |
-
"task_specific_params": null,
|
| 158 |
-
"temperature": 1.0,
|
| 159 |
-
"tf_legacy_loss": false,
|
| 160 |
-
"tie_encoder_decoder": false,
|
| 161 |
-
"tie_word_embeddings": false,
|
| 162 |
-
"tokenizer_class": null,
|
| 163 |
-
"top_k": 50,
|
| 164 |
-
"top_p": 1.0,
|
| 165 |
-
"torch_dtype": "bfloat16",
|
| 166 |
-
"torchscript": false,
|
| 167 |
-
"transformers.js_config": {
|
| 168 |
-
"kv_cache_dtype": {
|
| 169 |
-
"fp16": "float16",
|
| 170 |
-
"q4f16": "float16"
|
| 171 |
-
}
|
| 172 |
-
},
|
| 173 |
-
"typical_p": 1.0,
|
| 174 |
-
"use_bfloat16": false,
|
| 175 |
-
"use_cache": true,
|
| 176 |
-
"use_resampler": false,
|
| 177 |
-
"vocab_size": 49280
|
| 178 |
-
},
|
| 179 |
-
"tie_word_embeddings": false,
|
| 180 |
-
"torch_dtype": "bfloat16",
|
| 181 |
-
"transformers_version": "4.46.3",
|
| 182 |
-
"use_cache": true,
|
| 183 |
-
"vision_config": {
|
| 184 |
-
"_attn_implementation_autoset": false,
|
| 185 |
-
"_name_or_path": "",
|
| 186 |
-
"add_cross_attention": false,
|
| 187 |
-
"architectures": null,
|
| 188 |
-
"attention_dropout": 0.0,
|
| 189 |
-
"bad_words_ids": null,
|
| 190 |
-
"begin_suppress_tokens": null,
|
| 191 |
-
"bos_token_id": null,
|
| 192 |
-
"chunk_size_feed_forward": 0,
|
| 193 |
-
"cross_attention_hidden_size": null,
|
| 194 |
-
"decoder_start_token_id": null,
|
| 195 |
-
"diversity_penalty": 0.0,
|
| 196 |
-
"do_sample": false,
|
| 197 |
-
"early_stopping": false,
|
| 198 |
-
"encoder_no_repeat_ngram_size": 0,
|
| 199 |
-
"eos_token_id": null,
|
| 200 |
-
"exponential_decay_length_penalty": null,
|
| 201 |
-
"finetuning_task": null,
|
| 202 |
-
"forced_bos_token_id": null,
|
| 203 |
-
"forced_eos_token_id": null,
|
| 204 |
-
"hidden_act": "gelu_pytorch_tanh",
|
| 205 |
-
"hidden_size": 768,
|
| 206 |
-
"id2label": {
|
| 207 |
-
"0": "LABEL_0",
|
| 208 |
-
"1": "LABEL_1"
|
| 209 |
-
},
|
| 210 |
-
"image_size": 512,
|
| 211 |
-
"initializer_range": 0.02,
|
| 212 |
-
"intermediate_size": 3072,
|
| 213 |
-
"is_decoder": false,
|
| 214 |
-
"is_encoder_decoder": false,
|
| 215 |
-
"label2id": {
|
| 216 |
-
"LABEL_0": 0,
|
| 217 |
-
"LABEL_1": 1
|
| 218 |
-
},
|
| 219 |
-
"layer_norm_eps": 1e-06,
|
| 220 |
-
"length_penalty": 1.0,
|
| 221 |
-
"max_image_size": {
|
| 222 |
-
"longest_edge": 512
|
| 223 |
-
},
|
| 224 |
-
"max_length": 20,
|
| 225 |
-
"min_length": 0,
|
| 226 |
-
"model_type": "idefics3",
|
| 227 |
-
"no_repeat_ngram_size": 0,
|
| 228 |
-
"num_attention_heads": 12,
|
| 229 |
-
"num_beam_groups": 1,
|
| 230 |
-
"num_beams": 1,
|
| 231 |
-
"num_channels": 3,
|
| 232 |
-
"num_hidden_layers": 12,
|
| 233 |
-
"num_return_sequences": 1,
|
| 234 |
-
"output_attentions": false,
|
| 235 |
-
"output_hidden_states": false,
|
| 236 |
-
"output_scores": false,
|
| 237 |
-
"pad_token_id": null,
|
| 238 |
-
"patch_size": 16,
|
| 239 |
-
"prefix": null,
|
| 240 |
-
"problem_type": null,
|
| 241 |
-
"pruned_heads": {},
|
| 242 |
-
"remove_invalid_values": false,
|
| 243 |
-
"repetition_penalty": 1.0,
|
| 244 |
-
"return_dict": true,
|
| 245 |
-
"return_dict_in_generate": false,
|
| 246 |
-
"sep_token_id": null,
|
| 247 |
-
"size": {
|
| 248 |
-
"longest_edge": 2048
|
| 249 |
-
},
|
| 250 |
-
"suppress_tokens": null,
|
| 251 |
-
"task_specific_params": null,
|
| 252 |
-
"temperature": 1.0,
|
| 253 |
-
"tf_legacy_loss": false,
|
| 254 |
-
"tie_encoder_decoder": false,
|
| 255 |
-
"tie_word_embeddings": false,
|
| 256 |
-
"tokenizer_class": null,
|
| 257 |
-
"top_k": 50,
|
| 258 |
-
"top_p": 1.0,
|
| 259 |
-
"torch_dtype": null,
|
| 260 |
-
"torchscript": false,
|
| 261 |
-
"typical_p": 1.0,
|
| 262 |
-
"use_base_siglip": true,
|
| 263 |
-
"use_bfloat16": false
|
| 264 |
-
},
|
| 265 |
-
"vocab_size": 49280
|
| 266 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config_sentence_transformers.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"__version__": {
|
| 3 |
+
"sentence_transformers": "6.0.0"
|
| 4 |
+
},
|
| 5 |
+
"default_prompt_name": null,
|
| 6 |
+
"model_type": "MultiVectorEncoder",
|
| 7 |
+
"requirements": {
|
| 8 |
+
"transformers": {
|
| 9 |
+
"specifier": ">=5.15",
|
| 10 |
+
"reason": "Older versions ignore the key_mapping, which silently randomizes the adapter weights."
|
| 11 |
+
}
|
| 12 |
+
},
|
| 13 |
+
"prompts": {
|
| 14 |
+
"document": "",
|
| 15 |
+
"query": ""
|
| 16 |
+
},
|
| 17 |
+
"similarity_fn_name": null
|
| 18 |
+
}
|
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.sentence_transformer.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 |
+
]
|
preprocessor_config.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
| 19 |
"max_image_size": {
|
| 20 |
"longest_edge": 512
|
| 21 |
},
|
| 22 |
-
"processor_class": "
|
| 23 |
"resample": 1,
|
| 24 |
"rescale_factor": 0.00392156862745098,
|
| 25 |
"size": {
|
|
|
|
| 19 |
"max_image_size": {
|
| 20 |
"longest_edge": 512
|
| 21 |
},
|
| 22 |
+
"processor_class": "Idefics3Processor",
|
| 23 |
"resample": 1,
|
| 24 |
"rescale_factor": 0.00392156862745098,
|
| 25 |
"size": {
|
sentence_bert_config.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"model_kwargs": {
|
| 20 |
+
"key_mapping": {
|
| 21 |
+
"^model\\.": ""
|
| 22 |
+
}
|
| 23 |
+
},
|
| 24 |
+
"processing_kwargs": {
|
| 25 |
+
"chat_template": {
|
| 26 |
+
"chat_template": "sentence_transformers"
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
}
|
tokenizer_config.json
CHANGED
|
@@ -1168,14 +1168,13 @@
|
|
| 1168 |
"<end_of_utterance>"
|
| 1169 |
],
|
| 1170 |
"bos_token": "<|im_start|>",
|
| 1171 |
-
"chat_template": "<|im_start|>{% for message in messages %}{{message['role'] | capitalize}}{% if message['content'][0]['type'] == 'image' %}{{':'}}{% else %}{{': '}}{% endif %}{% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% elif line['type'] == 'image' %}{{ '<image>' }}{% endif %}{% endfor %}<end_of_utterance>\n{% endfor %}{% if add_generation_prompt %}{{ 'Assistant:' }}{% endif %}",
|
| 1172 |
"clean_up_tokenization_spaces": false,
|
| 1173 |
"eos_token": "<|im_end|>",
|
| 1174 |
"extra_special_tokens": {},
|
| 1175 |
"legacy": false,
|
| 1176 |
"model_max_length": 8192,
|
| 1177 |
"pad_token": "<|im_end|>",
|
| 1178 |
-
"processor_class": "
|
| 1179 |
"tokenizer_class": "GPT2Tokenizer",
|
| 1180 |
"truncation_side": "left",
|
| 1181 |
"unk_token": "<|endoftext|>",
|
|
|
|
| 1168 |
"<end_of_utterance>"
|
| 1169 |
],
|
| 1170 |
"bos_token": "<|im_start|>",
|
|
|
|
| 1171 |
"clean_up_tokenization_spaces": false,
|
| 1172 |
"eos_token": "<|im_end|>",
|
| 1173 |
"extra_special_tokens": {},
|
| 1174 |
"legacy": false,
|
| 1175 |
"model_max_length": 8192,
|
| 1176 |
"pad_token": "<|im_end|>",
|
| 1177 |
+
"processor_class": "Idefics3Processor",
|
| 1178 |
"tokenizer_class": "GPT2Tokenizer",
|
| 1179 |
"truncation_side": "left",
|
| 1180 |
"unk_token": "<|endoftext|>",
|