mRoBERTA_retrieval / README.md
crodri's picture
Update README.md
02f3bb0 verified
|
Raw History Blame Contribute Delete
28 kB
metadata
tags:
  - sentence-transformers
  - sentence-similarity
  - feature-extraction
  - generated_from_trainer
  - dataset_size:65360
  - loss:ContrastiveLoss
base_model: BSC-LT/mRoBERTa
widget:
  - source_sentence: El agua se volvió turbia desde que uso el ozono. ¿A qué se debe?
    sentences:
      - >-
        27 de septiembre de 2009 27 de septiembre de 2009Tegucigalpa, Honduras —
        En un comunicado del gobierno de facto hondureño, encabezado por Roberto
        Micheletti, se ha decretado un ultimatum de 10 días para que la embajada
        de Brasil defina el estatus del depuesto presidente Manuel Zelaya, quien
        permanece en la sede diplomática desde el lunes pasado. En el texto del
        comunicado se afirma: "ningún país puede tolerar que una embajada
        extranjera sea utilizada como base de mando para generar violencia y
        romper la tranquilidad, como el señor Zelaya lo ha estado haciendo desde
        su ingreso al territorio nacional", agregando: "nos veremos obligados a
        tomar medidas adicionales conforme al derecho internacional".
      - >-
        La nubosidad es una señal de que el ozono está haciendo su trabajo.
        Continúe ejecutando el filtro y desaparecerá en un par de días. La
        nubosidad también puede indicar un problema en el filtro. Verifique el
        filtro por daños y operación apropiada. Retrolavado si es necesario.
      - >-
        El filòsof i periodista Jordi Graupera ha guanyat la votació de
        Primàries Catalunya a Barcelona, amb 7.715 vots. El segon candidat més
        votat ha estat Adrià Alsina, ex-membre del secretariat de l'ANC, amb
        1.933 vots. La votació va començar divendres a les 20.00 i s'ha acabat
        avui a les 20.00.
  - source_sentence: >-
      What is a term being used for organizations that are for the citizens, by
      the citizens?
    sentences:
      - >-
        The term "civil society organization" (CSO) has been used by a growing
        number of organizations, such as the Center for the Study of Global
        Governance. The term "citizen sector organization" (CSO) has also been
        advocated to describe the sector – as one of citizens, for citizens – by
        organizations such as Ashoka: Innovators for the Public. A more broadly
        applicable term, "Social Benefit Organization" (SBO) has been advocated
        for by organizations such as MiniDonations.
      - >-
        The number e is a famous irrational number and is one of the most
        important numbers in mathematics. e is the base of the Natural
        Logarithms.
      - >-
        In 1885, British claims to a West African sphere of influence received
        recognition from other European nations at the Berlin Conference. The
        following year, it chartered the Royal Niger Company under the
        leadership of Sir George Taubman Goldie.
  - source_sentence: ¿Cuándo se llevó a cabo la adquisición?
    sentences:
      - >-
        La operadora de telefonía móvil de Sao Paulo, Telesp Celular, controlada
        por Portugal Telecom, adquirió el control de la empresa brasileña Ceterp
        Celular, perteneciente al grupo español Telefónica, se informó hoy. En
        un aviso publicitario publicado hoy en la prensa local, Telefónica
        indica que la operación se hizo efectiva ayer, Martes, por un valor de
        148,5 millones de reales (75,5 millones de dólares). La empresa vendida
        formaba parte de las Centrales Telefónicas de Ribeirao Preto (Ceterp),
        una pequeña compañía comprada en diciembre del año pasado por Telefónica
        en subasta pública.
      - >-
        Los ecologistas denuncian ante el TSJC la concesión por la Agència
        Catalana del' Aigua de caudales de la depuradora de Les Fonts para el
        futuro campo de Torrebonica. Adenc, que ya denunció el uso del agua,
        cree que han existido irregularidades en la concesión.
      - >-
        The word Anglican originates in ecclesia anglicana, a medieval Latin
        phrase dating to at least 1246 that means the English Church. There is
        no single "Anglican Church" with universal juridical authority, since
        each national or regional church has full autonomy. As the name
        suggests, the communion is an association of churches in full communion
        with the Archbishop of Canterbury.
  - source_sentence: >-
      What was introduced that made using Mac OS alternative operating systems
      easier?
    sentences:
      - >-
        and then to hand over control to a Mac OS-based bootloader application.
        Used even by Apple for A/UX and MkLinux, this technique is no longer
        necessary since the introduction of Open Firmware-based PCI Macs, though
        it was formerly used for convenience on many Old World ROM systems due
        to bugs in the firmware implementation.[citation needed] Now, Mac
        hardware boots directly from Open Firmware in most PowerPC-based Macs or
        EFI in all Intel-based Macs.
      - >-
        During the Napoleonic Wars in the late 18th century and early 19th
        century, Napoleon annexed territory formerly controlled by the Habsburgs
        and Savoys. In 1798 he established the Helvetic Republic in Switzerland;
        two years later he led an army across the St. Bernard pass and conquered
        almost all of the Alpine regions.
      - >-
        La visita coincideix amb un període de vaga a França per la reforma de
        les pensions que també afecta el col·lectiu que exerceix al Principat.
        La visita de Jean–Michel Blanquer a Andorra ha arrencat a primera hora
        amb una reunió amb el cap de govern, Xavier Espot. No se'n sap el
        contingut, però de segur que han parlat del reforç de la presència
        francesa a Andorra mitjançant el sistema educatiu.
  - source_sentence: Of pregnant women, how many are believed to be infected with HIV?
    sentences:
      - >-
        In 2004, the Swaziland government acknowledged for the first time that
        it suffered an AIDS crisis, with 38.8% of tested pregnant women infected
        with HIV (see AIDS in Africa). The then Prime Minister Themba Dlamini
        declared a humanitarian crisis due to the combined effect of drought,
        land degradation, increased poverty, and HIV/AIDS.
      - >-
        James Liebman, a professor of law at Columbia Law School, stated in 1996
        that his study found that when habeas corpus petitions in death penalty
        cases were traced from conviction to completion of the case that there
        was "a 40 percent success rate in all capital cases from 1978 to 1995."
        Similarly, a study by Ronald Tabak in a law review article puts the
        success rate in habeas corpus cases involving death row inmates even
        higher, finding that between "1976 and 1991, approximately 47 percent of
        the habeas petitions filed by death row inmates were granted."
      - >-
        Si t'allotges a Casa da Pendôa tens aquestes possibilitats d'aparcament
        (sota disponibilitat):Pàrquing interior de pagament,Pàrquing exterior de
        pagament
