Update README.md
Browse files
README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
---
|
2 |
language:
|
3 |
- en
|
|
|
4 |
license: apache-2.0
|
5 |
tags:
|
6 |
- sentence-transformers
|
@@ -98,99 +99,29 @@ model-index:
|
|
98 |
- type: ndcg@10
|
99 |
value: 0.464
|
100 |
name: Ndcg@10
|
|
|
|
|
101 |
---
|
|
|
102 |
|
103 |
-
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
## Model Details
|
108 |
-
|
109 |
-
### Model Description
|
110 |
-
- **Model Type:** Cross Encoder
|
111 |
-
- **Base model:** [EuroBERT/EuroBERT-210m](https://huggingface.co/EuroBERT/EuroBERT-210m) <!-- at revision 5a0c63d3e255a4f2005d3591d5508b7fd07cae94 -->
|
112 |
-
- **Maximum Sequence Length:** 8192 tokens
|
113 |
-
- **Number of Output Labels:** 1 label
|
114 |
-
<!-- - **Training Dataset:** Unknown -->
|
115 |
-
- **Language:** en
|
116 |
-
- **License:** apache-2.0
|
117 |
-
|
118 |
-
### Model Sources
|
119 |
-
|
120 |
-
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
|
121 |
-
- **Documentation:** [Cross Encoder Documentation](https://www.sbert.net/docs/cross_encoder/usage/usage.html)
|
122 |
-
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
|
123 |
-
- **Hugging Face:** [Cross Encoders on Hugging Face](https://huggingface.co/models?library=sentence-transformers&other=cross-encoder)
|
124 |
-
|
125 |
-
## Usage
|
126 |
-
|
127 |
-
### Direct Usage (Sentence Transformers)
|
128 |
-
|
129 |
-
First install the Sentence Transformers library:
|
130 |
-
|
131 |
-
```bash
|
132 |
-
pip install -U sentence-transformers
|
133 |
-
```
|
134 |
-
|
135 |
-
Then you can load this model and run inference.
|
136 |
-
```python
|
137 |
-
from sentence_transformers import CrossEncoder
|
138 |
|
139 |
-
|
140 |
-
|
141 |
-
# Get scores for pairs of texts
|
142 |
-
pairs = [
|
143 |
-
['what are the risks with taking statins?', "['Muscle pain and damage. One of the most common complaints of people taking statins is muscle pain. ... ', 'Liver damage. Occasionally, statin use could cause an increase in the level of enzymes that signal liver inflammation. ... ', 'Increased blood sugar or type 2 diabetes. ... ', 'Neurological side effects.']"],
|
144 |
-
['what are the risks with taking statins?', 'Doctors discovered that statins can help lower blood pressure, as well as lower cholesterol. Statins are often prescribed to people with high cholesterol. Too much cholesterol in your blood increases your risk of heart attacks and strokes.'],
|
145 |
-
['what are the risks with taking statins?', 'Lipitor and Crestor are both effective statins that lower levels of “bad” cholesterol and increase levels of “good” cholesterol. While Crestor is the more potent statin, both medications are effective and have slightly different side effects and drug interactions.'],
|
146 |
-
['what are the risks with taking statins?', "About simvastatin Simvastatin belongs to a group of medicines called statins. It's used to lower cholesterol if you've been diagnosed with high blood cholesterol. It's also taken to prevent heart disease, including heart attacks and strokes."],
|
147 |
-
['what are the risks with taking statins?', 'Zetia works to lower cholesterol in a new way different from the statins: it inhibits the absorption of cholesterol in the small intestine, whereas the statins work by blocking cholesterol production in the liver.'],
|
148 |
-
]
|
149 |
-
scores = model.predict(pairs)
|
150 |
-
print(scores.shape)
|
151 |
-
# (5,)
|
152 |
|
153 |
-
|
154 |
-
|
155 |
-
'what are the risks with taking statins?',
|
156 |
-
[
|
157 |
-
"['Muscle pain and damage. One of the most common complaints of people taking statins is muscle pain. ... ', 'Liver damage. Occasionally, statin use could cause an increase in the level of enzymes that signal liver inflammation. ... ', 'Increased blood sugar or type 2 diabetes. ... ', 'Neurological side effects.']",
|
158 |
-
'Doctors discovered that statins can help lower blood pressure, as well as lower cholesterol. Statins are often prescribed to people with high cholesterol. Too much cholesterol in your blood increases your risk of heart attacks and strokes.',
|
159 |
-
'Lipitor and Crestor are both effective statins that lower levels of “bad” cholesterol and increase levels of “good” cholesterol. While Crestor is the more potent statin, both medications are effective and have slightly different side effects and drug interactions.',
|
160 |
-
"About simvastatin Simvastatin belongs to a group of medicines called statins. It's used to lower cholesterol if you've been diagnosed with high blood cholesterol. It's also taken to prevent heart disease, including heart attacks and strokes.",
|
161 |
-
'Zetia works to lower cholesterol in a new way different from the statins: it inhibits the absorption of cholesterol in the small intestine, whereas the statins work by blocking cholesterol production in the liver.',
|
162 |
-
]
|
163 |
-
)
|
164 |
-
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
|
165 |
-
```
|
166 |
-
|
167 |
-
<!--
|
168 |
-
### Direct Usage (Transformers)
|
169 |
-
|
170 |
-
<details><summary>Click to see the direct usage in Transformers</summary>
|
171 |
-
|
172 |
-
</details>
|
173 |
-
-->
|
174 |
-
|
175 |
-
<!--
|
176 |
-
### Downstream Usage (Sentence Transformers)
|
177 |
-
|
178 |
-
You can finetune this model on your own dataset.
|
179 |
-
|
180 |
-
<details><summary>Click to expand</summary>
|
181 |
-
|
182 |
-
</details>
|
183 |
-
-->
|
184 |
-
|
185 |
-
<!--
|
186 |
-
### Out-of-Scope Use
|
187 |
|
188 |
-
|
189 |
-
|
190 |
|
191 |
-
|
|
|
192 |
|
193 |
-
|
|
|
194 |
|
195 |
#### Cross Encoder Reranking
|
196 |
|
@@ -261,305 +192,85 @@ You can finetune this model on your own dataset.
|
|
261 |
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
|
262 |
-->
|
263 |
|
264 |
-
##
|
265 |
-
|
266 |
-
### Training Dataset
|
267 |
-
|
268 |
-
#### Unnamed Dataset
|
269 |
-
|
270 |
-
* Size: 578,402 training samples
|
271 |
-
* Columns: <code>question</code>, <code>answer</code>, and <code>label</code>
|
272 |
-
* Approximate statistics based on the first 1000 samples:
|
273 |
-
| | question | answer | label |
|
274 |
-
|:--------|:-----------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------|:------------------------------------------------|
|
275 |
-
| type | string | string | int |
|
276 |
-
| details | <ul><li>min: 20 characters</li><li>mean: 45.09 characters</li><li>max: 84 characters</li></ul> | <ul><li>min: 51 characters</li><li>mean: 253.23 characters</li><li>max: 374 characters</li></ul> | <ul><li>0: ~82.60%</li><li>1: ~17.40%</li></ul> |
|
277 |
-
* Samples:
|
278 |
-
| question | answer | label |
|
279 |
-
|:-----------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------|
|
280 |
-
| <code>what are the risks with taking statins?</code> | <code>['Muscle pain and damage. One of the most common complaints of people taking statins is muscle pain. ... ', 'Liver damage. Occasionally, statin use could cause an increase in the level of enzymes that signal liver inflammation. ... ', 'Increased blood sugar or type 2 diabetes. ... ', 'Neurological side effects.']</code> | <code>1</code> |
|
281 |
-
| <code>what are the risks with taking statins?</code> | <code>Doctors discovered that statins can help lower blood pressure, as well as lower cholesterol. Statins are often prescribed to people with high cholesterol. Too much cholesterol in your blood increases your risk of heart attacks and strokes.</code> | <code>0</code> |
|
282 |
-
| <code>what are the risks with taking statins?</code> | <code>Lipitor and Crestor are both effective statins that lower levels of “bad” cholesterol and increase levels of “good” cholesterol. While Crestor is the more potent statin, both medications are effective and have slightly different side effects and drug interactions.</code> | <code>0</code> |
|
283 |
-
* Loss: [<code>BinaryCrossEntropyLoss</code>](https://sbert.net/docs/package_reference/cross_encoder/losses.html#binarycrossentropyloss) with these parameters:
|
284 |
-
```json
|
285 |
-
{
|
286 |
-
"activation_fn": "torch.nn.modules.linear.Identity",
|
287 |
-
"pos_weight": 5
|
288 |
-
}
|
289 |
-
```
|
290 |
|
291 |
-
###
|
292 |
-
#### Non-Default Hyperparameters
|
293 |
-
|
294 |
-
- `eval_strategy`: steps
|
295 |
-
- `per_device_train_batch_size`: 64
|
296 |
-
- `per_device_eval_batch_size`: 64
|
297 |
-
- `learning_rate`: 2e-05
|
298 |
-
- `num_train_epochs`: 2
|
299 |
-
- `warmup_ratio`: 0.1
|
300 |
-
- `seed`: 12
|
301 |
-
- `fp16`: True
|
302 |
-
- `dataloader_num_workers`: 4
|
303 |
-
- `load_best_model_at_end`: True
|
304 |
-
|
305 |
-
#### All Hyperparameters
|
306 |
-
<details><summary>Click to expand</summary>
|
307 |
|
308 |
-
|
309 |
-
- `do_predict`: False
|
310 |
-
- `eval_strategy`: steps
|
311 |
-
- `prediction_loss_only`: True
|
312 |
-
- `per_device_train_batch_size`: 64
|
313 |
-
- `per_device_eval_batch_size`: 64
|
314 |
-
- `per_gpu_train_batch_size`: None
|
315 |
-
- `per_gpu_eval_batch_size`: None
|
316 |
-
- `gradient_accumulation_steps`: 1
|
317 |
-
- `eval_accumulation_steps`: None
|
318 |
-
- `torch_empty_cache_steps`: None
|
319 |
-
- `learning_rate`: 2e-05
|
320 |
-
- `weight_decay`: 0.0
|
321 |
-
- `adam_beta1`: 0.9
|
322 |
-
- `adam_beta2`: 0.999
|
323 |
-
- `adam_epsilon`: 1e-08
|
324 |
-
- `max_grad_norm`: 1.0
|
325 |
-
- `num_train_epochs`: 2
|
326 |
-
- `max_steps`: -1
|
327 |
-
- `lr_scheduler_type`: linear
|
328 |
-
- `lr_scheduler_kwargs`: {}
|
329 |
-
- `warmup_ratio`: 0.1
|
330 |
-
- `warmup_steps`: 0
|
331 |
-
- `log_level`: passive
|
332 |
-
- `log_level_replica`: warning
|
333 |
-
- `log_on_each_node`: True
|
334 |
-
- `logging_nan_inf_filter`: True
|
335 |
-
- `save_safetensors`: True
|
336 |
-
- `save_on_each_node`: False
|
337 |
-
- `save_only_model`: False
|
338 |
-
- `restore_callback_states_from_checkpoint`: False
|
339 |
-
- `no_cuda`: False
|
340 |
-
- `use_cpu`: False
|
341 |
-
- `use_mps_device`: False
|
342 |
-
- `seed`: 12
|
343 |
-
- `data_seed`: None
|
344 |
-
- `jit_mode_eval`: False
|
345 |
-
- `use_ipex`: False
|
346 |
-
- `bf16`: False
|
347 |
-
- `fp16`: True
|
348 |
-
- `fp16_opt_level`: O1
|
349 |
-
- `half_precision_backend`: auto
|
350 |
-
- `bf16_full_eval`: False
|
351 |
-
- `fp16_full_eval`: False
|
352 |
-
- `tf32`: None
|
353 |
-
- `local_rank`: 0
|
354 |
-
- `ddp_backend`: None
|
355 |
-
- `tpu_num_cores`: None
|
356 |
-
- `tpu_metrics_debug`: False
|
357 |
-
- `debug`: []
|
358 |
-
- `dataloader_drop_last`: False
|
359 |
-
- `dataloader_num_workers`: 4
|
360 |
-
- `dataloader_prefetch_factor`: None
|
361 |
-
- `past_index`: -1
|
362 |
-
- `disable_tqdm`: False
|
363 |
-
- `remove_unused_columns`: True
|
364 |
-
- `label_names`: None
|
365 |
-
- `load_best_model_at_end`: True
|
366 |
-
- `ignore_data_skip`: False
|
367 |
-
- `fsdp`: []
|
368 |
-
- `fsdp_min_num_params`: 0
|
369 |
-
- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
|
370 |
-
- `tp_size`: 0
|
371 |
-
- `fsdp_transformer_layer_cls_to_wrap`: None
|
372 |
-
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
|
373 |
-
- `deepspeed`: None
|
374 |
-
- `label_smoothing_factor`: 0.0
|
375 |
-
- `optim`: adamw_torch
|
376 |
-
- `optim_args`: None
|
377 |
-
- `adafactor`: False
|
378 |
-
- `group_by_length`: False
|
379 |
-
- `length_column_name`: length
|
380 |
-
- `ddp_find_unused_parameters`: None
|
381 |
-
- `ddp_bucket_cap_mb`: None
|
382 |
-
- `ddp_broadcast_buffers`: False
|
383 |
-
- `dataloader_pin_memory`: True
|
384 |
-
- `dataloader_persistent_workers`: False
|
385 |
-
- `skip_memory_metrics`: True
|
386 |
-
- `use_legacy_prediction_loop`: False
|
387 |
-
- `push_to_hub`: False
|
388 |
-
- `resume_from_checkpoint`: None
|
389 |
-
- `hub_model_id`: None
|
390 |
-
- `hub_strategy`: every_save
|
391 |
-
- `hub_private_repo`: None
|
392 |
-
- `hub_always_push`: False
|
393 |
-
- `gradient_checkpointing`: False
|
394 |
-
- `gradient_checkpointing_kwargs`: None
|
395 |
-
- `include_inputs_for_metrics`: False
|
396 |
-
- `include_for_metrics`: []
|
397 |
-
- `eval_do_concat_batches`: True
|
398 |
-
- `fp16_backend`: auto
|
399 |
-
- `push_to_hub_model_id`: None
|
400 |
-
- `push_to_hub_organization`: None
|
401 |
-
- `mp_parameters`:
|
402 |
-
- `auto_find_batch_size`: False
|
403 |
-
- `full_determinism`: False
|
404 |
-
- `torchdynamo`: None
|
405 |
-
- `ray_scope`: last
|
406 |
-
- `ddp_timeout`: 1800
|
407 |
-
- `torch_compile`: False
|
408 |
-
- `torch_compile_backend`: None
|
409 |
-
- `torch_compile_mode`: None
|
410 |
-
- `include_tokens_per_second`: False
|
411 |
-
- `include_num_input_tokens_seen`: False
|
412 |
-
- `neftune_noise_alpha`: None
|
413 |
-
- `optim_target_modules`: None
|
414 |
-
- `batch_eval_metrics`: False
|
415 |
-
- `eval_on_start`: False
|
416 |
-
- `use_liger_kernel`: False
|
417 |
-
- `eval_use_gather_object`: False
|
418 |
-
- `average_tokens_across_devices`: False
|
419 |
-
- `prompts`: None
|
420 |
-
- `batch_sampler`: batch_sampler
|
421 |
-
- `multi_dataset_batch_sampler`: proportional
|
422 |
|
423 |
-
|
|
|
|
|
424 |
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
| -1 | -1 | - | 0.1245 (-0.4667) | 0.0299 (-0.5105) | 0.2478 (-0.0773) | 0.0258 (-0.4748) | 0.1012 (-0.3542) |
|
429 |
-
| 0.0001 | 1 | 1.1115 | - | - | - | - | - |
|
430 |
-
| 0.0221 | 200 | 1.1756 | - | - | - | - | - |
|
431 |
-
| 0.0443 | 400 | 1.0297 | - | - | - | - | - |
|
432 |
-
| 0.0664 | 600 | 0.828 | - | - | - | - | - |
|
433 |
-
| 0.0885 | 800 | 0.7511 | - | - | - | - | - |
|
434 |
-
| 0.1106 | 1000 | 0.7224 | 0.6667 (+0.0754) | 0.4106 (-0.1299) | 0.2898 (-0.0353) | 0.4147 (-0.0860) | 0.3717 (-0.0837) |
|
435 |
-
| 0.1328 | 1200 | 0.7315 | - | - | - | - | - |
|
436 |
-
| 0.1549 | 1400 | 0.7403 | - | - | - | - | - |
|
437 |
-
| 0.1770 | 1600 | 0.731 | - | - | - | - | - |
|
438 |
-
| 0.1992 | 1800 | 0.7495 | - | - | - | - | - |
|
439 |
-
| 0.2213 | 2000 | 0.7227 | 0.6639 (+0.0727) | 0.4653 (-0.0751) | 0.4152 (+0.0901) | 0.4534 (-0.0472) | 0.4446 (-0.0107) |
|
440 |
-
| 0.2434 | 2200 | 0.7002 | - | - | - | - | - |
|
441 |
-
| 0.2655 | 2400 | 0.6803 | - | - | - | - | - |
|
442 |
-
| 0.2877 | 2600 | 0.6812 | - | - | - | - | - |
|
443 |
-
| 0.3098 | 2800 | 0.6788 | - | - | - | - | - |
|
444 |
-
| 0.3319 | 3000 | 0.6792 | 0.6908 (+0.0996) | 0.5115 (-0.0289) | 0.3722 (+0.0472) | 0.3895 (-0.1112) | 0.4244 (-0.0310) |
|
445 |
-
| 0.3541 | 3200 | 0.6701 | - | - | - | - | - |
|
446 |
-
| 0.3762 | 3400 | 0.6442 | - | - | - | - | - |
|
447 |
-
| 0.3983 | 3600 | 0.6488 | - | - | - | - | - |
|
448 |
-
| 0.4204 | 3800 | 0.6252 | - | - | - | - | - |
|
449 |
-
| 0.4426 | 4000 | 0.6368 | 0.6973 (+0.1061) | 0.5330 (-0.0074) | 0.4015 (+0.0765) | 0.5109 (+0.0103) | 0.4818 (+0.0264) |
|
450 |
-
| 0.4647 | 4200 | 0.6455 | - | - | - | - | - |
|
451 |
-
| 0.4868 | 4400 | 0.6164 | - | - | - | - | - |
|
452 |
-
| 0.5090 | 4600 | 0.6436 | - | - | - | - | - |
|
453 |
-
| 0.5311 | 4800 | 0.6094 | - | - | - | - | - |
|
454 |
-
| 0.5532 | 5000 | 0.6287 | 0.6933 (+0.1021) | 0.5572 (+0.0168) | 0.3381 (+0.0131) | 0.4847 (-0.0159) | 0.4600 (+0.0046) |
|
455 |
-
| 0.5753 | 5200 | 0.6131 | - | - | - | - | - |
|
456 |
-
| 0.5975 | 5400 | 0.6179 | - | - | - | - | - |
|
457 |
-
| 0.6196 | 5600 | 0.6007 | - | - | - | - | - |
|
458 |
-
| 0.6417 | 5800 | 0.5961 | - | - | - | - | - |
|
459 |
-
| 0.6639 | 6000 | 0.6156 | 0.7059 (+0.1146) | 0.5424 (+0.0020) | 0.3565 (+0.0315) | 0.5356 (+0.0349) | 0.4782 (+0.0228) |
|
460 |
-
| 0.6860 | 6200 | 0.5884 | - | - | - | - | - |
|
461 |
-
| 0.7081 | 6400 | 0.5824 | - | - | - | - | - |
|
462 |
-
| 0.7303 | 6600 | 0.5692 | - | - | - | - | - |
|
463 |
-
| 0.7524 | 6800 | 0.5979 | - | - | - | - | - |
|
464 |
-
| 0.7745 | 7000 | 0.5843 | 0.7206 (+0.1293) | 0.5639 (+0.0235) | 0.3664 (+0.0414) | 0.5308 (+0.0301) | 0.4870 (+0.0317) |
|
465 |
-
| 0.7966 | 7200 | 0.5864 | - | - | - | - | - |
|
466 |
-
| 0.8188 | 7400 | 0.5852 | - | - | - | - | - |
|
467 |
-
| 0.8409 | 7600 | 0.5826 | - | - | - | - | - |
|
468 |
-
| 0.8630 | 7800 | 0.5817 | - | - | - | - | - |
|
469 |
-
| 0.8852 | 8000 | 0.5666 | 0.7267 (+0.1355) | 0.5411 (+0.0007) | 0.3818 (+0.0567) | 0.5273 (+0.0266) | 0.4834 (+0.0280) |
|
470 |
-
| 0.9073 | 8200 | 0.5776 | - | - | - | - | - |
|
471 |
-
| 0.9294 | 8400 | 0.5667 | - | - | - | - | - |
|
472 |
-
| 0.9515 | 8600 | 0.5587 | - | - | - | - | - |
|
473 |
-
| 0.9737 | 8800 | 0.5593 | - | - | - | - | - |
|
474 |
-
| 0.9958 | 9000 | 0.5567 | 0.7298 (+0.1385) | 0.5091 (-0.0313) | 0.3617 (+0.0366) | 0.4834 (-0.0173) | 0.4514 (-0.0040) |
|
475 |
-
| 1.0179 | 9200 | 0.4478 | - | - | - | - | - |
|
476 |
-
| 1.0401 | 9400 | 0.4039 | - | - | - | - | - |
|
477 |
-
| 1.0622 | 9600 | 0.4101 | - | - | - | - | - |
|
478 |
-
| 1.0843 | 9800 | 0.3935 | - | - | - | - | - |
|
479 |
-
| 1.1064 | 10000 | 0.396 | 0.7338 (+0.1426) | 0.5604 (+0.0200) | 0.3518 (+0.0268) | 0.5027 (+0.0021) | 0.4716 (+0.0163) |
|
480 |
-
| 1.1286 | 10200 | 0.4077 | - | - | - | - | - |
|
481 |
-
| 1.1507 | 10400 | 0.4245 | - | - | - | - | - |
|
482 |
-
| 1.1728 | 10600 | 0.3953 | - | - | - | - | - |
|
483 |
-
| 1.1950 | 10800 | 0.3912 | - | - | - | - | - |
|
484 |
-
| 1.2171 | 11000 | 0.3943 | 0.7319 (+0.1407) | 0.5296 (-0.0108) | 0.3645 (+0.0395) | 0.4739 (-0.0268) | 0.4560 (+0.0006) |
|
485 |
-
| 1.2392 | 11200 | 0.4032 | - | - | - | - | - |
|
486 |
-
| 1.2613 | 11400 | 0.4063 | - | - | - | - | - |
|
487 |
-
| 1.2835 | 11600 | 0.3909 | - | - | - | - | - |
|
488 |
-
| 1.3056 | 11800 | 0.3759 | - | - | - | - | - |
|
489 |
-
| 1.3277 | 12000 | 0.3944 | 0.7440 (+0.1528) | 0.4978 (-0.0426) | 0.3138 (-0.0112) | 0.5306 (+0.0299) | 0.4474 (-0.0080) |
|
490 |
-
| 1.3499 | 12200 | 0.3721 | - | - | - | - | - |
|
491 |
-
| 1.3720 | 12400 | 0.3888 | - | - | - | - | - |
|
492 |
-
| 1.3941 | 12600 | 0.3838 | - | - | - | - | - |
|
493 |
-
| 1.4162 | 12800 | 0.4023 | - | - | - | - | - |
|
494 |
-
| 1.4384 | 13000 | 0.3831 | 0.7470 (+0.1558) | 0.5280 (-0.0124) | 0.3479 (+0.0229) | 0.5049 (+0.0043) | 0.4603 (+0.0049) |
|
495 |
-
| 1.4605 | 13200 | 0.4027 | - | - | - | - | - |
|
496 |
-
| 1.4826 | 13400 | 0.3977 | - | - | - | - | - |
|
497 |
-
| 1.5048 | 13600 | 0.384 | - | - | - | - | - |
|
498 |
-
| 1.5269 | 13800 | 0.3773 | - | - | - | - | - |
|
499 |
-
| 1.5490 | 14000 | 0.3854 | 0.7447 (+0.1534) | 0.5363 (-0.0041) | 0.3637 (+0.0386) | 0.5521 (+0.0515) | 0.4840 (+0.0287) |
|
500 |
-
| 1.5711 | 14200 | 0.3632 | - | - | - | - | - |
|
501 |
-
| 1.5933 | 14400 | 0.3902 | - | - | - | - | - |
|
502 |
-
| 1.6154 | 14600 | 0.3862 | - | - | - | - | - |
|
503 |
-
| 1.6375 | 14800 | 0.3702 | - | - | - | - | - |
|
504 |
-
| 1.6597 | 15000 | 0.374 | 0.7508 (+0.1595) | 0.4950 (-0.0455) | 0.3909 (+0.0658) | 0.5166 (+0.0159) | 0.4675 (+0.0121) |
|
505 |
-
| 1.6818 | 15200 | 0.3814 | - | - | - | - | - |
|
506 |
-
| 1.7039 | 15400 | 0.3713 | - | - | - | - | - |
|
507 |
-
| 1.7260 | 15600 | 0.3697 | - | - | - | - | - |
|
508 |
-
| 1.7482 | 15800 | 0.3538 | - | - | - | - | - |
|
509 |
-
| 1.7703 | 16000 | 0.3797 | 0.7491 (+0.1579) | 0.5119 (-0.0285) | 0.3635 (+0.0384) | 0.4958 (-0.0049) | 0.4570 (+0.0017) |
|
510 |
-
| 1.7924 | 16200 | 0.374 | - | - | - | - | - |
|
511 |
-
| 1.8146 | 16400 | 0.3874 | - | - | - | - | - |
|
512 |
-
| 1.8367 | 16600 | 0.3568 | - | - | - | - | - |
|
513 |
-
| 1.8588 | 16800 | 0.3653 | - | - | - | - | - |
|
514 |
-
| 1.8809 | 17000 | 0.3706 | 0.7552 (+0.1640) | 0.5025 (-0.0379) | 0.3662 (+0.0412) | 0.5036 (+0.0029) | 0.4574 (+0.0020) |
|
515 |
-
| 1.9031 | 17200 | 0.3636 | - | - | - | - | - |
|
516 |
-
| 1.9252 | 17400 | 0.3606 | - | - | - | - | - |
|
517 |
-
| 1.9473 | 17600 | 0.3599 | - | - | - | - | - |
|
518 |
-
| 1.9695 | 17800 | 0.3535 | - | - | - | - | - |
|
519 |
-
| **1.9916** | **18000** | **0.3553** | **0.7579 (+0.1667)** | **0.5106 (-0.0298)** | **0.3632 (+0.0381)** | **0.5182 (+0.0176)** | **0.4640 (+0.0086)** |
|
520 |
-
|
521 |
-
* The bold row denotes the saved checkpoint.
|
522 |
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
|
|
|
|
|
|
|
|
|
|
531 |
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
publisher = "Association for Computational Linguistics",
|
545 |
-
url = "https://arxiv.org/abs/1908.10084",
|
546 |
-
}
|
547 |
```
|
548 |
|
549 |
<!--
|
550 |
-
|
|
|
|
|
551 |
|
552 |
-
|
553 |
-->
|
554 |
|
555 |
<!--
|
556 |
-
|
|
|
|
|
|
|
|
|
557 |
|
558 |
-
|
559 |
-->
|
560 |
|
561 |
<!--
|
562 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
563 |
|
564 |
-
|
565 |
-
-->
|
|
|
1 |
---
|
2 |
language:
|
3 |
- en
|
4 |
+
- es
|
5 |
license: apache-2.0
|
6 |
tags:
|
7 |
- sentence-transformers
|
|
|
99 |
- type: ndcg@10
|
100 |
value: 0.464
|
101 |
name: Ndcg@10
|
102 |
+
datasets:
|
103 |
+
- sentence-transformers/gooaq
|
104 |
---
|
105 |
+
[<img src="https://cdn-avatars.huggingface.co/v1/production/uploads/67b2f4e49edebc815a3a4739/R1g957j1aBbx8lhZbWmxw.jpeg" width="200"/>](https://huggingface.co/fjmgAI)
|
106 |
|
107 |
+
## Fine-Tuned Model
|
108 |
|
109 |
+
**`fjmgAI/rerank1-210M-EuroBERT`**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
+
## Base Model
|
112 |
+
**`EuroBERT/EuroBERT-210m`**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
+
## Fine-Tuning Method
|
115 |
+
This is a [Cross Encoder](https://www.sbert.net/docs/cross_encoder/usage/usage.html) model finetuned from [EuroBERT/EuroBERT-210m](https://huggingface.co/EuroBERT/EuroBERT-210m) using the [sentence-transformers](https://www.SBERT.net) library. It computes scores for pairs of texts, which can be used for text reranking and semantic search.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
+
## Dataset
|
118 |
+
**[`sentence-transformers/gooaq`](https://huggingface.co/datasets/sentence-transformers/gooaq)**
|
119 |
|
120 |
+
### Description
|
121 |
+
This dataset is a collection of question-answer pairs, collected from Google.
|
122 |
|
123 |
+
## Fine-Tuning Details
|
124 |
+
- The model was trained using 578,402 training samples from sentence-transformer.
|
125 |
|
126 |
#### Cross Encoder Reranking
|
127 |
|
|
|
192 |
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
|
193 |
-->
|
194 |
|
195 |
+
## Usage
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
|
197 |
+
### Direct Usage (Sentence Transformers)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
|
199 |
+
First install the Sentence Transformers library:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
|
201 |
+
```bash
|
202 |
+
pip install -U sentence-transformers
|
203 |
+
```
|
204 |
|
205 |
+
Then you can load this model and run inference.
|
206 |
+
```python
|
207 |
+
from sentence_transformers import CrossEncoder
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
|
209 |
+
# Download from the 🤗 Hub
|
210 |
+
model = CrossEncoder("fjmgAI/rerank1-210M-EuroBERT")
|
211 |
+
# Get scores for pairs of texts
|
212 |
+
pairs = [
|
213 |
+
['what are the risks with taking statins?', "['Muscle pain and damage. One of the most common complaints of people taking statins is muscle pain. ... ', 'Liver damage. Occasionally, statin use could cause an increase in the level of enzymes that signal liver inflammation. ... ', 'Increased blood sugar or type 2 diabetes. ... ', 'Neurological side effects.']"],
|
214 |
+
['what are the risks with taking statins?', 'Doctors discovered that statins can help lower blood pressure, as well as lower cholesterol. Statins are often prescribed to people with high cholesterol. Too much cholesterol in your blood increases your risk of heart attacks and strokes.'],
|
215 |
+
['what are the risks with taking statins?', 'Lipitor and Crestor are both effective statins that lower levels of “bad” cholesterol and increase levels of “good” cholesterol. While Crestor is the more potent statin, both medications are effective and have slightly different side effects and drug interactions.'],
|
216 |
+
['what are the risks with taking statins?', "About simvastatin Simvastatin belongs to a group of medicines called statins. It's used to lower cholesterol if you've been diagnosed with high blood cholesterol. It's also taken to prevent heart disease, including heart attacks and strokes."],
|
217 |
+
['what are the risks with taking statins?', 'Zetia works to lower cholesterol in a new way different from the statins: it inhibits the absorption of cholesterol in the small intestine, whereas the statins work by blocking cholesterol production in the liver.'],
|
218 |
+
]
|
219 |
+
scores = model.predict(pairs)
|
220 |
+
print(scores.shape)
|
221 |
+
# (5,)
|
222 |
|
223 |
+
# Or rank different texts based on similarity to a single text
|
224 |
+
ranks = model.rank(
|
225 |
+
'what are the risks with taking statins?',
|
226 |
+
[
|
227 |
+
"['Muscle pain and damage. One of the most common complaints of people taking statins is muscle pain. ... ', 'Liver damage. Occasionally, statin use could cause an increase in the level of enzymes that signal liver inflammation. ... ', 'Increased blood sugar or type 2 diabetes. ... ', 'Neurological side effects.']",
|
228 |
+
'Doctors discovered that statins can help lower blood pressure, as well as lower cholesterol. Statins are often prescribed to people with high cholesterol. Too much cholesterol in your blood increases your risk of heart attacks and strokes.',
|
229 |
+
'Lipitor and Crestor are both effective statins that lower levels of “bad” cholesterol and increase levels of “good” cholesterol. While Crestor is the more potent statin, both medications are effective and have slightly different side effects and drug interactions.',
|
230 |
+
"About simvastatin Simvastatin belongs to a group of medicines called statins. It's used to lower cholesterol if you've been diagnosed with high blood cholesterol. It's also taken to prevent heart disease, including heart attacks and strokes.",
|
231 |
+
'Zetia works to lower cholesterol in a new way different from the statins: it inhibits the absorption of cholesterol in the small intestine, whereas the statins work by blocking cholesterol production in the liver.',
|
232 |
+
]
|
233 |
+
)
|
234 |
+
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
|
|
|
|
|
|
|
235 |
```
|
236 |
|
237 |
<!--
|
238 |
+
### Direct Usage (Transformers)
|
239 |
+
|
240 |
+
<details><summary>Click to see the direct usage in Transformers</summary>
|
241 |
|
242 |
+
</details>
|
243 |
-->
|
244 |
|
245 |
<!--
|
246 |
+
### Downstream Usage (Sentence Transformers)
|
247 |
+
|
248 |
+
You can finetune this model on your own dataset.
|
249 |
+
|
250 |
+
<details><summary>Click to expand</summary>
|
251 |
|
252 |
+
</details>
|
253 |
-->
|
254 |
|
255 |
<!--
|
256 |
+
### Out-of-Scope Use
|
257 |
+
|
258 |
+
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
|
259 |
+
-->
|
260 |
+
|
261 |
+
### Framework Versions
|
262 |
+
- Python: 3.11.12
|
263 |
+
- Sentence Transformers: 4.0.2
|
264 |
+
- Transformers: 4.51.2
|
265 |
+
- PyTorch: 2.6.0+cu126
|
266 |
+
- Accelerate: 1.6.0
|
267 |
+
- Datasets: 3.5.0
|
268 |
+
- Tokenizers: 0.21.1
|
269 |
+
|
270 |
+
## Purpose
|
271 |
+
This tuned reranker model is optimized for **Spanish and English applications**, prioritizing **accurate reordering of results** by leveraging semantic similarity through refined embedding comparisons, ideal for enhancing **question-answering** and **document retrieval** tasks.
|
272 |
+
|
273 |
+
- **Developed by:** fjmgAI
|
274 |
+
- **License:** apache-2.0
|
275 |
|
276 |
+
[<img src="https://sbert.net/_static/logo.png" width="200"/>](https://github.com/UKPLab/sentence-transformers)
|
|