csanz91 commited on
Commit
09126c7
·
verified ·
1 Parent(s): ab5abad

Add new SentenceTransformer model

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_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": true,
5
+ "pooling_mode_max_tokens": false,
6
+ "pooling_mode_mean_sqrt_len_tokens": false,
7
+ "pooling_mode_weightedmean_tokens": false,
8
+ "pooling_mode_lasttoken": false,
9
+ "include_prompt": true
10
+ }
README.md ADDED
@@ -0,0 +1,1017 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - es
4
+ license: apache-2.0
5
+ tags:
6
+ - sentence-transformers
7
+ - sentence-similarity
8
+ - feature-extraction
9
+ - generated_from_trainer
10
+ - dataset_size:14907
11
+ - loss:MatryoshkaLoss
12
+ - loss:MultipleNegativesRankingLoss
13
+ base_model: jinaai/jina-embeddings-v3
14
+ widget:
15
+ - source_sentence: Describe la tradición del 'rosario de candiles' en el contexto
16
+ de la minería.
17
+ sentences:
18
+ - Un mechazo es la combustión de la mecha sin que se llegue a inflamar el barreno.
19
+ - La siega tradicional en Escucha comenzaba antes de San Juan con las cebadas.
20
+ - El 'rosario de candiles' es una tradición religiosa celebrada en la festividad
21
+ de San Juan, en la que los mineros escuchan y acompañan con sus candiles de carburo,
22
+ rezando a dos coros y cantando en parte.
23
+ - source_sentence: ¿Qué significa la expresión 'pillar una mojadina'?
24
+ sentences:
25
+ - En el campeonato provincial de atletismo en Alcorisa en mayo, Pilar Brumos de
26
+ Escucha logró la 3ª posición en 600 metros y el subcampeonato en peso.
27
+ - Los empresarios de Escucha se habían unido para poder participar en las elecciones
28
+ a CC.PP. ya que era necesario que la plantilla de la empresa superase el número
29
+ de 50 trabajadores..
30
+ - '''Pillar una mojadina'' significa empaparse, quedar empapado.'
31
+ - source_sentence: ¿En qué año Carbones de Teruel registra la mina 'pablo' en Escucha?
32
+ sentences:
33
+ - Puede referirse a un calcetín para bebés o a un calcetín gordo.
34
+ - Carbones de Teruel registra la mina 'pablo' en Escucha en 1900.
35
+ - 'Jesús Conesa explicó a la Junta de Espectáculos que el anterior propietario,
36
+ Sr. Latorre Galindo, tenía otro cine en Utrillas, lo que causaba continuos equívocos
37
+ en envíos de material y pagos, al creerse que ambos cines le pertenecían o eran
38
+ la misma empresa. '
39
+ - source_sentence: ¿Quién regentaba el Cine Avenida de Escucha en el momento de su
40
+ cierre?
41
+ sentences:
42
+ - Se usa con el significado de 'cuando'.
43
+ - El CD Escucha alineó a Castillo, Romero, Bobadilla, Moraleda, Luis, González,
44
+ Higinio, Torres, Calomarde I, Calomarde II y Navarro en el partido de Copa contra
45
+ el Alcorisa.
46
+ - Antonio Malpica regentaba el Cine Avenida de Escucha en el momento de su cierre.
47
+ - source_sentence: ¿Qué porcentaje de aumento salarial reclamaba el Sindicato Minero
48
+ en el conflicto de Utrillas que llevó a plantear la huelga del 12 de octubre de
49
+ 1930?
50
+ sentences:
51
+ - Antonio Gargallo.
52
+ - Una publicación con una fotografía para el recuerdo de la locomotora llamada 'Escucha'.
53
+ - El Sindicato Minero reclamaba un aumento del 20% los sueldos en el conflicto de
54
+ Utrillas.
55
+ pipeline_tag: sentence-similarity
56
+ library_name: sentence-transformers
57
+ metrics:
58
+ - cosine_accuracy@1
59
+ - cosine_accuracy@3
60
+ - cosine_accuracy@5
61
+ - cosine_accuracy@10
62
+ - cosine_precision@1
63
+ - cosine_precision@3
64
+ - cosine_precision@5
65
+ - cosine_precision@10
66
+ - cosine_recall@1
67
+ - cosine_recall@3
68
+ - cosine_recall@5
69
+ - cosine_recall@10
70
+ - cosine_ndcg@10
71
+ - cosine_mrr@10
72
+ - cosine_map@100
73
+ model-index:
74
+ - name: Lampistero
75
+ results:
76
+ - task:
77
+ type: information-retrieval
78
+ name: Information Retrieval
79
+ dataset:
80
+ name: dim 1024
81
+ type: dim_1024
82
+ metrics:
83
+ - type: cosine_accuracy@1
84
+ value: 0.771876885938443
85
+ name: Cosine Accuracy@1
86
+ - type: cosine_accuracy@3
87
+ value: 0.8931804465902233
88
+ name: Cosine Accuracy@3
89
+ - type: cosine_accuracy@5
90
+ value: 0.9136994568497284
91
+ name: Cosine Accuracy@5
92
+ - type: cosine_accuracy@10
93
+ value: 0.928183464091732
94
+ name: Cosine Accuracy@10
95
+ - type: cosine_precision@1
96
+ value: 0.771876885938443
97
+ name: Cosine Precision@1
98
+ - type: cosine_precision@3
99
+ value: 0.2977268155300744
100
+ name: Cosine Precision@3
101
+ - type: cosine_precision@5
102
+ value: 0.18273989136994565
103
+ name: Cosine Precision@5
104
+ - type: cosine_precision@10
105
+ value: 0.0928183464091732
106
+ name: Cosine Precision@10
107
+ - type: cosine_recall@1
108
+ value: 0.771876885938443
109
+ name: Cosine Recall@1
110
+ - type: cosine_recall@3
111
+ value: 0.8931804465902233
112
+ name: Cosine Recall@3
113
+ - type: cosine_recall@5
114
+ value: 0.9136994568497284
115
+ name: Cosine Recall@5
116
+ - type: cosine_recall@10
117
+ value: 0.928183464091732
118
+ name: Cosine Recall@10
119
+ - type: cosine_ndcg@10
120
+ value: 0.8567624282543636
121
+ name: Cosine Ndcg@10
122
+ - type: cosine_mrr@10
123
+ value: 0.8330754087996087
124
+ name: Cosine Mrr@10
125
+ - type: cosine_map@100
126
+ value: 0.8344062726339423
127
+ name: Cosine Map@100
128
+ - task:
129
+ type: information-retrieval
130
+ name: Information Retrieval
131
+ dataset:
132
+ name: dim 768
133
+ type: dim_768
134
+ metrics:
135
+ - type: cosine_accuracy@1
136
+ value: 0.7706698853349426
137
+ name: Cosine Accuracy@1
138
+ - type: cosine_accuracy@3
139
+ value: 0.8925769462884732
140
+ name: Cosine Accuracy@3
141
+ - type: cosine_accuracy@5
142
+ value: 0.9118889559444779
143
+ name: Cosine Accuracy@5
144
+ - type: cosine_accuracy@10
145
+ value: 0.9287869643934822
146
+ name: Cosine Accuracy@10
147
+ - type: cosine_precision@1
148
+ value: 0.7706698853349426
149
+ name: Cosine Precision@1
150
+ - type: cosine_precision@3
151
+ value: 0.2975256487628244
152
+ name: Cosine Precision@3
153
+ - type: cosine_precision@5
154
+ value: 0.18237779118889558
155
+ name: Cosine Precision@5
156
+ - type: cosine_precision@10
157
+ value: 0.09287869643934822
158
+ name: Cosine Precision@10
159
+ - type: cosine_recall@1
160
+ value: 0.7706698853349426
161
+ name: Cosine Recall@1
162
+ - type: cosine_recall@3
163
+ value: 0.8925769462884732
164
+ name: Cosine Recall@3
165
+ - type: cosine_recall@5
166
+ value: 0.9118889559444779
167
+ name: Cosine Recall@5
168
+ - type: cosine_recall@10
169
+ value: 0.9287869643934822
170
+ name: Cosine Recall@10
171
+ - type: cosine_ndcg@10
172
+ value: 0.8563506024476554
173
+ name: Cosine Ndcg@10
174
+ - type: cosine_mrr@10
175
+ value: 0.8323629431655981
176
+ name: Cosine Mrr@10
177
+ - type: cosine_map@100
178
+ value: 0.8335898787409641
179
+ name: Cosine Map@100
180
+ - task:
181
+ type: information-retrieval
182
+ name: Information Retrieval
183
+ dataset:
184
+ name: dim 512
185
+ type: dim_512
186
+ metrics:
187
+ - type: cosine_accuracy@1
188
+ value: 0.7682558841279421
189
+ name: Cosine Accuracy@1
190
+ - type: cosine_accuracy@3
191
+ value: 0.891973445986723
192
+ name: Cosine Accuracy@3
193
+ - type: cosine_accuracy@5
194
+ value: 0.9106819553409776
195
+ name: Cosine Accuracy@5
196
+ - type: cosine_accuracy@10
197
+ value: 0.9299939649969825
198
+ name: Cosine Accuracy@10
199
+ - type: cosine_precision@1
200
+ value: 0.7682558841279421
201
+ name: Cosine Precision@1
202
+ - type: cosine_precision@3
203
+ value: 0.2973244819955743
204
+ name: Cosine Precision@3
205
+ - type: cosine_precision@5
206
+ value: 0.1821363910681955
207
+ name: Cosine Precision@5
208
+ - type: cosine_precision@10
209
+ value: 0.09299939649969825
210
+ name: Cosine Precision@10
211
+ - type: cosine_recall@1
212
+ value: 0.7682558841279421
213
+ name: Cosine Recall@1
214
+ - type: cosine_recall@3
215
+ value: 0.891973445986723
216
+ name: Cosine Recall@3
217
+ - type: cosine_recall@5
218
+ value: 0.9106819553409776
219
+ name: Cosine Recall@5
220
+ - type: cosine_recall@10
221
+ value: 0.9299939649969825
222
+ name: Cosine Recall@10
223
+ - type: cosine_ndcg@10
224
+ value: 0.8553875428985249
225
+ name: Cosine Ndcg@10
226
+ - type: cosine_mrr@10
227
+ value: 0.8307586381967789
228
+ name: Cosine Mrr@10
229
+ - type: cosine_map@100
230
+ value: 0.8318464309684749
231
+ name: Cosine Map@100
232
+ - task:
233
+ type: information-retrieval
234
+ name: Information Retrieval
235
+ dataset:
236
+ name: dim 256
237
+ type: dim_256
238
+ metrics:
239
+ - type: cosine_accuracy@1
240
+ value: 0.7646348823174411
241
+ name: Cosine Accuracy@1
242
+ - type: cosine_accuracy@3
243
+ value: 0.8883524441762221
244
+ name: Cosine Accuracy@3
245
+ - type: cosine_accuracy@5
246
+ value: 0.9058539529269765
247
+ name: Cosine Accuracy@5
248
+ - type: cosine_accuracy@10
249
+ value: 0.9251659625829813
250
+ name: Cosine Accuracy@10
251
+ - type: cosine_precision@1
252
+ value: 0.7646348823174411
253
+ name: Cosine Precision@1
254
+ - type: cosine_precision@3
255
+ value: 0.296117481392074
256
+ name: Cosine Precision@3
257
+ - type: cosine_precision@5
258
+ value: 0.18117079058539529
259
+ name: Cosine Precision@5
260
+ - type: cosine_precision@10
261
+ value: 0.09251659625829814
262
+ name: Cosine Precision@10
263
+ - type: cosine_recall@1
264
+ value: 0.7646348823174411
265
+ name: Cosine Recall@1
266
+ - type: cosine_recall@3
267
+ value: 0.8883524441762221
268
+ name: Cosine Recall@3
269
+ - type: cosine_recall@5
270
+ value: 0.9058539529269765
271
+ name: Cosine Recall@5
272
+ - type: cosine_recall@10
273
+ value: 0.9251659625829813
274
+ name: Cosine Recall@10
275
+ - type: cosine_ndcg@10
276
+ value: 0.8515592939892533
277
+ name: Cosine Ndcg@10
278
+ - type: cosine_mrr@10
279
+ value: 0.827186251688363
280
+ name: Cosine Mrr@10
281
+ - type: cosine_map@100
282
+ value: 0.8285316886087458
283
+ name: Cosine Map@100
284
+ - task:
285
+ type: information-retrieval
286
+ name: Information Retrieval
287
+ dataset:
288
+ name: dim 128
289
+ type: dim_128
290
+ metrics:
291
+ - type: cosine_accuracy@1
292
+ value: 0.7531683765841883
293
+ name: Cosine Accuracy@1
294
+ - type: cosine_accuracy@3
295
+ value: 0.8774894387447194
296
+ name: Cosine Accuracy@3
297
+ - type: cosine_accuracy@5
298
+ value: 0.8968014484007242
299
+ name: Cosine Accuracy@5
300
+ - type: cosine_accuracy@10
301
+ value: 0.9161134580567291
302
+ name: Cosine Accuracy@10
303
+ - type: cosine_precision@1
304
+ value: 0.7531683765841883
305
+ name: Cosine Precision@1
306
+ - type: cosine_precision@3
307
+ value: 0.2924964795815731
308
+ name: Cosine Precision@3
309
+ - type: cosine_precision@5
310
+ value: 0.17936028968014484
311
+ name: Cosine Precision@5
312
+ - type: cosine_precision@10
313
+ value: 0.09161134580567289
314
+ name: Cosine Precision@10
315
+ - type: cosine_recall@1
316
+ value: 0.7531683765841883
317
+ name: Cosine Recall@1
318
+ - type: cosine_recall@3
319
+ value: 0.8774894387447194
320
+ name: Cosine Recall@3
321
+ - type: cosine_recall@5
322
+ value: 0.8968014484007242
323
+ name: Cosine Recall@5
324
+ - type: cosine_recall@10
325
+ value: 0.9161134580567291
326
+ name: Cosine Recall@10
327
+ - type: cosine_ndcg@10
328
+ value: 0.8412352149980756
329
+ name: Cosine Ndcg@10
330
+ - type: cosine_mrr@10
331
+ value: 0.8165177074652028
332
+ name: Cosine Mrr@10
333
+ - type: cosine_map@100
334
+ value: 0.8182055440879425
335
+ name: Cosine Map@100
336
+ - task:
337
+ type: information-retrieval
338
+ name: Information Retrieval
339
+ dataset:
340
+ name: dim 64
341
+ type: dim_64
342
+ metrics:
343
+ - type: cosine_accuracy@1
344
+ value: 0.7109233554616777
345
+ name: Cosine Accuracy@1
346
+ - type: cosine_accuracy@3
347
+ value: 0.8503319251659626
348
+ name: Cosine Accuracy@3
349
+ - type: cosine_accuracy@5
350
+ value: 0.8750754375377188
351
+ name: Cosine Accuracy@5
352
+ - type: cosine_accuracy@10
353
+ value: 0.8974049487024743
354
+ name: Cosine Accuracy@10
355
+ - type: cosine_precision@1
356
+ value: 0.7109233554616777
357
+ name: Cosine Precision@1
358
+ - type: cosine_precision@3
359
+ value: 0.2834439750553209
360
+ name: Cosine Precision@3
361
+ - type: cosine_precision@5
362
+ value: 0.17501508750754374
363
+ name: Cosine Precision@5
364
+ - type: cosine_precision@10
365
+ value: 0.08974049487024743
366
+ name: Cosine Precision@10
367
+ - type: cosine_recall@1
368
+ value: 0.7109233554616777
369
+ name: Cosine Recall@1
370
+ - type: cosine_recall@3
371
+ value: 0.8503319251659626
372
+ name: Cosine Recall@3
373
+ - type: cosine_recall@5
374
+ value: 0.8750754375377188
375
+ name: Cosine Recall@5
376
+ - type: cosine_recall@10
377
+ value: 0.8974049487024743
378
+ name: Cosine Recall@10
379
+ - type: cosine_ndcg@10
380
+ value: 0.8110786488208866
381
+ name: Cosine Ndcg@10
382
+ - type: cosine_mrr@10
383
+ value: 0.7826713988753816
384
+ name: Cosine Mrr@10
385
+ - type: cosine_map@100
386
+ value: 0.7847527919142971
387
+ name: Cosine Map@100
388
+ ---
389
+
390
+ # Lampistero
391
+
392
+ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [jinaai/jina-embeddings-v3](https://huggingface.co/jinaai/jina-embeddings-v3) on the json dataset. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
393
+
394
+ ## Model Details
395
+
396
+ ### Model Description
397
+ - **Model Type:** Sentence Transformer
398
+ - **Base model:** [jinaai/jina-embeddings-v3](https://huggingface.co/jinaai/jina-embeddings-v3) <!-- at revision f1944de8402dcd5f2b03f822a4bc22a7f2de2eb9 -->
399
+ - **Maximum Sequence Length:** 8194 tokens
400
+ - **Output Dimensionality:** 1024 dimensions
401
+ - **Similarity Function:** Cosine Similarity
402
+ - **Training Dataset:**
403
+ - json
404
+ - **Language:** es
405
+ - **License:** apache-2.0
406
+
407
+ ### Model Sources
408
+
409
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
410
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
411
+ - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
412
+
413
+ ### Full Model Architecture
414
+
415
+ ```
416
+ SentenceTransformer(
417
+ (transformer): Transformer(
418
+ (auto_model): XLMRobertaLoRA(
419
+ (roberta): XLMRobertaModel(
420
+ (embeddings): XLMRobertaEmbeddings(
421
+ (word_embeddings): ParametrizedEmbedding(
422
+ 250002, 1024, padding_idx=1
423
+ (parametrizations): ModuleDict(
424
+ (weight): ParametrizationList(
425
+ (0): LoRAParametrization()
426
+ )
427
+ )
428
+ )
429
+ (token_type_embeddings): ParametrizedEmbedding(
430
+ 1, 1024
431
+ (parametrizations): ModuleDict(
432
+ (weight): ParametrizationList(
433
+ (0): LoRAParametrization()
434
+ )
435
+ )
436
+ )
437
+ )
438
+ (emb_drop): Dropout(p=0.1, inplace=False)
439
+ (emb_ln): LayerNorm((1024,), eps=1e-05, elementwise_affine=True)
440
+ (encoder): XLMRobertaEncoder(
441
+ (layers): ModuleList(
442
+ (0-23): 24 x Block(
443
+ (mixer): MHA(
444
+ (rotary_emb): RotaryEmbedding()
445
+ (Wqkv): ParametrizedLinearResidual(
446
+ in_features=1024, out_features=3072, bias=True
447
+ (parametrizations): ModuleDict(
448
+ (weight): ParametrizationList(
449
+ (0): LoRAParametrization()
450
+ )
451
+ )
452
+ )
453
+ (inner_attn): FlashSelfAttention(
454
+ (drop): Dropout(p=0.1, inplace=False)
455
+ )
456
+ (inner_cross_attn): FlashCrossAttention(
457
+ (drop): Dropout(p=0.1, inplace=False)
458
+ )
459
+ (out_proj): ParametrizedLinear(
460
+ in_features=1024, out_features=1024, bias=True
461
+ (parametrizations): ModuleDict(
462
+ (weight): ParametrizationList(
463
+ (0): LoRAParametrization()
464
+ )
465
+ )
466
+ )
467
+ )
468
+ (dropout1): Dropout(p=0.1, inplace=False)
469
+ (drop_path1): StochasticDepth(p=0.0, mode=row)
470
+ (norm1): LayerNorm((1024,), eps=1e-05, elementwise_affine=True)
471
+ (mlp): Mlp(
472
+ (fc1): ParametrizedLinear(
473
+ in_features=1024, out_features=4096, bias=True
474
+ (parametrizations): ModuleDict(
475
+ (weight): ParametrizationList(
476
+ (0): LoRAParametrization()
477
+ )
478
+ )
479
+ )
480
+ (fc2): ParametrizedLinear(
481
+ in_features=4096, out_features=1024, bias=True
482
+ (parametrizations): ModuleDict(
483
+ (weight): ParametrizationList(
484
+ (0): LoRAParametrization()
485
+ )
486
+ )
487
+ )
488
+ )
489
+ (dropout2): Dropout(p=0.1, inplace=False)
490
+ (drop_path2): StochasticDepth(p=0.0, mode=row)
491
+ (norm2): LayerNorm((1024,), eps=1e-05, elementwise_affine=True)
492
+ )
493
+ )
494
+ )
495
+ (pooler): XLMRobertaPooler(
496
+ (dense): ParametrizedLinear(
497
+ in_features=1024, out_features=1024, bias=True
498
+ (parametrizations): ModuleDict(
499
+ (weight): ParametrizationList(
500
+ (0): LoRAParametrization()
501
+ )
502
+ )
503
+ )
504
+ (activation): Tanh()
505
+ )
506
+ )
507
+ )
508
+ )
509
+ (pooler): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
510
+ (normalizer): Normalize()
511
+ )
512
+ ```
513
+
514
+ ## Usage
515
+
516
+ ### Direct Usage (Sentence Transformers)
517
+
518
+ First install the Sentence Transformers library:
519
+
520
+ ```bash
521
+ pip install -U sentence-transformers
522
+ ```
523
+
524
+ Then you can load this model and run inference.
525
+ ```python
526
+ from sentence_transformers import SentenceTransformer
527
+
528
+ # Download from the 🤗 Hub
529
+ model = SentenceTransformer("csanz91/lampistero_rag_embeddings")
530
+ # Run inference
531
+ sentences = [
532
+ '¿Qué porcentaje de aumento salarial reclamaba el Sindicato Minero en el conflicto de Utrillas que llevó a plantear la huelga del 12 de octubre de 1930?',
533
+ 'El Sindicato Minero reclamaba un aumento del 20% los sueldos en el conflicto de Utrillas.',
534
+ 'Antonio Gargallo.',
535
+ ]
536
+ embeddings = model.encode(sentences)
537
+ print(embeddings.shape)
538
+ # [3, 1024]
539
+
540
+ # Get the similarity scores for the embeddings
541
+ similarities = model.similarity(embeddings, embeddings)
542
+ print(similarities.shape)
543
+ # [3, 3]
544
+ ```
545
+
546
+ <!--
547
+ ### Direct Usage (Transformers)
548
+
549
+ <details><summary>Click to see the direct usage in Transformers</summary>
550
+
551
+ </details>
552
+ -->
553
+
554
+ <!--
555
+ ### Downstream Usage (Sentence Transformers)
556
+
557
+ You can finetune this model on your own dataset.
558
+
559
+ <details><summary>Click to expand</summary>
560
+
561
+ </details>
562
+ -->
563
+
564
+ <!--
565
+ ### Out-of-Scope Use
566
+
567
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
568
+ -->
569
+
570
+ ## Evaluation
571
+
572
+ ### Metrics
573
+
574
+ #### Information Retrieval
575
+
576
+ * Dataset: `dim_1024`
577
+ * Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:
578
+ ```json
579
+ {
580
+ "truncate_dim": 1024
581
+ }
582
+ ```
583
+
584
+ | Metric | Value |
585
+ |:--------------------|:-----------|
586
+ | cosine_accuracy@1 | 0.7719 |
587
+ | cosine_accuracy@3 | 0.8932 |
588
+ | cosine_accuracy@5 | 0.9137 |
589
+ | cosine_accuracy@10 | 0.9282 |
590
+ | cosine_precision@1 | 0.7719 |
591
+ | cosine_precision@3 | 0.2977 |
592
+ | cosine_precision@5 | 0.1827 |
593
+ | cosine_precision@10 | 0.0928 |
594
+ | cosine_recall@1 | 0.7719 |
595
+ | cosine_recall@3 | 0.8932 |
596
+ | cosine_recall@5 | 0.9137 |
597
+ | cosine_recall@10 | 0.9282 |
598
+ | **cosine_ndcg@10** | **0.8568** |
599
+ | cosine_mrr@10 | 0.8331 |
600
+ | cosine_map@100 | 0.8344 |
601
+
602
+ #### Information Retrieval
603
+
604
+ * Dataset: `dim_768`
605
+ * Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:
606
+ ```json
607
+ {
608
+ "truncate_dim": 768
609
+ }
610
+ ```
611
+
612
+ | Metric | Value |
613
+ |:--------------------|:-----------|
614
+ | cosine_accuracy@1 | 0.7707 |
615
+ | cosine_accuracy@3 | 0.8926 |
616
+ | cosine_accuracy@5 | 0.9119 |
617
+ | cosine_accuracy@10 | 0.9288 |
618
+ | cosine_precision@1 | 0.7707 |
619
+ | cosine_precision@3 | 0.2975 |
620
+ | cosine_precision@5 | 0.1824 |
621
+ | cosine_precision@10 | 0.0929 |
622
+ | cosine_recall@1 | 0.7707 |
623
+ | cosine_recall@3 | 0.8926 |
624
+ | cosine_recall@5 | 0.9119 |
625
+ | cosine_recall@10 | 0.9288 |
626
+ | **cosine_ndcg@10** | **0.8564** |
627
+ | cosine_mrr@10 | 0.8324 |
628
+ | cosine_map@100 | 0.8336 |
629
+
630
+ #### Information Retrieval
631
+
632
+ * Dataset: `dim_512`
633
+ * Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:
634
+ ```json
635
+ {
636
+ "truncate_dim": 512
637
+ }
638
+ ```
639
+
640
+ | Metric | Value |
641
+ |:--------------------|:-----------|
642
+ | cosine_accuracy@1 | 0.7683 |
643
+ | cosine_accuracy@3 | 0.892 |
644
+ | cosine_accuracy@5 | 0.9107 |
645
+ | cosine_accuracy@10 | 0.93 |
646
+ | cosine_precision@1 | 0.7683 |
647
+ | cosine_precision@3 | 0.2973 |
648
+ | cosine_precision@5 | 0.1821 |
649
+ | cosine_precision@10 | 0.093 |
650
+ | cosine_recall@1 | 0.7683 |
651
+ | cosine_recall@3 | 0.892 |
652
+ | cosine_recall@5 | 0.9107 |
653
+ | cosine_recall@10 | 0.93 |
654
+ | **cosine_ndcg@10** | **0.8554** |
655
+ | cosine_mrr@10 | 0.8308 |
656
+ | cosine_map@100 | 0.8318 |
657
+
658
+ #### Information Retrieval
659
+
660
+ * Dataset: `dim_256`
661
+ * Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:
662
+ ```json
663
+ {
664
+ "truncate_dim": 256
665
+ }
666
+ ```
667
+
668
+ | Metric | Value |
669
+ |:--------------------|:-----------|
670
+ | cosine_accuracy@1 | 0.7646 |
671
+ | cosine_accuracy@3 | 0.8884 |
672
+ | cosine_accuracy@5 | 0.9059 |
673
+ | cosine_accuracy@10 | 0.9252 |
674
+ | cosine_precision@1 | 0.7646 |
675
+ | cosine_precision@3 | 0.2961 |
676
+ | cosine_precision@5 | 0.1812 |
677
+ | cosine_precision@10 | 0.0925 |
678
+ | cosine_recall@1 | 0.7646 |
679
+ | cosine_recall@3 | 0.8884 |
680
+ | cosine_recall@5 | 0.9059 |
681
+ | cosine_recall@10 | 0.9252 |
682
+ | **cosine_ndcg@10** | **0.8516** |
683
+ | cosine_mrr@10 | 0.8272 |
684
+ | cosine_map@100 | 0.8285 |
685
+
686
+ #### Information Retrieval
687
+
688
+ * Dataset: `dim_128`
689
+ * Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:
690
+ ```json
691
+ {
692
+ "truncate_dim": 128
693
+ }
694
+ ```
695
+
696
+ | Metric | Value |
697
+ |:--------------------|:-----------|
698
+ | cosine_accuracy@1 | 0.7532 |
699
+ | cosine_accuracy@3 | 0.8775 |
700
+ | cosine_accuracy@5 | 0.8968 |
701
+ | cosine_accuracy@10 | 0.9161 |
702
+ | cosine_precision@1 | 0.7532 |
703
+ | cosine_precision@3 | 0.2925 |
704
+ | cosine_precision@5 | 0.1794 |
705
+ | cosine_precision@10 | 0.0916 |
706
+ | cosine_recall@1 | 0.7532 |
707
+ | cosine_recall@3 | 0.8775 |
708
+ | cosine_recall@5 | 0.8968 |
709
+ | cosine_recall@10 | 0.9161 |
710
+ | **cosine_ndcg@10** | **0.8412** |
711
+ | cosine_mrr@10 | 0.8165 |
712
+ | cosine_map@100 | 0.8182 |
713
+
714
+ #### Information Retrieval
715
+
716
+ * Dataset: `dim_64`
717
+ * Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:
718
+ ```json
719
+ {
720
+ "truncate_dim": 64
721
+ }
722
+ ```
723
+
724
+ | Metric | Value |
725
+ |:--------------------|:-----------|
726
+ | cosine_accuracy@1 | 0.7109 |
727
+ | cosine_accuracy@3 | 0.8503 |
728
+ | cosine_accuracy@5 | 0.8751 |
729
+ | cosine_accuracy@10 | 0.8974 |
730
+ | cosine_precision@1 | 0.7109 |
731
+ | cosine_precision@3 | 0.2834 |
732
+ | cosine_precision@5 | 0.175 |
733
+ | cosine_precision@10 | 0.0897 |
734
+ | cosine_recall@1 | 0.7109 |
735
+ | cosine_recall@3 | 0.8503 |
736
+ | cosine_recall@5 | 0.8751 |
737
+ | cosine_recall@10 | 0.8974 |
738
+ | **cosine_ndcg@10** | **0.8111** |
739
+ | cosine_mrr@10 | 0.7827 |
740
+ | cosine_map@100 | 0.7848 |
741
+
742
+ <!--
743
+ ## Bias, Risks and Limitations
744
+
745
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
746
+ -->
747
+
748
+ <!--
749
+ ### Recommendations
750
+
751
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
752
+ -->
753
+
754
+ ## Training Details
755
+
756
+ ### Training Dataset
757
+
758
+ #### json
759
+
760
+ * Dataset: json
761
+ * Size: 14,907 training samples
762
+ * Columns: <code>query</code> and <code>answer</code>
763
+ * Approximate statistics based on the first 1000 samples:
764
+ | | query | answer |
765
+ |:--------|:----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|
766
+ | type | string | string |
767
+ | details | <ul><li>min: 9 tokens</li><li>mean: 25.88 tokens</li><li>max: 63 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 34.09 tokens</li><li>max: 340 tokens</li></ul> |
768
+ * Samples:
769
+ | query | answer |
770
+ |:--------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------|
771
+ | <code>En Valdeconejos, ¿cuál era la sociedad de agricultores en 1952?</code> | <code>En Valdeconejos, la sociedad de agricultores en 1952 era el Pósito de Agricultores.</code> |
772
+ | <code>¿Qué nombres de capataces se registran en el pueblo de Escucha en el año 1952?</code> | <code>En Escucha, en 1952, los capataces registrados son Peralta (Manuel) y Rodriguez (Gonzalo).</code> |
773
+ | <code>En el contexto de la minería, ¿qué implica 'despajar'?</code> | <code>'Despajar' se refiere a cribar a mano material y desechos para obtener las partes de carbón que hay en ellos.</code> |
774
+ * Loss: [<code>MatryoshkaLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#matryoshkaloss) with these parameters:
775
+ ```json
776
+ {
777
+ "loss": "MultipleNegativesRankingLoss",
778
+ "matryoshka_dims": [
779
+ 1024,
780
+ 768,
781
+ 512,
782
+ 256,
783
+ 128,
784
+ 64
785
+ ],
786
+ "matryoshka_weights": [
787
+ 1,
788
+ 1,
789
+ 1,
790
+ 1,
791
+ 1,
792
+ 1
793
+ ],
794
+ "n_dims_per_step": -1
795
+ }
796
+ ```
797
+
798
+ ### Training Hyperparameters
799
+ #### Non-Default Hyperparameters
800
+
801
+ - `eval_strategy`: epoch
802
+ - `per_device_train_batch_size`: 32
803
+ - `per_device_eval_batch_size`: 16
804
+ - `gradient_accumulation_steps`: 16
805
+ - `learning_rate`: 2e-05
806
+ - `num_train_epochs`: 4
807
+ - `lr_scheduler_type`: cosine
808
+ - `warmup_ratio`: 0.1
809
+ - `tf32`: True
810
+ - `load_best_model_at_end`: True
811
+ - `optim`: adamw_torch_fused
812
+ - `batch_sampler`: no_duplicates
813
+
814
+ #### All Hyperparameters
815
+ <details><summary>Click to expand</summary>
816
+
817
+ - `overwrite_output_dir`: False
818
+ - `do_predict`: False
819
+ - `eval_strategy`: epoch
820
+ - `prediction_loss_only`: True
821
+ - `per_device_train_batch_size`: 32
822
+ - `per_device_eval_batch_size`: 16
823
+ - `per_gpu_train_batch_size`: None
824
+ - `per_gpu_eval_batch_size`: None
825
+ - `gradient_accumulation_steps`: 16
826
+ - `eval_accumulation_steps`: None
827
+ - `torch_empty_cache_steps`: None
828
+ - `learning_rate`: 2e-05
829
+ - `weight_decay`: 0.0
830
+ - `adam_beta1`: 0.9
831
+ - `adam_beta2`: 0.999
832
+ - `adam_epsilon`: 1e-08
833
+ - `max_grad_norm`: 1.0
834
+ - `num_train_epochs`: 4
835
+ - `max_steps`: -1
836
+ - `lr_scheduler_type`: cosine
837
+ - `lr_scheduler_kwargs`: {}
838
+ - `warmup_ratio`: 0.1
839
+ - `warmup_steps`: 0
840
+ - `log_level`: passive
841
+ - `log_level_replica`: warning
842
+ - `log_on_each_node`: True
843
+ - `logging_nan_inf_filter`: True
844
+ - `save_safetensors`: True
845
+ - `save_on_each_node`: False
846
+ - `save_only_model`: False
847
+ - `restore_callback_states_from_checkpoint`: False
848
+ - `no_cuda`: False
849
+ - `use_cpu`: False
850
+ - `use_mps_device`: False
851
+ - `seed`: 42
852
+ - `data_seed`: None
853
+ - `jit_mode_eval`: False
854
+ - `use_ipex`: False
855
+ - `bf16`: False
856
+ - `fp16`: False
857
+ - `fp16_opt_level`: O1
858
+ - `half_precision_backend`: auto
859
+ - `bf16_full_eval`: False
860
+ - `fp16_full_eval`: False
861
+ - `tf32`: True
862
+ - `local_rank`: 0
863
+ - `ddp_backend`: None
864
+ - `tpu_num_cores`: None
865
+ - `tpu_metrics_debug`: False
866
+ - `debug`: []
867
+ - `dataloader_drop_last`: False
868
+ - `dataloader_num_workers`: 0
869
+ - `dataloader_prefetch_factor`: None
870
+ - `past_index`: -1
871
+ - `disable_tqdm`: False
872
+ - `remove_unused_columns`: True
873
+ - `label_names`: None
874
+ - `load_best_model_at_end`: True
875
+ - `ignore_data_skip`: False
876
+ - `fsdp`: []
877
+ - `fsdp_min_num_params`: 0
878
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
879
+ - `tp_size`: 0
880
+ - `fsdp_transformer_layer_cls_to_wrap`: None
881
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
882
+ - `deepspeed`: None
883
+ - `label_smoothing_factor`: 0.0
884
+ - `optim`: adamw_torch_fused
885
+ - `optim_args`: None
886
+ - `adafactor`: False
887
+ - `group_by_length`: False
888
+ - `length_column_name`: length
889
+ - `ddp_find_unused_parameters`: None
890
+ - `ddp_bucket_cap_mb`: None
891
+ - `ddp_broadcast_buffers`: False
892
+ - `dataloader_pin_memory`: True
893
+ - `dataloader_persistent_workers`: False
894
+ - `skip_memory_metrics`: True
895
+ - `use_legacy_prediction_loop`: False
896
+ - `push_to_hub`: False
897
+ - `resume_from_checkpoint`: None
898
+ - `hub_model_id`: None
899
+ - `hub_strategy`: every_save
900
+ - `hub_private_repo`: None
901
+ - `hub_always_push`: False
902
+ - `gradient_checkpointing`: False
903
+ - `gradient_checkpointing_kwargs`: None
904
+ - `include_inputs_for_metrics`: False
905
+ - `include_for_metrics`: []
906
+ - `eval_do_concat_batches`: True
907
+ - `fp16_backend`: auto
908
+ - `push_to_hub_model_id`: None
909
+ - `push_to_hub_organization`: None
910
+ - `mp_parameters`:
911
+ - `auto_find_batch_size`: False
912
+ - `full_determinism`: False
913
+ - `torchdynamo`: None
914
+ - `ray_scope`: last
915
+ - `ddp_timeout`: 1800
916
+ - `torch_compile`: False
917
+ - `torch_compile_backend`: None
918
+ - `torch_compile_mode`: None
919
+ - `include_tokens_per_second`: False
920
+ - `include_num_input_tokens_seen`: False
921
+ - `neftune_noise_alpha`: None
922
+ - `optim_target_modules`: None
923
+ - `batch_eval_metrics`: False
924
+ - `eval_on_start`: False
925
+ - `use_liger_kernel`: False
926
+ - `eval_use_gather_object`: False
927
+ - `average_tokens_across_devices`: False
928
+ - `prompts`: None
929
+ - `batch_sampler`: no_duplicates
930
+ - `multi_dataset_batch_sampler`: proportional
931
+
932
+ </details>
933
+
934
+ ### Training Logs
935
+ | Epoch | Step | Training Loss | dim_1024_cosine_ndcg@10 | dim_768_cosine_ndcg@10 | dim_512_cosine_ndcg@10 | dim_256_cosine_ndcg@10 | dim_128_cosine_ndcg@10 | dim_64_cosine_ndcg@10 |
936
+ |:------:|:----:|:-------------:|:-----------------------:|:----------------------:|:----------------------:|:----------------------:|:----------------------:|:---------------------:|
937
+ | 0.3433 | 10 | 23.532 | - | - | - | - | - | - |
938
+ | 0.6867 | 20 | 10.6294 | - | - | - | - | - | - |
939
+ | 1.0 | 30 | 5.9964 | 0.8436 | 0.8428 | 0.8417 | 0.8373 | 0.8254 | 0.7920 |
940
+ | 1.3433 | 40 | 4.451 | - | - | - | - | - | - |
941
+ | 1.6867 | 50 | 4.7053 | - | - | - | - | - | - |
942
+ | 2.0 | 60 | 3.9423 | 0.8555 | 0.8539 | 0.8535 | 0.8505 | 0.8374 | 0.8075 |
943
+ | 2.3433 | 70 | 4.0009 | - | - | - | - | - | - |
944
+ | 2.6867 | 80 | 4.3913 | - | - | - | - | - | - |
945
+ | 3.0 | 90 | 2.9362 | 0.8566 | 0.8548 | 0.8554 | 0.8514 | 0.8401 | 0.8089 |
946
+ | 3.3433 | 100 | 3.7804 | - | - | - | - | - | - |
947
+ | 3.6867 | 110 | 4.5676 | - | - | - | - | - | - |
948
+ | 3.8927 | 116 | - | 0.8568 | 0.8564 | 0.8554 | 0.8516 | 0.8412 | 0.8111 |
949
+
950
+
951
+ ### Framework Versions
952
+ - Python: 3.12.10
953
+ - Sentence Transformers: 4.1.0
954
+ - Transformers: 4.51.3
955
+ - PyTorch: 2.7.0+cu126
956
+ - Accelerate: 1.7.0
957
+ - Datasets: 3.6.0
958
+ - Tokenizers: 0.21.1
959
+
960
+ ## Citation
961
+
962
+ ### BibTeX
963
+
964
+ #### Sentence Transformers
965
+ ```bibtex
966
+ @inproceedings{reimers-2019-sentence-bert,
967
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
968
+ author = "Reimers, Nils and Gurevych, Iryna",
969
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
970
+ month = "11",
971
+ year = "2019",
972
+ publisher = "Association for Computational Linguistics",
973
+ url = "https://arxiv.org/abs/1908.10084",
974
+ }
975
+ ```
976
+
977
+ #### MatryoshkaLoss
978
+ ```bibtex
979
+ @misc{kusupati2024matryoshka,
980
+ title={Matryoshka Representation Learning},
981
+ author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
982
+ year={2024},
983
+ eprint={2205.13147},
984
+ archivePrefix={arXiv},
985
+ primaryClass={cs.LG}
986
+ }
987
+ ```
988
+
989
+ #### MultipleNegativesRankingLoss
990
+ ```bibtex
991
+ @misc{henderson2017efficient,
992
+ title={Efficient Natural Language Response Suggestion for Smart Reply},
993
+ author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
994
+ year={2017},
995
+ eprint={1705.00652},
996
+ archivePrefix={arXiv},
997
+ primaryClass={cs.CL}
998
+ }
999
+ ```
1000
+
1001
+ <!--
1002
+ ## Glossary
1003
+
1004
+ *Clearly define terms in order to be accessible across audiences.*
1005
+ -->
1006
+
1007
+ <!--
1008
+ ## Model Card Authors
1009
+
1010
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
1011
+ -->
1012
+
1013
+ <!--
1014
+ ## Model Card Contact
1015
+
1016
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
1017
+ -->
config.json ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "XLMRobertaLoRA"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "auto_map": {
7
+ "AutoConfig": "jinaai/xlm-roberta-flash-implementation--configuration_xlm_roberta.XLMRobertaFlashConfig",
8
+ "AutoModel": "jinaai/xlm-roberta-flash-implementation--modeling_lora.XLMRobertaLoRA",
9
+ "AutoModelForMaskedLM": "jinaai/xlm-roberta-flash-implementation--modeling_xlm_roberta.XLMRobertaForMaskedLM",
10
+ "AutoModelForPreTraining": "jinaai/xlm-roberta-flash-implementation--modeling_xlm_roberta.XLMRobertaForPreTraining"
11
+ },
12
+ "bos_token_id": 0,
13
+ "classifier_dropout": null,
14
+ "emb_pooler": null,
15
+ "eos_token_id": 2,
16
+ "hidden_act": "gelu",
17
+ "hidden_dropout_prob": 0.1,
18
+ "hidden_size": 1024,
19
+ "initializer_range": 0.02,
20
+ "intermediate_size": 4096,
21
+ "layer_norm_eps": 1e-05,
22
+ "load_trained_adapters": true,
23
+ "lora_adaptations": [
24
+ "retrieval.query",
25
+ "retrieval.passage",
26
+ "separation",
27
+ "classification",
28
+ "text-matching"
29
+ ],
30
+ "lora_alpha": 1,
31
+ "lora_dropout_p": 0.0,
32
+ "lora_main_params_trainable": true,
33
+ "lora_rank": 4,
34
+ "matryoshka_dimensions": [
35
+ 32,
36
+ 64,
37
+ 128,
38
+ 256,
39
+ 512,
40
+ 768,
41
+ 1024
42
+ ],
43
+ "max_position_embeddings": 8194,
44
+ "model_type": "xlm-roberta",
45
+ "num_attention_heads": 16,
46
+ "num_hidden_layers": 24,
47
+ "output_past": true,
48
+ "pad_token_id": 1,
49
+ "position_embedding_type": "rotary",
50
+ "rotary_emb_base": 20000.0,
51
+ "task_instructions": {
52
+ "classification": "",
53
+ "retrieval.passage": "Represent the document for retrieval: ",
54
+ "retrieval.query": "Represent the query for retrieving evidence documents: ",
55
+ "separation": "",
56
+ "text-matching": ""
57
+ },
58
+ "torch_dtype": "bfloat16",
59
+ "transformers_version": "4.51.3",
60
+ "truncate_dim": null,
61
+ "type_vocab_size": 1,
62
+ "use_cache": true,
63
+ "use_flash_attn": true,
64
+ "use_reentrant": false,
65
+ "vocab_size": 250002
66
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "4.1.0",
4
+ "transformers": "4.51.3",
5
+ "pytorch": "2.7.0+cu126"
6
+ },
7
+ "prompts": {
8
+ "retrieval.query": "Represent the query for retrieving evidence documents: ",
9
+ "retrieval.passage": "Represent the document for retrieval: ",
10
+ "separation": "",
11
+ "classification": "",
12
+ "text-matching": ""
13
+ },
14
+ "default_prompt_name": null,
15
+ "similarity_fn_name": "cosine"
16
+ }
custom_st.py ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import logging
3
+ import os
4
+ from io import BytesIO
5
+ from typing import Any, Dict, List, Optional, Tuple, Union
6
+
7
+ import torch
8
+ from torch import nn
9
+ from transformers import AutoConfig, AutoModel, AutoTokenizer
10
+
11
+ logger = logging.getLogger(__name__)
12
+
13
+
14
+ class Transformer(nn.Module):
15
+ """Huggingface AutoModel to generate token embeddings.
16
+ Loads the correct class, e.g. BERT / RoBERTa etc.
17
+
18
+ Args:
19
+ model_name_or_path: Huggingface models name
20
+ (https://huggingface.co/models)
21
+ max_seq_length: Truncate any inputs longer than max_seq_length
22
+ model_args: Keyword arguments passed to the Huggingface
23
+ Transformers model
24
+ tokenizer_args: Keyword arguments passed to the Huggingface
25
+ Transformers tokenizer
26
+ config_args: Keyword arguments passed to the Huggingface
27
+ Transformers config
28
+ cache_dir: Cache dir for Huggingface Transformers to store/load
29
+ models
30
+ do_lower_case: If true, lowercases the input (independent if the
31
+ model is cased or not)
32
+ tokenizer_name_or_path: Name or path of the tokenizer. When
33
+ None, then model_name_or_path is used
34
+ """
35
+
36
+ save_in_root: bool = True
37
+
38
+ def __init__(
39
+ self,
40
+ model_name_or_path: str,
41
+ max_seq_length: int = None,
42
+ model_args: Dict[str, Any] = None,
43
+ tokenizer_args: Dict[str, Any] = None,
44
+ config_args: Dict[str, Any] = None,
45
+ cache_dir: str = None,
46
+ do_lower_case: bool = False,
47
+ tokenizer_name_or_path: str = None,
48
+ **kwargs,
49
+ ) -> None:
50
+ super().__init__()
51
+ self.config_keys = ["max_seq_length", "do_lower_case"]
52
+ self.do_lower_case = do_lower_case
53
+ if model_args is None:
54
+ model_args = {}
55
+ if tokenizer_args is None:
56
+ tokenizer_args = {}
57
+ if config_args is None:
58
+ config_args = {}
59
+
60
+ if kwargs.get("backend", "torch") != "torch":
61
+ logger.warning(
62
+ f'"jinaai/jina-embeddings-v3" is currently not compatible with the {kwargs["backend"]} backend. '
63
+ 'Continuing with the "torch" backend.'
64
+ )
65
+
66
+ self.config = AutoConfig.from_pretrained(model_name_or_path, **config_args, cache_dir=cache_dir)
67
+
68
+ self._lora_adaptations = self.config.lora_adaptations
69
+ if (
70
+ not isinstance(self._lora_adaptations, list)
71
+ or len(self._lora_adaptations) < 1
72
+ ):
73
+ raise ValueError(
74
+ f"`lora_adaptations` must be a list and contain at least one element"
75
+ )
76
+ self._adaptation_map = {
77
+ name: idx for idx, name in enumerate(self._lora_adaptations)
78
+ }
79
+
80
+ self.default_task = model_args.pop('default_task', None)
81
+
82
+ self.auto_model = AutoModel.from_pretrained(model_name_or_path, config=self.config, cache_dir=cache_dir, **model_args)
83
+
84
+ if max_seq_length is not None and "model_max_length" not in tokenizer_args:
85
+ tokenizer_args["model_max_length"] = max_seq_length
86
+ self.tokenizer = AutoTokenizer.from_pretrained(
87
+ tokenizer_name_or_path if tokenizer_name_or_path is not None else model_name_or_path,
88
+ cache_dir=cache_dir,
89
+ **tokenizer_args,
90
+ )
91
+
92
+ # No max_seq_length set. Try to infer from model
93
+ if max_seq_length is None:
94
+ if (
95
+ hasattr(self.auto_model, "config")
96
+ and hasattr(self.auto_model.config, "max_position_embeddings")
97
+ and hasattr(self.tokenizer, "model_max_length")
98
+ ):
99
+ max_seq_length = min(self.auto_model.config.max_position_embeddings, self.tokenizer.model_max_length)
100
+
101
+ self.max_seq_length = max_seq_length
102
+
103
+ if tokenizer_name_or_path is not None:
104
+ self.auto_model.config.tokenizer_class = self.tokenizer.__class__.__name__
105
+
106
+
107
+ @property
108
+ def default_task(self):
109
+ return self._default_task
110
+
111
+ @default_task.setter
112
+ def default_task(self, task: Union[None, str]):
113
+ self._validate_task(task)
114
+ self._default_task = task
115
+
116
+
117
+ def _validate_task(self, task: str):
118
+ if task and task not in self._lora_adaptations:
119
+ raise ValueError(
120
+ f"Unsupported task '{task}'. "
121
+ f"Supported tasks are: {', '.join(self.config.lora_adaptations)}. "
122
+ f"Alternatively, don't pass the `task` argument to disable LoRA."
123
+ )
124
+
125
+ def forward(
126
+ self, features: Dict[str, torch.Tensor], task: Optional[str] = None
127
+ ) -> Dict[str, torch.Tensor]:
128
+ """Returns token_embeddings, cls_token"""
129
+ self._validate_task(task)
130
+ task = task or self.default_task
131
+ adapter_mask = None
132
+ if task:
133
+ task_id = self._adaptation_map[task]
134
+ num_examples = features['input_ids'].size(0)
135
+ adapter_mask = torch.full(
136
+ (num_examples,), task_id, dtype=torch.int32, device=features['input_ids'].device
137
+ )
138
+
139
+ lora_arguments = (
140
+ {"adapter_mask": adapter_mask} if adapter_mask is not None else {}
141
+ )
142
+ features.pop('prompt_length', None)
143
+ output_states = self.auto_model.forward(**features, **lora_arguments, return_dict=False)
144
+ output_tokens = output_states[0]
145
+ features.update({"token_embeddings": output_tokens, "attention_mask": features["attention_mask"]})
146
+ return features
147
+
148
+ def get_word_embedding_dimension(self) -> int:
149
+ return self.auto_model.config.hidden_size
150
+
151
+ def tokenize(
152
+ self,
153
+ texts: Union[List[str], List[dict], List[Tuple[str, str]]],
154
+ padding: Union[str, bool] = True
155
+ ) -> Dict[str, torch.Tensor]:
156
+ """Tokenizes a text and maps tokens to token-ids"""
157
+ output = {}
158
+ if isinstance(texts[0], str):
159
+ to_tokenize = [texts]
160
+ elif isinstance(texts[0], dict):
161
+ to_tokenize = []
162
+ output["text_keys"] = []
163
+ for lookup in texts:
164
+ text_key, text = next(iter(lookup.items()))
165
+ to_tokenize.append(text)
166
+ output["text_keys"].append(text_key)
167
+ to_tokenize = [to_tokenize]
168
+ else:
169
+ batch1, batch2 = [], []
170
+ for text_tuple in texts:
171
+ batch1.append(text_tuple[0])
172
+ batch2.append(text_tuple[1])
173
+ to_tokenize = [batch1, batch2]
174
+
175
+ # strip
176
+ to_tokenize = [[str(s).strip() for s in col] for col in to_tokenize]
177
+
178
+ # Lowercase
179
+ if self.do_lower_case:
180
+ to_tokenize = [[s.lower() for s in col] for col in to_tokenize]
181
+
182
+ output.update(
183
+ self.tokenizer(
184
+ *to_tokenize,
185
+ padding=padding,
186
+ truncation="longest_first",
187
+ return_tensors="pt",
188
+ max_length=self.max_seq_length,
189
+ )
190
+ )
191
+ return output
192
+
193
+ def get_config_dict(self) -> Dict[str, Any]:
194
+ return {key: self.__dict__[key] for key in self.config_keys}
195
+
196
+ def save(self, output_path: str, safe_serialization: bool = True) -> None:
197
+ self.auto_model.save_pretrained(output_path, safe_serialization=safe_serialization)
198
+ self.tokenizer.save_pretrained(output_path)
199
+
200
+ with open(os.path.join(output_path, "sentence_bert_config.json"), "w") as fOut:
201
+ json.dump(self.get_config_dict(), fOut, indent=2)
202
+
203
+
204
+ @classmethod
205
+ def load(cls, input_path: str) -> "Transformer":
206
+ # Old classes used other config names than 'sentence_bert_config.json'
207
+ for config_name in [
208
+ "sentence_bert_config.json",
209
+ "sentence_roberta_config.json",
210
+ "sentence_distilbert_config.json",
211
+ "sentence_camembert_config.json",
212
+ "sentence_albert_config.json",
213
+ "sentence_xlm-roberta_config.json",
214
+ "sentence_xlnet_config.json",
215
+ ]:
216
+ sbert_config_path = os.path.join(input_path, config_name)
217
+ if os.path.exists(sbert_config_path):
218
+ break
219
+
220
+ with open(sbert_config_path) as fIn:
221
+ config = json.load(fIn)
222
+ # Don't allow configs to set trust_remote_code
223
+ if "model_args" in config and "trust_remote_code" in config["model_args"]:
224
+ config["model_args"].pop("trust_remote_code")
225
+ if "tokenizer_args" in config and "trust_remote_code" in config["tokenizer_args"]:
226
+ config["tokenizer_args"].pop("trust_remote_code")
227
+ if "config_args" in config and "trust_remote_code" in config["config_args"]:
228
+ config["config_args"].pop("trust_remote_code")
229
+ return cls(model_name_or_path=input_path, **config)
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:77438c542b0993994f69a4e6c0cf7341c8024b647f3fe764660ad9e6696aaad9
3
+ size 1144685320
modules.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "transformer",
5
+ "path": "",
6
+ "type": "custom_st.Transformer",
7
+ "kwargs": [
8
+ "task"
9
+ ]
10
+ },
11
+ {
12
+ "idx": 1,
13
+ "name": "pooler",
14
+ "path": "1_Pooling",
15
+ "type": "sentence_transformers.models.Pooling"
16
+ },
17
+ {
18
+ "idx": 2,
19
+ "name": "normalizer",
20
+ "path": "2_Normalize",
21
+ "type": "sentence_transformers.models.Normalize"
22
+ }
23
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 8194,
3
+ "do_lower_case": false
4
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "<mask>",
25
+ "lstrip": true,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "<pad>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "</s>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "<unk>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e19cd8c08f528b481e909f73dbd1fd62b1e8b1117579ba205e477801237f9e0
3
+ size 17082988
tokenizer_config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<s>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<pad>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "</s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "<unk>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "250001": {
36
+ "content": "<mask>",
37
+ "lstrip": true,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "bos_token": "<s>",
45
+ "clean_up_tokenization_spaces": true,
46
+ "cls_token": "<s>",
47
+ "eos_token": "</s>",
48
+ "extra_special_tokens": {},
49
+ "mask_token": "<mask>",
50
+ "model_max_length": 8194,
51
+ "pad_token": "<pad>",
52
+ "sep_token": "</s>",
53
+ "tokenizer_class": "XLMRobertaTokenizerFast",
54
+ "unk_token": "<unk>"
55
+ }