datasets:
  - langtech-innovation/trilingual_query_relevance
pipeline_tag: sentence-similarity
library_name: sentence-transformers
metrics:
  - cosine_accuracy
  - cosine_accuracy_threshold
  - cosine_f1
  - cosine_f1_threshold
  - cosine_precision
  - cosine_recall
  - cosine_ap
  - cosine_mcc
model-index:
  - name: SentenceTransformer based on BSC-LT/mRoBERTa
    results:
      - task:
          type: binary-classification
          name: Binary Classification
        dataset:
          name: trilingual query relevance dev
          type: trilingual_query_relevance_dev
        metrics:
          - type: cosine_accuracy
            value: 0.9214229867083659
            name: Cosine Accuracy
          - type: cosine_accuracy_threshold
            value: 0.7342114448547363
            name: Cosine Accuracy Threshold
          - type: cosine_f1
            value: 0.9215354586857515
            name: Cosine F1
          - type: cosine_f1_threshold
            value: 0.7342114448547363
            name: Cosine F1 Threshold
          - type: cosine_precision
            value: 0.9202182952182952
            name: Cosine Precision
          - type: cosine_recall
            value: 0.9228563982277821
            name: Cosine Recall
          - type: cosine_ap
            value: 0.9762691065142695
            name: Cosine Ap
          - type: cosine_mcc
            value: 0.8428494369763666
            name: Cosine Mcc
license: apache-2.0
language:
  - ca
  - es
  - en

SentenceTransformer based on BSC-LT/mRoBERTa

