Ill-Ness commited on
Commit
3f4718a
·
verified ·
1 Parent(s): f279e8b

Upload Supertron2-Reranker-2B

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
1_LogitScore/config.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "true_token_id": 9693,
3
+ "false_token_id": 2152,
4
+ "module_input_name": "causal_logits"
5
+ }
README.md ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: sentence-transformers
3
+ license: apache-2.0
4
+ base_model:
5
+ - Qwen/Qwen3-VL-Reranker-2B
6
+ pipeline_tag: text-ranking
7
+ tags:
8
+ - supertron2
9
+ - reranker
10
+ - qwen3-vl
11
+ - text-ranking
12
+ - cross-encoder
13
+ language:
14
+ - en
15
+ ---
16
+
17
+ # Supertron2-Reranker-2B
18
+
19
+ Supertron2-Reranker-2B is a short fine-tune of `Qwen/Qwen3-VL-Reranker-2B` for text reranking.
20
+
21
+ It is trained on real reranking pairs, primarily MS MARCO, for search and RAG reranking.
22
+
23
+ ## Usage
24
+
25
+ ```python
26
+ from sentence_transformers import CrossEncoder
27
+
28
+ model = CrossEncoder("Surpem/Supertron2-Reranker-2B")
29
+ scores = model.predict([
30
+ ("What is the capital of France?", "Paris is the capital of France."),
31
+ ("What is the capital of France?", "Mars is the red planet."),
32
+ ])
33
+ print(scores)
34
+ ```
35
+
36
+ ## Limitations
37
+
38
+ This is a short 30-minute H100 fine-tune. It should be evaluated on your retrieval domain before production use.
additional_chat_templates/reranker.jinja ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set default_instruction = "Given a search query, retrieve relevant candidates that answer the query." -%}
2
+ {%- set ns = namespace(instruction="", found_instruction=false) -%}
3
+ {%- for message in messages -%}
4
+ {%- if message.role == "system" -%}
5
+ {%- if message.content is string -%}
6
+ {%- set ns.instruction = message.content -%}
7
+ {%- else -%}
8
+ {%- for content in message.content -%}
9
+ {%- if 'text' in content -%}
10
+ {%- set ns.instruction = ns.instruction + content.text -%}
11
+ {%- endif -%}
12
+ {%- endfor -%}
13
+ {%- endif -%}
14
+ {%- set ns.found_instruction = true -%}
15
+ {%- endif -%}
16
+ {%- endfor -%}
17
+ {%- if not ns.found_instruction -%}
18
+ {%- set ns.instruction = default_instruction -%}
19
+ {%- endif -%}
20
+ {%- set image_count = namespace(value=0) -%}
21
+ {%- set video_count = namespace(value=0) -%}
22
+ {%- macro render_multimodal(message) -%}
23
+ {%- if message.content is string -%}
24
+ {{- message.content -}}
25
+ {%- else -%}
26
+ {%- for content in message.content -%}
27
+ {%- if content.type == 'image' or 'image' in content or 'image_url' in content -%}
28
+ {%- set image_count.value = image_count.value + 1 -%}
29
+ {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}
30
+ <|vision_start|><|image_pad|><|vision_end|>
31
+ {%- elif content.type == 'video' or 'video' in content -%}
32
+ {%- set video_count.value = video_count.value + 1 -%}
33
+ {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}
34
+ <|vision_start|><|video_pad|><|vision_end|>
35
+ {%- elif 'text' in content -%}
36
+ {{- content.text -}}
37
+ {%- endif -%}
38
+ {%- endfor -%}
39
+ {%- endif -%}
40
+ {%- endmacro -%}
41
+ {{- '<|im_start|>system\nJudge whether the Document meets the requirements based on the Query and the Instruct provided. Note that the answer can only be "yes" or "no".<|im_end|>\n<|im_start|>user\n<Instruct>: ' + ns.instruction + '<Query>:' -}}
42
+ {%- for message in messages if message.role == "query" -%}
43
+ {{- render_multimodal(message) -}}
44
+ {%- endfor -%}
45
+ {{- '\n<Document>:' -}}
46
+ {%- for message in messages if message.role == "document" -%}
47
+ {{- render_multimodal(message) -}}
48
+ {%- endfor -%}
49
+ {{- '<|im_end|>\n' -}}
50
+ {%- if add_generation_prompt -%}
51
+ {{- '<|im_start|>assistant\n' -}}
52
+ {%- endif -%}
chat_template.jinja ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {%- if messages[0].content is string %}
5
+ {{- messages[0].content }}
6
+ {%- else %}
7
+ {%- for content in messages[0].content %}
8
+ {%- if 'text' in content %}
9
+ {{- content.text }}
10
+ {%- endif %}
11
+ {%- endfor %}
12
+ {%- endif %}
13
+ {{- '\n\n' }}
14
+ {%- endif %}
15
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
16
+ {%- for tool in tools %}
17
+ {{- "\n" }}
18
+ {{- tool | tojson }}
19
+ {%- endfor %}
20
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
21
+ {%- else %}
22
+ {%- if messages[0].role == 'system' %}
23
+ {{- '<|im_start|>system\n' }}
24
+ {%- if messages[0].content is string %}
25
+ {{- messages[0].content }}
26
+ {%- else %}
27
+ {%- for content in messages[0].content %}
28
+ {%- if 'text' in content %}
29
+ {{- content.text }}
30
+ {%- endif %}
31
+ {%- endfor %}
32
+ {%- endif %}
33
+ {{- '<|im_end|>\n' }}
34
+ {%- endif %}
35
+ {%- endif %}
36
+ {%- set image_count = namespace(value=0) %}
37
+ {%- set video_count = namespace(value=0) %}
38
+ {%- for message in messages %}
39
+ {%- if message.role == "user" %}
40
+ {{- '<|im_start|>' + message.role + '\n' }}
41
+ {%- if message.content is string %}
42
+ {{- message.content }}
43
+ {%- else %}
44
+ {%- for content in message.content %}
45
+ {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}
46
+ {%- set image_count.value = image_count.value + 1 %}
47
+ {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}
48
+ <|vision_start|><|image_pad|><|vision_end|>
49
+ {%- elif content.type == 'video' or 'video' in content %}
50
+ {%- set video_count.value = video_count.value + 1 %}
51
+ {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}
52
+ <|vision_start|><|video_pad|><|vision_end|>
53
+ {%- elif 'text' in content %}
54
+ {{- content.text }}
55
+ {%- endif %}
56
+ {%- endfor %}
57
+ {%- endif %}
58
+ {{- '<|im_end|>\n' }}
59
+ {%- elif message.role == "assistant" %}
60
+ {{- '<|im_start|>' + message.role + '\n' }}
61
+ {%- if message.content is string %}
62
+ {{- message.content }}
63
+ {%- else %}
64
+ {%- for content_item in message.content %}
65
+ {%- if 'text' in content_item %}
66
+ {{- content_item.text }}
67
+ {%- endif %}
68
+ {%- endfor %}
69
+ {%- endif %}
70
+ {%- if message.tool_calls %}
71
+ {%- for tool_call in message.tool_calls %}
72
+ {%- if (loop.first and message.content) or (not loop.first) %}
73
+ {{- '\n' }}
74
+ {%- endif %}
75
+ {%- if tool_call.function %}
76
+ {%- set tool_call = tool_call.function %}
77
+ {%- endif %}
78
+ {{- '<tool_call>\n{"name": "' }}
79
+ {{- tool_call.name }}
80
+ {{- '", "arguments": ' }}
81
+ {%- if tool_call.arguments is string %}
82
+ {{- tool_call.arguments }}
83
+ {%- else %}
84
+ {{- tool_call.arguments | tojson }}
85
+ {%- endif %}
86
+ {{- '}\n</tool_call>' }}
87
+ {%- endfor %}
88
+ {%- endif %}
89
+ {{- '<|im_end|>\n' }}
90
+ {%- elif message.role == "tool" %}
91
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
92
+ {{- '<|im_start|>user' }}
93
+ {%- endif %}
94
+ {{- '\n<tool_response>\n' }}
95
+ {%- if message.content is string %}
96
+ {{- message.content }}
97
+ {%- else %}
98
+ {%- for content in message.content %}
99
+ {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}
100
+ {%- set image_count.value = image_count.value + 1 %}
101
+ {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}
102
+ <|vision_start|><|image_pad|><|vision_end|>
103
+ {%- elif content.type == 'video' or 'video' in content %}
104
+ {%- set video_count.value = video_count.value + 1 %}
105
+ {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}
106
+ <|vision_start|><|video_pad|><|vision_end|>
107
+ {%- elif 'text' in content %}
108
+ {{- content.text }}
109
+ {%- endif %}
110
+ {%- endfor %}
111
+ {%- endif %}
112
+ {{- '\n</tool_response>' }}
113
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
114
+ {{- '<|im_end|>\n' }}
115
+ {%- endif %}
116
+ {%- endif %}
117
+ {%- endfor %}
118
+ {%- if add_generation_prompt %}
119
+ {{- '<|im_start|>assistant\n' }}
120
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3VLForConditionalGeneration"
4
+ ],
5
+ "dtype": "bfloat16",
6
+ "hidden_size": 2048,
7
+ "image_token_id": 151655,
8
+ "model_type": "qwen3_vl",
9
+ "pad_token_id": 151643,
10
+ "text_config": {
11
+ "attention_bias": false,
12
+ "attention_dropout": 0.0,
13
+ "bos_token_id": 151643,
14
+ "dtype": "bfloat16",
15
+ "eos_token_id": 151645,
16
+ "head_dim": 128,
17
+ "hidden_act": "silu",
18
+ "hidden_size": 2048,
19
+ "initializer_range": 0.02,
20
+ "intermediate_size": 6144,
21
+ "max_position_embeddings": 262144,
22
+ "model_type": "qwen3_vl_text",
23
+ "num_attention_heads": 16,
24
+ "num_hidden_layers": 28,
25
+ "num_key_value_heads": 8,
26
+ "pad_token_id": 151643,
27
+ "rms_norm_eps": 1e-06,
28
+ "rope_parameters": {
29
+ "mrope_interleaved": true,
30
+ "mrope_section": [
31
+ 24,
32
+ 20,
33
+ 20
34
+ ],
35
+ "rope_theta": 5000000,
36
+ "rope_type": "default"
37
+ },
38
+ "tie_word_embeddings": true,
39
+ "use_cache": false,
40
+ "vocab_size": 151936
41
+ },
42
+ "tie_word_embeddings": true,
43
+ "transformers_version": "5.8.1",
44
+ "use_cache": false,
45
+ "video_token_id": 151656,
46
+ "vision_config": {
47
+ "deepstack_visual_indexes": [
48
+ 5,
49
+ 11,
50
+ 17
51
+ ],
52
+ "depth": 24,
53
+ "dtype": "bfloat16",
54
+ "hidden_act": "gelu_pytorch_tanh",
55
+ "hidden_size": 1024,
56
+ "in_channels": 3,
57
+ "initializer_range": 0.02,
58
+ "intermediate_size": 4096,
59
+ "model_type": "qwen3_vl_vision",
60
+ "num_heads": 16,
61
+ "num_position_embeddings": 2304,
62
+ "out_hidden_size": 2048,
63
+ "pad_token_id": 151643,
64
+ "patch_size": 16,
65
+ "spatial_merge_size": 2,
66
+ "temporal_patch_size": 2
67
+ },
68
+ "vision_end_token_id": 151653,
69
+ "vision_start_token_id": 151652
70
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "pytorch": "2.12.0+cu130",
4
+ "sentence_transformers": "5.5.0",
5
+ "transformers": "5.8.1"
6
+ },
7
+ "activation_fn": "torch.nn.modules.linear.Identity",
8
+ "default_prompt_name": "query",
9
+ "model_type": "CrossEncoder",
10
+ "prompts": {
11
+ "query": "Retrieve text relevant to the user's query."
12
+ }
13
+ }
generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "temperature": 0.7,
10
+ "top_k": 20,
11
+ "top_p": 0.8,
12
+ "transformers_version": "5.8.1"
13
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:71491b2c31e795211dbdc54cc5257ce2822e882f157825ca83fc7e8c0841c559
3
+ size 4255140312
modules.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_LogitScore",
12
+ "type": "sentence_transformers.cross_encoder.modules.logit_score.LogitScore"
13
+ }
14
+ ]
processor_config.json ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "do_convert_rgb": true,
4
+ "do_normalize": true,
5
+ "do_rescale": true,
6
+ "do_resize": true,
7
+ "image_mean": [
8
+ 0.5,
9
+ 0.5,
10
+ 0.5
11
+ ],
12
+ "image_processor_type": "Qwen2VLImageProcessor",
13
+ "image_std": [
14
+ 0.5,
15
+ 0.5,
16
+ 0.5
17
+ ],
18
+ "merge_size": 2,
19
+ "patch_size": 16,
20
+ "resample": 3,
21
+ "rescale_factor": 0.00392156862745098,
22
+ "size": {
23
+ "longest_edge": 1310720,
24
+ "shortest_edge": 4095
25
+ },
26
+ "temporal_patch_size": 2
27
+ },
28
+ "processor_class": "Qwen3VLProcessor",
29
+ "video_processor": {
30
+ "data_format": "channels_first",
31
+ "default_to_square": true,
32
+ "do_convert_rgb": true,
33
+ "do_normalize": true,
34
+ "do_rescale": true,
35
+ "do_resize": true,
36
+ "do_sample_frames": true,
37
+ "fps": 2,
38
+ "image_mean": [
39
+ 0.5,
40
+ 0.5,
41
+ 0.5
42
+ ],
43
+ "image_std": [
44
+ 0.5,
45
+ 0.5,
46
+ 0.5
47
+ ],
48
+ "max_frames": 768,
49
+ "merge_size": 2,
50
+ "min_frames": 4,
51
+ "patch_size": 16,
52
+ "resample": 3,
53
+ "rescale_factor": 0.00392156862745098,
54
+ "return_metadata": false,
55
+ "size": {
56
+ "longest_edge": 25165824,
57
+ "shortest_edge": 4096
58
+ },
59
+ "temporal_patch_size": 2,
60
+ "video_processor_type": "Qwen3VLVideoProcessor"
61
+ }
62
+ }
sentence_bert_config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "transformer_task": "any-to-any",
3
+ "modality_config": {
4
+ "text": {
5
+ "method": "forward",
6
+ "method_output_name": "logits"
7
+ },
8
+ "image": {
9
+ "method": "forward",
10
+ "method_output_name": "logits"
11
+ },
12
+ "video": {
13
+ "method": "forward",
14
+ "method_output_name": "logits"
15
+ },
16
+ "message": {
17
+ "method": "forward",
18
+ "method_output_name": "logits",
19
+ "format": "structured"
20
+ }
21
+ },
22
+ "module_output_name": "causal_logits",
23
+ "processing_kwargs": {
24
+ "chat_template": {
25
+ "chat_template": "reranker",
26
+ "add_generation_prompt": true
27
+ }
28
+ },
29
+ "unpad_inputs": false
30
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9fbb75e98504b6ad46a7cef832d50d56c642fc77ba2c0926ea22d2d35ad4ea68
3
+ size 11422915
tokenizer_config.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": false,
9
+ "local_files_only": false,
10
+ "model_max_length": 768,
11
+ "pad_token": "<|endoftext|>",
12
+ "processor_class": "Qwen3VLProcessor",
13
+ "split_special_tokens": false,
14
+ "tokenizer_class": "Qwen2Tokenizer",
15
+ "unk_token": null
16
+ }