Instructions to use Sashavav/rag-resource-allocator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Sashavav/rag-resource-allocator with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("Sashavav/rag-resource-allocator", trust_remote_code=True) model = AutoModel.from_pretrained("Sashavav/rag-resource-allocator", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
Upload ONNX exported Jina reranker bundle (from local checkpoint)
Browse files- README.md +2 -2
- chat_template.jinja +98 -0
- config.json +37 -3
- generation_config.json +1 -1
- model.onnx +2 -2
- model.onnx_data +2 -2
- model.safetensors +1 -1
- onnx_export.json +3 -3
- tokenizer_config.json +0 -1
README.md
CHANGED
|
@@ -7,7 +7,7 @@ tags:
|
|
| 7 |
|
| 8 |
# Jina reranker export
|
| 9 |
|
| 10 |
-
This folder was exported from `/home/Sashavav/git/
|
| 11 |
|
| 12 |
## Artifacts
|
| 13 |
|
|
@@ -18,4 +18,4 @@ This folder was exported from `/home/Sashavav/git/mef_models/models/jina_reranke
|
|
| 18 |
## Export details
|
| 19 |
|
| 20 |
- ONNX opset: 18
|
| 21 |
-
- Exported at: 2026-05-
|
|
|
|
| 7 |
|
| 8 |
# Jina reranker export
|
| 9 |
|
| 10 |
+
This folder was exported from `/home/Sashavav/git/jina-router/outputs/sigma_train2`.
|
| 11 |
|
| 12 |
## Artifacts
|
| 13 |
|
|
|
|
| 18 |
## Export details
|
| 19 |
|
| 20 |
- ONNX opset: 18
|
| 21 |
+
- Exported at: 2026-05-27T16:31:30.760353+00:00
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- if tools %}
|
| 2 |
+
{{- '<|im_start|>system\n' }}
|
| 3 |
+
{%- if messages[0].role == 'system' %}
|
| 4 |
+
{{- messages[0].content + '\n\n' }}
|
| 5 |
+
{%- endif %}
|
| 6 |
+
{{- "# 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>" }}
|
| 7 |
+
{%- for tool in tools %}
|
| 8 |
+
{{- "\n" }}
|
| 9 |
+
{{- tool | tojson }}
|
| 10 |
+
{%- endfor %}
|
| 11 |
+
{{- "\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" }}
|
| 12 |
+
{%- else %}
|
| 13 |
+
{%- if messages[0].role == 'system' %}
|
| 14 |
+
{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
|
| 15 |
+
{%- endif %}
|
| 16 |
+
{%- endif %}
|
| 17 |
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 18 |
+
{%- for forward_message in messages %}
|
| 19 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 20 |
+
{%- set message = messages[index] %}
|
| 21 |
+
{%- set current_content = message.content if message.content is not none else '' %}
|
| 22 |
+
{%- set tool_start = '<tool_response>' %}
|
| 23 |
+
{%- set tool_start_length = tool_start|length %}
|
| 24 |
+
{%- set start_of_message = current_content[:tool_start_length] %}
|
| 25 |
+
{%- set tool_end = '</tool_response>' %}
|
| 26 |
+
{%- set tool_end_length = tool_end|length %}
|
| 27 |
+
{%- set start_pos = (current_content|length) - tool_end_length %}
|
| 28 |
+
{%- if start_pos < 0 %}
|
| 29 |
+
{%- set start_pos = 0 %}
|
| 30 |
+
{%- endif %}
|
| 31 |
+
{%- set end_of_message = current_content[start_pos:] %}
|
| 32 |
+
{%- if ns.multi_step_tool and message.role == "user" and not(start_of_message == tool_start and end_of_message == tool_end) %}
|
| 33 |
+
{%- set ns.multi_step_tool = false %}
|
| 34 |
+
{%- set ns.last_query_index = index %}
|
| 35 |
+
{%- endif %}
|
| 36 |
+
{%- endfor %}
|
| 37 |
+
{%- for message in messages %}
|
| 38 |
+
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
| 39 |
+
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
| 40 |
+
{%- elif message.role == "assistant" %}
|
| 41 |
+
{%- set content = message.content %}
|
| 42 |
+
{%- set reasoning_content = '' %}
|
| 43 |
+
{%- if message.reasoning_content is defined and message.reasoning_content is not none %}
|
| 44 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 45 |
+
{%- else %}
|
| 46 |
+
{%- if '</think>' in message.content %}
|
| 47 |
+
{%- set content = (message.content.split('</think>')|last).lstrip('\n') %}
|
| 48 |
+
{%- set reasoning_content = (message.content.split('</think>')|first).rstrip('\n') %}
|
| 49 |
+
{%- set reasoning_content = (reasoning_content.split('<think>')|last).lstrip('\n') %}
|
| 50 |
+
{%- endif %}
|
| 51 |
+
{%- endif %}
|
| 52 |
+
{%- if loop.index0 > ns.last_query_index %}
|
| 53 |
+
{%- if loop.last or (not loop.last and reasoning_content) %}
|
| 54 |
+
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
| 55 |
+
{%- else %}
|
| 56 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 57 |
+
{%- endif %}
|
| 58 |
+
{%- else %}
|
| 59 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 60 |
+
{%- endif %}
|
| 61 |
+
{%- if message.tool_calls %}
|
| 62 |
+
{%- for tool_call in message.tool_calls %}
|
| 63 |
+
{%- if (loop.first and content) or (not loop.first) %}
|
| 64 |
+
{{- '\n' }}
|
| 65 |
+
{%- endif %}
|
| 66 |
+
{%- if tool_call.function %}
|
| 67 |
+
{%- set tool_call = tool_call.function %}
|
| 68 |
+
{%- endif %}
|
| 69 |
+
{{- '<tool_call>\n{"name": "' }}
|
| 70 |
+
{{- tool_call.name }}
|
| 71 |
+
{{- '", "arguments": ' }}
|
| 72 |
+
{%- if tool_call.arguments is string %}
|
| 73 |
+
{{- tool_call.arguments }}
|
| 74 |
+
{%- else %}
|
| 75 |
+
{{- tool_call.arguments | tojson }}
|
| 76 |
+
{%- endif %}
|
| 77 |
+
{{- '}\n</tool_call>' }}
|
| 78 |
+
{%- endfor %}
|
| 79 |
+
{%- endif %}
|
| 80 |
+
{{- '<|im_end|>\n' }}
|
| 81 |
+
{%- elif message.role == "tool" %}
|
| 82 |
+
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
| 83 |
+
{{- '<|im_start|>user' }}
|
| 84 |
+
{%- endif %}
|
| 85 |
+
{{- '\n<tool_response>\n' }}
|
| 86 |
+
{{- message.content }}
|
| 87 |
+
{{- '\n</tool_response>' }}
|
| 88 |
+
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
| 89 |
+
{{- '<|im_end|>\n' }}
|
| 90 |
+
{%- endif %}
|
| 91 |
+
{%- endif %}
|
| 92 |
+
{%- endfor %}
|
| 93 |
+
{%- if add_generation_prompt %}
|
| 94 |
+
{{- '<|im_start|>assistant\n' }}
|
| 95 |
+
{%- if enable_thinking is defined and enable_thinking is false %}
|
| 96 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 97 |
+
{%- endif %}
|
| 98 |
+
{%- endif %}
|
config.json
CHANGED
|
@@ -8,12 +8,43 @@
|
|
| 8 |
"AutoModel": "modeling.JinaForRanking"
|
| 9 |
},
|
| 10 |
"bos_token_id": 151643,
|
|
|
|
| 11 |
"eos_token_id": 151645,
|
| 12 |
"head_dim": 128,
|
| 13 |
"hidden_act": "silu",
|
| 14 |
"hidden_size": 1024,
|
| 15 |
"initializer_range": 0.02,
|
| 16 |
"intermediate_size": 3072,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
"max_position_embeddings": 131072,
|
| 18 |
"max_window_layers": 28,
|
| 19 |
"model_type": "qwen3",
|
|
@@ -21,12 +52,15 @@
|
|
| 21 |
"num_hidden_layers": 28,
|
| 22 |
"num_key_value_heads": 8,
|
| 23 |
"rms_norm_eps": 1e-06,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
"rope_scaling": null,
|
| 25 |
-
"rope_theta":
|
| 26 |
"sliding_window": null,
|
| 27 |
"tie_word_embeddings": true,
|
| 28 |
-
"
|
| 29 |
-
"transformers_version": "4.51.3",
|
| 30 |
"use_cache": false,
|
| 31 |
"use_sliding_window": false,
|
| 32 |
"vocab_size": 151936
|
|
|
|
| 8 |
"AutoModel": "modeling.JinaForRanking"
|
| 9 |
},
|
| 10 |
"bos_token_id": 151643,
|
| 11 |
+
"dtype": "float32",
|
| 12 |
"eos_token_id": 151645,
|
| 13 |
"head_dim": 128,
|
| 14 |
"hidden_act": "silu",
|
| 15 |
"hidden_size": 1024,
|
| 16 |
"initializer_range": 0.02,
|
| 17 |
"intermediate_size": 3072,
|
| 18 |
+
"layer_types": [
|
| 19 |
+
"full_attention",
|
| 20 |
+
"full_attention",
|
| 21 |
+
"full_attention",
|
| 22 |
+
"full_attention",
|
| 23 |
+
"full_attention",
|
| 24 |
+
"full_attention",
|
| 25 |
+
"full_attention",
|
| 26 |
+
"full_attention",
|
| 27 |
+
"full_attention",
|
| 28 |
+
"full_attention",
|
| 29 |
+
"full_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"full_attention",
|
| 32 |
+
"full_attention",
|
| 33 |
+
"full_attention",
|
| 34 |
+
"full_attention",
|
| 35 |
+
"full_attention",
|
| 36 |
+
"full_attention",
|
| 37 |
+
"full_attention",
|
| 38 |
+
"full_attention",
|
| 39 |
+
"full_attention",
|
| 40 |
+
"full_attention",
|
| 41 |
+
"full_attention",
|
| 42 |
+
"full_attention",
|
| 43 |
+
"full_attention",
|
| 44 |
+
"full_attention",
|
| 45 |
+
"full_attention",
|
| 46 |
+
"full_attention"
|
| 47 |
+
],
|
| 48 |
"max_position_embeddings": 131072,
|
| 49 |
"max_window_layers": 28,
|
| 50 |
"model_type": "qwen3",
|
|
|
|
| 52 |
"num_hidden_layers": 28,
|
| 53 |
"num_key_value_heads": 8,
|
| 54 |
"rms_norm_eps": 1e-06,
|
| 55 |
+
"rope_parameters": {
|
| 56 |
+
"rope_theta": 1000000,
|
| 57 |
+
"rope_type": "default"
|
| 58 |
+
},
|
| 59 |
"rope_scaling": null,
|
| 60 |
+
"rope_theta": 10000.0,
|
| 61 |
"sliding_window": null,
|
| 62 |
"tie_word_embeddings": true,
|
| 63 |
+
"transformers_version": "4.57.6",
|
|
|
|
| 64 |
"use_cache": false,
|
| 65 |
"use_sliding_window": false,
|
| 66 |
"vocab_size": 151936
|
generation_config.json
CHANGED
|
@@ -9,5 +9,5 @@
|
|
| 9 |
"temperature": 0.6,
|
| 10 |
"top_k": 20,
|
| 11 |
"top_p": 0.95,
|
| 12 |
-
"transformers_version": "4.
|
| 13 |
}
|
|
|
|
| 9 |
"temperature": 0.6,
|
| 10 |
"top_k": 20,
|
| 11 |
"top_p": 0.95,
|
| 12 |
+
"transformers_version": "4.57.6"
|
| 13 |
}
|
model.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:898fbc0acf6454f7ccfeff61f07e37b9efd469ad5b52f62ff61085f9a8cd08e8
|
| 3 |
+
size 1422986
|
model.onnx_data
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f18b52c91a2e73d229fc18e57578125e52846db995832e8d4ff28ffa306bb6cd
|
| 3 |
+
size 2387345664
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 2387380888
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5a13279d2697299e2811acfe85c4a37162b7d217767718f5b3bd3b41f7374fee
|
| 3 |
size 2387380888
|
onnx_export.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
{
|
| 2 |
-
"source_model_dir": "/home/Sashavav/git/
|
| 3 |
"hf_model_id": null,
|
| 4 |
"tokenizer_source": null,
|
| 5 |
-
"output_dir": "outputs/
|
| 6 |
-
"onnx_path": "outputs/
|
| 7 |
"opset": 18,
|
| 8 |
"model_class": "JinaForRanking",
|
| 9 |
"loaded_from_hub": false
|
|
|
|
| 1 |
{
|
| 2 |
+
"source_model_dir": "/home/Sashavav/git/jina-router/outputs/sigma_train2",
|
| 3 |
"hf_model_id": null,
|
| 4 |
"tokenizer_source": null,
|
| 5 |
+
"output_dir": "/home/Sashavav/git/jina-router/outputs/sigma_train2/final",
|
| 6 |
+
"onnx_path": "/home/Sashavav/git/jina-router/outputs/sigma_train2/final/model.onnx",
|
| 7 |
"opset": 18,
|
| 8 |
"model_class": "JinaForRanking",
|
| 9 |
"loaded_from_hub": false
|
tokenizer_config.json
CHANGED
|
@@ -241,7 +241,6 @@
|
|
| 241 |
"<|rerank_token|>"
|
| 242 |
],
|
| 243 |
"bos_token": null,
|
| 244 |
-
"chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n\\n' }}\n {%- endif %}\n {{- \"# 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>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\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\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0].content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for forward_message in messages %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- set message = messages[index] %}\n {%- set current_content = message.content if message.content is not none else '' %}\n {%- set tool_start = '<tool_response>' %}\n {%- set tool_start_length = tool_start|length %}\n {%- set start_of_message = current_content[:tool_start_length] %}\n {%- set tool_end = '</tool_response>' %}\n {%- set tool_end_length = tool_end|length %}\n {%- set start_pos = (current_content|length) - tool_end_length %}\n {%- if start_pos < 0 %}\n {%- set start_pos = 0 %}\n {%- endif %}\n {%- set end_of_message = current_content[start_pos:] %}\n {%- if ns.multi_step_tool and message.role == \"user\" and not(start_of_message == tool_start and end_of_message == tool_end) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set content = message.content %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is defined and message.reasoning_content is not none %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in message.content %}\n {%- set content = (message.content.split('</think>')|last).lstrip('\\n') %}\n {%- set reasoning_content = (message.content.split('</think>')|first).rstrip('\\n') %}\n {%- set reasoning_content = (reasoning_content.split('<think>')|last).lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 > ns.last_query_index %}\n {%- if loop.last or (not loop.last and reasoning_content) %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content.strip('\\n') + '\\n</think>\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if enable_thinking is defined and enable_thinking is false %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- endif %}\n{%- endif %}",
|
| 245 |
"clean_up_tokenization_spaces": false,
|
| 246 |
"eos_token": "<|im_end|>",
|
| 247 |
"errors": "replace",
|
|
|
|
| 241 |
"<|rerank_token|>"
|
| 242 |
],
|
| 243 |
"bos_token": null,
|
|
|
|
| 244 |
"clean_up_tokenization_spaces": false,
|
| 245 |
"eos_token": "<|im_end|>",
|
| 246 |
"errors": "replace",
|