This is a sentence-transformers model finetuned from BSC-LT/mRoBERTa on the trilingual_query_relevance dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: BSC-LT/mRoBERTa
  • Maximum Sequence Length: 512 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity
  • Training Dataset:

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: RobertaModel 
  (1): Pooling({'word_embedding_dimension': 768, '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})
)

Usage

Direct Usage (Sentence Transformers)

First install the Sentence Transformers library:

pip install -U sentence-transformers

Then you can load this model and run inference.

from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("langtech-innovation/mRoBERTA_retrieval")
# Run inference

query ="Com ha dit Juncker que havia sigut Georgieva com a vicepresidenta?"

sentences = ["La vicepresidenta de la Comissió Europea i responsable de Pressupostos i Recursos Humans, Kristalina Georgieva, ha presentat aquest divendres la seva dimissió i deixarà el càrrec a finals d'any per treballar al Banc Mundial. El president de la CE, Jean-Claude Juncker, ha anunciat en un comunicat que el comissari alemany Günther H. Oettinger assumirà la carpeta de Georgieva, a qui ha definit com una 'excel·lent vicepresidenta'. Amb la vacant de Georgieva, s'iniciarà el procés per nomenar un nou comissari búlgar, que haurà de ser avalat pel Parlament Europeu.",\
"El infierno del Atlético en Segunda División es especialmente duro para Kiko, precisamente el jugador que prestó su imagen a la campaña publicitaria con la que el club madrileño buscó el respaldo de su afición. El más carismático jugador rojiblanco hasta hace unos meses fue objeto el sábado por la noche de un intento de agresión a la salida del estadio, después de la humillante derrota ante el Murcia. Un grupo de los más radicales miembros del Frente Atlético le acusó de ser el principal responsable del descenso y le reprochó con suma dureza no colaborar económicamente con la peña para sufragar sus desplazamientos.",\
 "Tras el infructuoso intento de realizar la marcha del domingo, los organizadores lanzaron un comunicado diciendo que 'no estamos asustados, estamos aquí, no cambiaremos (...) Ustedes están asustados, cambiarán y se acostumbrarán'. El İstanbul Onur Yürüyüşü, nombre local de la marcha del orgullo gay, fue organizado por primera vez en 2003, atrayendo según los reportes, entre decenas de miles y cien mil personas en 2014, año en que se celebró el último desfile y se toparía con una serie de bloqueos en los tres años siguientes. El año pasado, a los organizadores no se les brindó permiso para hacer la marcha tras los ataques militares que enfrentó Estambul, y en 2015 la marcha fue detenida cuando iba a comenzar, y la policía empleó chorros de agua y gas lacrimógeno para dispersar a los manifestantes."]

embeddings_sentences = model.encode(sentences)

embeddings_query = model.encode(query)



# Get the similarity scores for the embeddings

similarities = model.similarity(embeddings_sentences, embeddings_query)

similarities

tensor([[0.9194],
        [0.5663],
        [0.4800]])

Evaluation

Metrics

Binary Classification

Metric Value
cosine_accuracy 0.9214
cosine_accuracy_threshold 0.7342
cosine_f1 0.9215
cosine_f1_threshold 0.7342
cosine_precision 0.9202
cosine_recall 0.9229
cosine_ap 0.9763
cosine_mcc 0.8428

Training Details

Training Dataset

  • Dataset: trilingual_query_relevance at 32b70c9
  • Size: 61,231 training samples
  • Columns: sentence1, sentence2, and label
  • Approximate statistics based on the first 1000 samples:
    sentence1 sentence2 label
    type string string int
    details
    • min: 5 tokens
    • mean: 14.02 tokens
    • max: 81 tokens
    • min: 9 tokens
    • mean: 88.54 tokens
    • max: 391 tokens
    • 1: 100.00%
  • Samples:
    sentence1 sentence2 label
    Olvidé que tenía un bono e hice una nueva reserva. ¿Se puede aplicar mi bono y obtener un reembolso? No, no puede aplicar el bono a una reserva que ya se ha pagado. 1
    De quina època és típic el clarobscur naturalista en l'obra de Velázquez? La llum principal, com es dedueix per les ombres que s'aprecien, ve de davant de l'escena. En aquest quadre, ja s'observa l'inici de l'abandonament del clarobscur naturalista de la seva època sevillana. Els focus de llum que més destaquen formen una composició entre la corona d'Apol·lo, la llum de les flames del foc i els reflexos de l'armadura. 1
    How Much is The Distance from Nathia Gali to Murree? The distance from Nathia Gali to Murree is approximately 35 kilometers. 1
  • Loss: ContrastiveLoss with these parameters:
    {
        "distance_metric": "SiameseDistanceMetric.COSINE_DISTANCE",
        "margin": 0.5,
        "size_average": true
    }
    

Evaluation Dataset

trilingual_query_relevance

  • Dataset: trilingual_query_relevance at 32b70c9
  • Size: 15,348 evaluation samples
  • Columns: sentence1, sentence2, and label
  • Approximate statistics based on the first 1000 samples:
    sentence1 sentence2 label
    type string string int
    details
    • min: 5 tokens
    • mean: 14.15 tokens
    • max: 170 tokens
    • min: 8 tokens
    • mean: 91.45 tokens
    • max: 483 tokens
    • 1: 100.00%
  • Samples:
    sentence1 sentence2 label
    ¿Cómo se cancela Diri? Diri no es un servicio que requiere de un contrato forzoso, así que para cancelarlo solo se debe dejar de pagar. Al dejar de usar la línea por un tiempo de 12 meses, el servicio pasará a inactivo de forma automática. 1
    How did whitehead define "experience"? He also argued that the most basic elements of reality can all be regarded as experiential, indeed that everything is constituted by its experience. He used the term "experience" very broadly, so that even inanimate processes such as electron collisions are said to manifest some degree of experience. In this, he went against Descartes' separation of two different kinds of real existence, either exclusively material or else exclusively mental. 1
    ¿Cómo te llaman? Y tú con tus caras y tus nombres, nos dejaste tutearte. Fran, Bebeto, Aldana, Nando, Djukic, Mauro Silva... 1
  • Loss: ContrastiveLoss with these parameters:
    {
        "distance_metric": "SiameseDistanceMetric.COSINE_DISTANCE",
        "margin": 0.5,
        "size_average": true
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: steps
  • per_device_train_batch_size: 2
  • per_device_eval_batch_size: 2
  • num_train_epochs: 4
  • warmup_ratio: 0.1
  • fp16: True
  • load_best_model_at_end: True
  • gradient_checkpointing: True

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • prediction_loss_only: True
  • per_device_train_batch_size: 2
  • per_device_eval_batch_size: 2
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 5e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1.0
  • num_train_epochs: 4
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.1
  • warmup_steps: 0
  • log_level: passive
  • log_level_replica: warning
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • save_safetensors: True
  • save_on_each_node: False
  • save_only_model: False
  • restore_callback_states_from_checkpoint: False
  • no_cuda: False
  • use_cpu: False
  • use_mps_device: False
  • seed: 42
  • data_seed: None
  • jit_mode_eval: False
  • use_ipex: False
  • bf16: False
  • fp16: True
  • fp16_opt_level: O1
  • half_precision_backend: auto
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • local_rank: 0
  • ddp_backend: None
  • tpu_num_cores: None
  • tpu_metrics_debug: False
  • debug: []
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_prefetch_factor: None
  • past_index: -1
  • disable_tqdm: False
  • remove_unused_columns: True
  • label_names: None
  • load_best_model_at_end: True
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_min_num_params: 0
  • fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • skip_memory_metrics: True
  • use_legacy_prediction_loop: False
  • push_to_hub: False
  • resume_from_checkpoint: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_private_repo: None
  • hub_always_push: False
  • gradient_checkpointing: True
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • include_for_metrics: []
  • eval_do_concat_batches: True
  • fp16_backend: auto
  • push_to_hub_model_id: None
  • push_to_hub_organization: None
  • mp_parameters:
  • auto_find_batch_size: False
  • full_determinism: False
  • torchdynamo: None
  • ray_scope: last
  • ddp_timeout: 1800
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • dispatch_batches: None
  • split_batches: None
  • include_tokens_per_second: False
  • include_num_input_tokens_seen: False
  • neftune_noise_alpha: None
  • optim_target_modules: None
  • batch_eval_metrics: False
  • eval_on_start: False
  • use_liger_kernel: False
  • eval_use_gather_object: False
  • average_tokens_across_devices: False
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: proportional

Framework Versions

  • Python: 3.10.16
  • Sentence Transformers: 3.4.1
  • Transformers: 4.49.0
  • PyTorch: 2.5.1+cu124
  • Accelerate: 1.2.1
  • Datasets: 3.2.0
  • Tokenizers: 0.21.0

Citation

BibTeX

Sentence Transformers

@inproceedings{reimers-2019-sentence-bert,
    title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
    author = "Reimers, Nils and Gurevych, Iryna",
    booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
    month = "11",
    year = "2019",
    publisher = "Association for Computational Linguistics",
    url = "https://arxiv.org/abs/1908.10084",
}

ContrastiveLoss

@inproceedings{hadsell2006dimensionality,
    author={Hadsell, R. and Chopra, S. and LeCun, Y.},
    booktitle={2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR'06)},
    title={Dimensionality Reduction by Learning an Invariant Mapping},
    year={2006},
    volume={2},
    number={},
    pages={1735-1742},
    doi={10.1109/CVPR.2006.100}
}