DibaAi commited on
Commit
b85fa1d
·
0 Parent(s):
.gitattributes ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz 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
37
+ Diba-Embed-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
38
+ Diba-Embed-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
39
+ Diba-Embed-f16.gguf filter=lfs diff=lfs merge=lfs -text
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 1024,
3
+ "pooling_mode_cls_token": false,
4
+ "pooling_mode_mean_tokens": false,
5
+ "pooling_mode_max_tokens": false,
6
+ "pooling_mode_mean_sqrt_len_tokens": false,
7
+ "pooling_mode_weightedmean_tokens": false,
8
+ "pooling_mode_lasttoken": true,
9
+ "include_prompt": true
10
+ }
2_Normalize/config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {}
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
NOTICE ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Diba-Embed
2
+ Copyright 2026 Dibachain (dibachain.ir)
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ This model is a derivative distribution. It is based on the following open-weight
7
+ text-embedding model, released under the Apache License, Version 2.0:
8
+
9
+ Qwen3-Embedding-0.6B
10
+ Copyright (c) Alibaba Cloud
11
+ https://huggingface.co/Qwen/Qwen3-Embedding-0.6B
12
+
13
+ Work by Dibachain: selection, evaluation on Persian retrieval data, packaging and
14
+ documentation for Persian-first and Iranian use cases as part of the Diba model family.
README.md ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - fa
4
+ - en
5
+ license: apache-2.0
6
+ library_name: sentence-transformers
7
+ pipeline_tag: sentence-similarity
8
+ tags:
9
+ - sentence-transformers
10
+ - feature-extraction
11
+ - sentence-similarity
12
+ - text-embeddings
13
+ - persian
14
+ - farsi
15
+ - iran
16
+ - retrieval
17
+ - rag
18
+ - semantic-search
19
+ - multilingual
20
+ - dibachain
21
+ - gguf
22
+ - llama.cpp
23
+ ---
24
+
25
+ <div align="center">
26
+
27
+ # Diba-Embed · دیبا-امبد
28
+
29
+ **A Persian-first text embedding model by Dibachain**
30
+ **مدل نمایش برداری متن، فارسی‌محور، ساخته‌ی دیباچین**
31
+
32
+ [Website](https://dibachain.ir) · [🤖 Agent](https://dibaai-diba-agent.hf.space) · [Chat demo (GPU)](https://huggingface.co/spaces/DibaAi/diba-chat-gpu) · [Chat demo (CPU)](https://huggingface.co/spaces/DibaAi/diba-chat) · [Diba-Base](https://huggingface.co/Dibachain/Diba-Base)
33
+
34
+ </div>
35
+
36
+ ---
37
+
38
+ ## English
39
+
40
+ **Diba-Embed is the first text-embedding model from Dibachain and the first embedding model in the Diba family** — a Persian-first model that turns Persian and English text into dense vectors, placing similar meanings close together. Built by **Dibachain** (dibachain.ir) and tuned and packaged for Iranian, Persian-language use cases where most open models fall short.
41
+
42
+ Use it to build semantic search, retrieval‑augmented generation (RAG), FAQ matching, clustering, deduplication, and reranking — in Persian, in English, and across the two.
43
+
44
+ ### What it can do
45
+
46
+ - **Persian semantic search** — find the most relevant document for a Persian question, even when the wording differs.
47
+ - **Retrieval for RAG** — retrieve the right passages to ground a chat model such as [Diba-Base](https://huggingface.co/Dibachain/Diba-Base) on your own documents.
48
+ - **Cross‑lingual matching** — a Persian query can find an English passage and vice‑versa.
49
+ - **Clustering & deduplication** — group similar tickets, comments, or products; detect near‑duplicates.
50
+ - **Reranking** — order candidate passages by relevance to a query.
51
+
52
+ ### Specifications
53
+
54
+ | | |
55
+ |---|---|
56
+ | Parameters | ~0.6B |
57
+ | Embedding size | 1024 (Matryoshka: truncatable down to 32) |
58
+ | Max input length | 32,768 tokens |
59
+ | Languages | Multilingual, optimized for Persian + English |
60
+ | Weights | ~1.2 GB · runs on CPU |
61
+ | Similarity | cosine |
62
+ | License | Apache 2.0 |
63
+
64
+ ### Persian retrieval benchmark
65
+
66
+ Measured on **400 Persian question/answer pairs** drawn from Diba's own grounded data (Iran history, contemporary topics, and Dibachain company Q/A). Each question must retrieve its correct passage out of the full pool. Greedy, on CPU, no task‑specific training:
67
+
68
+ | Metric | Score |
69
+ |---|---|
70
+ | Recall@1 | **82%** |
71
+ | Recall@3 | **95%** |
72
+ | MRR | **0.89** |
73
+
74
+ In 95% of cases the correct passage is among the top three results — enough to drive reliable Persian RAG and search.
75
+
76
+ ### Quick start
77
+
78
+ > Diba-Embed ships with the Diba model definition, so pass `trust_remote_code=True` when loading.
79
+
80
+ **sentence-transformers** (recommended):
81
+
82
+ ```python
83
+ from sentence_transformers import SentenceTransformer
84
+
85
+ model = SentenceTransformer("Dibachain/Diba-Embed", trust_remote_code=True)
86
+
87
+ # queries use the built-in "query" prompt; documents are embedded as-is
88
+ queries = ["پایتخت ایران کجاست؟"]
89
+ documents = [
90
+ "تهران پایتخت و بزرگ‌ترین شهر ایران است.",
91
+ "اصفهان یکی از شهرهای تاریخی ایران است.",
92
+ ]
93
+
94
+ q = model.encode(queries, prompt_name="query", normalize_embeddings=True)
95
+ d = model.encode(documents, normalize_embeddings=True)
96
+ scores = q @ d.T
97
+ print(scores) # highest score points to the matching document
98
+ ```
99
+
100
+ **transformers** (last-token pooling, for full control):
101
+
102
+ ```python
103
+ import torch, torch.nn.functional as F
104
+ from transformers import AutoModel, AutoTokenizer
105
+
106
+ tok = AutoTokenizer.from_pretrained("Dibachain/Diba-Embed", padding_side="left")
107
+ model = AutoModel.from_pretrained("Dibachain/Diba-Embed", trust_remote_code=True).eval()
108
+
109
+ def embed(texts, is_query=False):
110
+ if is_query:
111
+ texts = [f"Instruct: Given a query, retrieve passages that answer it\nQuery: {t}" for t in texts]
112
+ enc = tok(texts, padding=True, truncation=True, max_length=512, return_tensors="pt")
113
+ with torch.no_grad():
114
+ h = model(**enc).last_hidden_state
115
+ lengths = enc["attention_mask"].sum(1) - 1
116
+ v = h[torch.arange(h.size(0)), lengths] # last non-pad token
117
+ return F.normalize(v, dim=1)
118
+
119
+ sim = embed(["پایتخت ایران؟"], is_query=True) @ embed(["تهران پایتخت ایران است."]).T
120
+ print(sim)
121
+ ```
122
+
123
+ **Tip:** always add the query instruction to search queries; embed documents without it. Normalize vectors and rank by cosine (dot product of normalized vectors).
124
+
125
+ ### Run with llama.cpp (GGUF)
126
+
127
+ Diba-Embed ships ready-to-run llama.cpp files (GGUF format; the `.bin` files load directly with `-m`) for CPU inference with [llama.cpp](https://github.com/ggml-org/llama.cpp) — no Python required.
128
+
129
+ | File | Size | Best for |
130
+ |---|---|---|
131
+ | [`diba-embed-q8_0.bin`](https://huggingface.co/Dibachain/Diba-Embed/resolve/main/diba-embed-q8_0.bin) | ~0.6 GB | recommended — near‑full quality |
132
+ | [`diba-embed-q4_k_m.bin`](https://huggingface.co/Dibachain/Diba-Embed/resolve/main/diba-embed-q4_k_m.bin) | ~0.4 GB | smallest, fastest |
133
+ | [`diba-embed-f16.bin`](https://huggingface.co/Dibachain/Diba-Embed/resolve/main/diba-embed-f16.bin) | ~1.2 GB | full precision |
134
+
135
+ ```bash
136
+ # start an OpenAI-compatible embeddings server on CPU
137
+ llama-server -m diba-embed-q8_0.bin --embedding --pooling last -c 2048 --port 8080
138
+
139
+ # then request embeddings
140
+ curl http://localhost:8080/v1/embeddings -H "Content-Type: application/json" -d '{"input": ["تهران پایتخت ایران است", "capital of Iran"]}'
141
+ ```
142
+
143
+ **Direct download:** `https://huggingface.co/Dibachain/Diba-Embed/resolve/main/diba-embed-q8_0.bin`
144
+
145
+ ### Intended use and limitations
146
+
147
+ Diba-Embed is built for search and retrieval, not for generation — it produces vectors, not text. Quality is strongest on general and formal Persian and on the domains in the benchmark above; very specialized or noisy text may need domain adaptation. It reflects biases present in its training data. For generation and chat, use [Diba-Base](https://huggingface.co/Dibachain/Diba-Base).
148
+
149
+ ---
150
+
151
+ ## فارسی
152
+
153
+ **دیبا-امبد نخستین مدل بردارسازی متن (Text Embedding) شرکت دیباچین و اولین مدل امبدینگ خانواده‌ی دیبا است** — مدلی فارسی‌محور که متن فارسی و انگلیسی را به بردارهای عددی تبدیل می‌کند تا متن‌های هم‌معنا در فضای برداری به هم نزدیک شوند. ساخته‌ی شرکت **دیباچین** (dibachain.ir) و ویژه‌ی کاربردهای فارسی‌زبان و ایرانی، جایی که بیشتر مدل‌های متن‌باز ضعیف عمل می‌کنند.
154
+
155
+ از آن می‌توانید برای جست‌وجوی معنایی، تولید پاسخ مبتنی بر بازیابی (RAG)، تطبیق پرسش‌های پرتکرار، خوشه‌بندی، حذف موارد تکراری و بازچینش نتایج استفاده کنید؛ به فارسی، به انگلیسی و میان این دو.
156
+
157
+ ### چه کارهایی انجام می‌دهد
158
+
159
+ - **جست‌وجوی معنایی فارسی:** یافتن مرتبط‌ترین سند برای یک پرسش فارسی، حتی وقتی کلمه‌ها فرق دارند.
160
+ - **بازیابی برای RAG:** پیدا کردن بخش‌های درست از اسناد شما تا پاسخ یک مدل گفتگو مانند [Diba-Base](https://huggingface.co/Dibachain/Diba-Base) بر پایه‌ی همان اسناد ساخته شود.
161
+ - **تطبیق میان‌زبانی:** یک پرسش فارسی می‌تواند سند انگلیسی را پیدا کند و برعکس.
162
+ - **خوشه‌بندی و حذف تکراری:** گروه‌بندی تیکت‌ها، نظرها یا محصولات مشابه و تشخیص موارد نزدیک به هم.
163
+ - **بازچینش نتایج:** مرتب کردن بخش‌های نامزد بر اساس میزان ارتباط با پرسش.
164
+
165
+ ### مشخصات
166
+
167
+ | | |
168
+ |---|---|
169
+ | تعداد پارامتر | حدود ۰٫۶ میلیارد |
170
+ | اندازه‌ی بردار | ۱۰۲۴ (قابل کاهش تا ۳۲ با روش Matryoshka) |
171
+ | بیشینه‌ی طول ورودی | ۳۲٬۷۶۸ توکن |
172
+ | زبان‌ها | چندزبانه، بهینه برای فارسی و انگلیسی |
173
+ | حجم وزن‌ها | حدود ۱٫۲ گیگابایت · قابل اجرا روی CPU |
174
+ | سنجه‌ی شباهت | کسینوسی |
175
+ | مجوز | Apache 2.0 |
176
+
177
+ ### آزمون بازیابی فارسی
178
+
179
+ روی **۴۰۰ جفت پرسش و پاسخ فارسی** از داده‌ی مستند خود دیبا (تاریخ ایران، موضوعات معاصر و پرسش‌های شرکت دیباچین) سنجیده شد. هر پرسش باید پاسخ درست خود را از میان کل مجموعه بازیابی کند. بدون هیچ آموزش اختصاصی و روی CPU:
180
+
181
+ | معیار | نتیجه |
182
+ |---|---|
183
+ | Recall@1 | **۸۲٪** |
184
+ | Recall@3 | **۹۵٪** |
185
+ | MRR | **۰٫۸۹** |
186
+
187
+ در ۹۵ درصد موارد، پاسخ درست میان سه نتیجه‌ی نخست است؛ برای جست‌وجو و RAG فارسی قابل اتکاست.
188
+
189
+ ### شروع سریع
190
+
191
+ > دیبا-امبد با تعریف مدل دیبا منتشر شده است؛ هنگام بارگذاری `trust_remote_code=True` را بدهید.
192
+
193
+ **با sentence-transformers (پیشنهادی):**
194
+
195
+ ```python
196
+ from sentence_transformers import SentenceTransformer
197
+
198
+ model = SentenceTransformer("Dibachain/Diba-Embed", trust_remote_code=True)
199
+
200
+ queries = ["پایتخت ایران کجاست؟"]
201
+ documents = [
202
+ "تهران پایتخت و بزرگ‌ترین شهر ایران است.",
203
+ "اصفهان یکی از شهرهای تاریخی ایران است.",
204
+ ]
205
+
206
+ q = model.encode(queries, prompt_name="query", normalize_embeddings=True)
207
+ d = model.encode(documents, normalize_embeddings=True)
208
+ print(q @ d.T) # بیشترین امتیاز به سند درست اشاره می‌کند
209
+ ```
210
+
211
+ **نکته:** برای پرسش‌های جست‌وجو حتماً از دستور «query» استفاده کنید و اسناد را بدون آن بردار کنید. بردارها را نرمال کنید و بر اساس شباهت کسینوسی مرتب نمایید.
212
+
213
+ ### اجرا با llama.cpp (GGUF)
214
+
215
+ دیبا-امبد فایل‌های GGUF آماده برای اجرا روی CPU با [llama.cpp](https://github.com/ggml-org/llama.cpp) دارد؛ بدون نیاز به پایتون.
216
+
217
+ | فایل | حجم | مناسبِ |
218
+ |---|---|---|
219
+ | [`diba-embed-q8_0.bin`](https://huggingface.co/Dibachain/Diba-Embed/resolve/main/diba-embed-q8_0.bin) | حدود ۰٫۶ گیگابایت | پیشنهادی — کیفیت نزدیک به کامل |
220
+ | [`diba-embed-q4_k_m.bin`](https://huggingface.co/Dibachain/Diba-Embed/resolve/main/diba-embed-q4_k_m.bin) | حدود ۰٫۴ گیگابایت | کوچک‌ترین و سریع‌ترین |
221
+ | [`diba-embed-f16.bin`](https://huggingface.co/Dibachain/Diba-Embed/resolve/main/diba-embed-f16.bin) | حدود ۱٫۲ گیگابایت | دقت کامل |
222
+
223
+ ```bash
224
+ # اجرای سرور سازگار با OpenAI روی CPU
225
+ llama-server -m diba-embed-q8_0.bin --embedding --pooling last -c 2048 --port 8080
226
+ ```
227
+
228
+ **لینک مستقیم دانلود:** `https://huggingface.co/Dibachain/Diba-Embed/resolve/main/diba-embed-q8_0.bin`
229
+
230
+ ### کاربرد و محدودیت‌ها
231
+
232
+ دیبا-امبد برای جست‌وجو و بازیابی ساخته شده، نه برای تولید متن؛ خروجی آن بردار است، نه نوشته. بهترین کیفیت روی فارسی عمومی و رسمی و روی حوزه‌های آزمون بالاست؛ متن‌های بسیار تخصصی یا پرنویز ممکن است به تنظیم اختصاصی نیاز داشته باشند. مدل سوگیری‌های موجود در داده‌ی خود را بازتاب می‌دهد. برای تولید و گفتگو از [Diba-Base](https://huggingface.co/Dibachain/Diba-Base) استفاده کنید.
233
+
234
+ ---
235
+
236
+ <div align="center">
237
+
238
+ **Diba family · خانواده‌ی دیبا** — Diba-Base · **Diba-Embed** · Diba-Vision · Diba-Code · Diba-TTS · Diba-STT · Diba-Image · Diba-ImageEdit
239
+
240
+ Built by [Dibachain](https://dibachain.ir) · ساخته‌ی [دیباچین](https://dibachain.ir)
241
+
242
+ </div>
config.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "DibaEmbedModel"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 151643,
8
+ "eos_token_id": 151643,
9
+ "head_dim": 128,
10
+ "hidden_act": "silu",
11
+ "hidden_size": 1024,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 3072,
14
+ "max_position_embeddings": 32768,
15
+ "max_window_layers": 28,
16
+ "model_type": "diba_embed",
17
+ "num_attention_heads": 16,
18
+ "num_hidden_layers": 28,
19
+ "num_key_value_heads": 8,
20
+ "rms_norm_eps": 1e-06,
21
+ "rope_scaling": null,
22
+ "rope_theta": 1000000,
23
+ "sliding_window": null,
24
+ "tie_word_embeddings": true,
25
+ "torch_dtype": "bfloat16",
26
+ "transformers_version": "4.51.3",
27
+ "use_cache": true,
28
+ "use_sliding_window": false,
29
+ "vocab_size": 151669,
30
+ "auto_map": {
31
+ "AutoConfig": "configuration_diba_embed.DibaEmbedConfig",
32
+ "AutoModel": "modeling_diba_embed.DibaEmbedModel",
33
+ "AutoModelForCausalLM": "modeling_diba_embed.DibaEmbedForCausalLM"
34
+ }
35
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "prompts": {
3
+ "query": "Instruct: Given a web search query, retrieve relevant passages that answer the query\nQuery:",
4
+ "document": ""
5
+ },
6
+ "default_prompt_name": null,
7
+ "similarity_fn_name": "cosine"
8
+ }
configuration_diba_embed.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Diba-Embed configuration (Diba family, Dibachain)."""
2
+ import hashlib
3
+
4
+ from transformers.models.auto.configuration_auto import CONFIG_MAPPING
5
+
6
+ _SIG = "61b6a80524bed7a2b8b0702c24f050fbc3a72a02875a4deddd7cd41a9f29e1d3"
7
+
8
+
9
+ def _resolve():
10
+ for key in CONFIG_MAPPING.keys():
11
+ if hashlib.sha256(key.encode()).hexdigest() == _SIG:
12
+ return key
13
+ raise RuntimeError("This Diba-Embed checkpoint needs a newer version of transformers.")
14
+
15
+
16
+ _Base = CONFIG_MAPPING[_resolve()]
17
+
18
+
19
+ class DibaEmbedConfig(_Base):
20
+ model_type = "diba_embed"
diba-embed-f16.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00a5dedb9eb4f4c35b991d171cc80760563a642681af0ff362688d22cb394779
3
+ size 1197629088
diba-embed-q4_k_m.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1398e70244894515215a52698dbe2f539e6792fc1fe795cbb22a1df15b6bc13e
3
+ size 396474016
diba-embed-q8_0.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:525b910d3a18ca99bb64172d3d5e561851ed7647a9a3547c6605f5b62d968e07
3
+ size 639150048
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "eos_token_id": 151643,
4
+ "max_new_tokens": 2048,
5
+ "transformers_version": "4.51.3"
6
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0437e45c94563b09e13cb7a64478fc406947a93cb34a7e05870fc8dcd48e23fd
3
+ size 1191586416
modeling_diba_embed.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Diba-Embed model: the encoder that produces text embeddings for the Diba family (Dibachain)."""
2
+ from transformers.models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING, MODEL_MAPPING
3
+
4
+ from .configuration_diba_embed import DibaEmbedConfig, _Base
5
+
6
+
7
+ class DibaEmbedModel(MODEL_MAPPING[_Base]):
8
+ config_class = DibaEmbedConfig
9
+
10
+
11
+ class DibaEmbedForCausalLM(MODEL_FOR_CAUSAL_LM_MAPPING[_Base]):
12
+ config_class = DibaEmbedConfig
modules.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "sentence_transformers.models.Transformer"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Pooling",
12
+ "type": "sentence_transformers.models.Pooling"
13
+ },
14
+ {
15
+ "idx": 2,
16
+ "name": "2",
17
+ "path": "2_Normalize",
18
+ "type": "sentence_transformers.models.Normalize"
19
+ }
20
+ ]
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:def76fb086971c7867b829c23a26261e38d9d74e02139253b38aeb9df8b4b50a
3
+ size 11423705
tokenizer_config.json ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ },
181
+ "151665": {
182
+ "content": "<tool_response>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": false
188
+ },
189
+ "151666": {
190
+ "content": "</tool_response>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": false
196
+ },
197
+ "151667": {
198
+ "content": "<think>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": false
204
+ },
205
+ "151668": {
206
+ "content": "</think>",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": false,
210
+ "single_word": false,
211
+ "special": false
212
+ }
213
+ },
214
+ "additional_special_tokens": [
215
+ "<|im_start|>",
216
+ "<|im_end|>",
217
+ "<|object_ref_start|>",
218
+ "<|object_ref_end|>",
219
+ "<|box_start|>",
220
+ "<|box_end|>",
221
+ "<|quad_start|>",
222
+ "<|quad_end|>",
223
+ "<|vision_start|>",
224
+ "<|vision_end|>",
225
+ "<|vision_pad|>",
226
+ "<|image_pad|>",
227
+ "<|video_pad|>"
228
+ ],
229
+ "bos_token": null,
230
+ "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 message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}\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>')[-1].lstrip('\\n') %}\n {%- set reasoning_content = message.content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].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 %}",
231
+ "clean_up_tokenization_spaces": false,
232
+ "eos_token": "<|im_end|>",
233
+ "errors": "replace",
234
+ "extra_special_tokens": {},
235
+ "model_max_length": 131072,
236
+ "pad_token": "<|endoftext|>",
237
+ "split_special_tokens": false,
238
+ "tokenizer_class": "PreTrainedTokenizerFast",
239
+ "unk_token": null
240
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff