Romanian Sentence Transformers, trained on the Romanian Paraphrase Bible dataset, Cosine Similarity
This is a sentence-transformers model finetuned from readerbench/RoBERT-base on the Romanian Paraphrase Bible dataset dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for Sentence Similarity.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: readerbench/RoBERT-base
- Maximum Sequence Length: 512 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
- Training Dataset:
- Language: ro
- License: apache-2.0
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False, 'architecture': 'BertModel'})
(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("andyP/ro-sentence-transformers-v2")
# Run inference
sentences = [
'Mai bine e să locuiești Pe casă, decât să trăiești În ea – oricât ar fi de mare – C-o soață rea, gâlcevitoare.',
'Nu i s-a spus domnului meu ce am făcut când Izabela a ucis pe profeții DOMNULUI, cum am ascuns o sută de bărbați dintre profeții DOMNULUI, câte cincizeci într-o peșteră și i-am hrănit cu pâine și apă?',
'Și acum trimite‐mi un bărbat iscusit să lucreze în aur și în argint și în aramă și în fier și în purpură și în cârmezin și albastru și care să știe să facă săpături, ca să stea cu bărbații iscusiți care sunt la mine în Iuda și in Ierusalim, pe care i‐a pregătit David, tatăl meu.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.3137, 0.2443],
# [0.3137, 1.0000, 0.3197],
# [0.2443, 0.3197, 1.0000]])
Evaluation
Metrics
Semantic Similarity
- Datasets: `` and
ro_similarity-test
- Evaluated with
EmbeddingSimilarityEvaluator
Metric | ro_similarity-test | |
---|---|---|
pearson_cosine | 0.9915 | 0.9916 |
spearman_cosine | 0.9724 | 0.9728 |
Training Details
Training Dataset
Romanian Paraphrase Bible dataset
- Dataset: Romanian Paraphrase Bible dataset
- Size: 1,012,436 training samples
- Columns:
text1
,text2
, andlabel
- Approximate statistics based on the first 1000 samples:
text1 text2 label type string string float details - min: 9 tokens
- mean: 40.38 tokens
- max: 136 tokens
- min: 7 tokens
- mean: 36.64 tokens
- max: 122 tokens
- min: 0.11
- mean: 0.74
- max: 1.0
- Samples:
text1 text2 label O altă temelie dar, Față de cea care s-a pus – Și care e Hristos Iisus – Să mai așeze, nimenea, Nicicând, de-acum, nu va putea.
Căci nimeni nu poate pune o altă temelie în afară de Cea care este așezată și Care este Isus Cristos.
0.81
Voi da în mâna lui mareași în dreapta lui râurile.
Voi pune mâna lui pe mare și dreapta lui pe râuri.
0.89
Căutați binele, nu răul,ca să trăiți!Astfel Domnul, Dumnezeul Oștirilor,va fi cu voi, așa cum spuneți că este!
Căutați binele, și nu răul, ca să trăiți!Astfel, Domnul Dumnezeul Sabaótva fi cu voi, după cum spuneți.
0.9
- Loss:
CosineSimilarityLoss
with these parameters:{ "loss_fct": "torch.nn.modules.loss.MSELoss" }
Evaluation Dataset
Romanian Paraphrase Bible dataset
- Dataset: Romanian Paraphrase Bible dataset
- Size: 56,246 evaluation samples
- Columns:
text1
,text2
, andlabel
- Approximate statistics based on the first 1000 samples:
text1 text2 label type string string float details - min: 6 tokens
- mean: 39.53 tokens
- max: 145 tokens
- min: 9 tokens
- mean: 35.85 tokens
- max: 141 tokens
- min: 0.1
- mean: 0.75
- max: 1.0
- Samples:
text1 text2 label Cel ce le arde, să păzească Ce trebuie să împlinească:‘Nainte ca să intre iară, În tabără, să-și spele-afară, Trupul și straiele și-apoi, Să intre-n tabără-napoi. ”
Cel care le va arde, trebuie să își spele hainele și tot corpul în apă; apoi va putea reveni în tabără.
0.77
Și nu cumva, când vin din nou, Dumnezeul meu să mă umilească printre voi și să deplâng pe mulți care au păcătuit deja și nu s-au pocăit de necurăția și curvia și desfrânarea pe care le-au practicat.
Mă tem ca nu cumva, atunci când vin din nou, Dumnezeul meu să mă smerească înaintea voastră și să trebuiască astfel să-i jelesc pe mulți care au păcătuit în trecut și nu s-au pocăit de necurăția, imoralitatea și depravarea în care au trăit.
0.82
Nu suspina după noapte,care ia popoarele din locul lor.
Căci se vor ridica hristoși mincinoși și proroci mincinoși și vor face semne și minuni ca să ducă în rătăcire, dacă este cu putință, pe cei aleși.
0.27
- Loss:
CosineSimilarityLoss
with these parameters:{ "loss_fct": "torch.nn.modules.loss.MSELoss" }
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy
: stepsper_device_train_batch_size
: 156per_device_eval_batch_size
: 256learning_rate
: 2e-05num_train_epochs
: 20warmup_ratio
: 0.1bf16
: Trueload_best_model_at_end
: Truebatch_sampler
: no_duplicates
All Hyperparameters
Click to expand
overwrite_output_dir
: Falsedo_predict
: Falseeval_strategy
: stepsprediction_loss_only
: Trueper_device_train_batch_size
: 156per_device_eval_batch_size
: 256per_gpu_train_batch_size
: Noneper_gpu_eval_batch_size
: Nonegradient_accumulation_steps
: 1eval_accumulation_steps
: Nonetorch_empty_cache_steps
: Nonelearning_rate
: 2e-05weight_decay
: 0.0adam_beta1
: 0.9adam_beta2
: 0.999adam_epsilon
: 1e-08max_grad_norm
: 1.0num_train_epochs
: 20max_steps
: -1lr_scheduler_type
: linearlr_scheduler_kwargs
: {}warmup_ratio
: 0.1warmup_steps
: 0log_level
: passivelog_level_replica
: warninglog_on_each_node
: Truelogging_nan_inf_filter
: Truesave_safetensors
: Truesave_on_each_node
: Falsesave_only_model
: Falserestore_callback_states_from_checkpoint
: Falseno_cuda
: Falseuse_cpu
: Falseuse_mps_device
: Falseseed
: 42data_seed
: Nonejit_mode_eval
: Falseuse_ipex
: Falsebf16
: Truefp16
: Falsefp16_opt_level
: O1half_precision_backend
: autobf16_full_eval
: Falsefp16_full_eval
: Falsetf32
: Nonelocal_rank
: 1ddp_backend
: Nonetpu_num_cores
: Nonetpu_metrics_debug
: Falsedebug
: []dataloader_drop_last
: Truedataloader_num_workers
: 0dataloader_prefetch_factor
: Nonepast_index
: -1disable_tqdm
: Falseremove_unused_columns
: Truelabel_names
: Noneload_best_model_at_end
: Trueignore_data_skip
: Falsefsdp
: []fsdp_min_num_params
: 0fsdp_config
: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap
: Noneaccelerator_config
: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}deepspeed
: Nonelabel_smoothing_factor
: 0.0optim
: adamw_torchoptim_args
: Noneadafactor
: Falsegroup_by_length
: Falselength_column_name
: lengthddp_find_unused_parameters
: Noneddp_bucket_cap_mb
: Noneddp_broadcast_buffers
: Falsedataloader_pin_memory
: Truedataloader_persistent_workers
: Falseskip_memory_metrics
: Trueuse_legacy_prediction_loop
: Falsepush_to_hub
: Falseresume_from_checkpoint
: Nonehub_model_id
: Nonehub_strategy
: every_savehub_private_repo
: Nonehub_always_push
: Falsehub_revision
: Nonegradient_checkpointing
: Falsegradient_checkpointing_kwargs
: Noneinclude_inputs_for_metrics
: Falseinclude_for_metrics
: []eval_do_concat_batches
: Truefp16_backend
: autopush_to_hub_model_id
: Nonepush_to_hub_organization
: Nonemp_parameters
:auto_find_batch_size
: Falsefull_determinism
: Falsetorchdynamo
: Noneray_scope
: lastddp_timeout
: 1800torch_compile
: Falsetorch_compile_backend
: Nonetorch_compile_mode
: Noneinclude_tokens_per_second
: Falseinclude_num_input_tokens_seen
: Falseneftune_noise_alpha
: Noneoptim_target_modules
: Nonebatch_eval_metrics
: Falseeval_on_start
: Falseuse_liger_kernel
: Falseliger_kernel_config
: Noneeval_use_gather_object
: Falseaverage_tokens_across_devices
: Falseprompts
: Nonebatch_sampler
: no_duplicatesmulti_dataset_batch_sampler
: proportionalrouter_mapping
: {}learning_rate_mapping
: {}
Training Logs
Epoch | Step | Training Loss | Validation Loss | spearman_cosine | ro_similarity-test_spearman_cosine |
---|---|---|---|---|---|
0.3083 | 1000 | 0.0161 | 0.0053 | 0.8762 | - |
0.6165 | 2000 | 0.0044 | 0.0045 | 0.8992 | - |
0.9248 | 3000 | 0.0036 | 0.0036 | 0.9133 | - |
1.2330 | 4000 | 0.0031 | 0.0032 | 0.9212 | - |
1.5413 | 5000 | 0.0027 | 0.0028 | 0.9278 | - |
1.8496 | 6000 | 0.0023 | 0.0026 | 0.9319 | - |
2.1578 | 7000 | 0.002 | 0.0022 | 0.9381 | - |
2.4661 | 8000 | 0.0018 | 0.0021 | 0.9407 | - |
2.7744 | 9000 | 0.0015 | 0.0019 | 0.9451 | - |
3.0826 | 10000 | 0.0014 | 0.0018 | 0.9471 | - |
3.3909 | 11000 | 0.0012 | 0.0018 | 0.9496 | - |
3.6991 | 12000 | 0.0011 | 0.0016 | 0.9524 | - |
4.0074 | 13000 | 0.001 | 0.0017 | 0.9534 | - |
4.3157 | 14000 | 0.0009 | 0.0015 | 0.9534 | - |
4.6239 | 15000 | 0.0009 | 0.0014 | 0.9565 | - |
4.9322 | 16000 | 0.0008 | 0.0014 | 0.9574 | - |
5.2404 | 17000 | 0.0008 | 0.0014 | 0.9584 | - |
5.5487 | 18000 | 0.0007 | 0.0014 | 0.9597 | - |
5.8570 | 19000 | 0.0007 | 0.0013 | 0.9603 | - |
6.1652 | 20000 | 0.0006 | 0.0013 | 0.9602 | - |
6.4735 | 21000 | 0.0006 | 0.0013 | 0.9603 | - |
6.7818 | 22000 | 0.0006 | 0.0013 | 0.9626 | - |
7.0900 | 23000 | 0.0006 | 0.0013 | 0.9634 | - |
7.3983 | 24000 | 0.0005 | 0.0012 | 0.9634 | - |
7.7065 | 25000 | 0.0005 | 0.0012 | 0.9643 | - |
8.0148 | 26000 | 0.0005 | 0.0012 | 0.9651 | - |
8.3231 | 27000 | 0.0005 | 0.0012 | 0.9648 | - |
8.6313 | 28000 | 0.0005 | 0.0011 | 0.9664 | - |
8.9396 | 29000 | 0.0004 | 0.0012 | 0.9660 | - |
9.2478 | 30000 | 0.0004 | 0.0012 | 0.9659 | - |
9.5561 | 31000 | 0.0004 | 0.0011 | 0.9667 | - |
9.8644 | 32000 | 0.0004 | 0.0011 | 0.9677 | - |
10.1726 | 33000 | 0.0004 | 0.0011 | 0.9677 | - |
10.4809 | 34000 | 0.0004 | 0.0011 | 0.9678 | - |
10.7891 | 35000 | 0.0004 | 0.0011 | 0.9680 | - |
11.0974 | 36000 | 0.0004 | 0.0011 | 0.9680 | - |
11.4057 | 37000 | 0.0004 | 0.0011 | 0.9685 | - |
11.7139 | 38000 | 0.0003 | 0.0011 | 0.9691 | - |
12.0222 | 39000 | 0.0003 | 0.0011 | 0.9692 | - |
12.3305 | 40000 | 0.0003 | 0.0011 | 0.9690 | - |
12.6387 | 41000 | 0.0003 | 0.0011 | 0.9693 | - |
12.9470 | 42000 | 0.0003 | 0.0010 | 0.9698 | - |
13.2552 | 43000 | 0.0003 | 0.0010 | 0.9697 | - |
13.5635 | 44000 | 0.0003 | 0.0010 | 0.9704 | - |
13.8718 | 45000 | 0.0003 | 0.0010 | 0.9703 | - |
14.1800 | 46000 | 0.0003 | 0.0010 | 0.9703 | - |
14.4883 | 47000 | 0.0003 | 0.0010 | 0.9696 | - |
14.7965 | 48000 | 0.0003 | 0.0010 | 0.9707 | - |
15.1048 | 49000 | 0.0003 | 0.0010 | 0.9707 | - |
15.4131 | 50000 | 0.0003 | 0.0010 | 0.9711 | - |
15.7213 | 51000 | 0.0003 | 0.0010 | 0.9714 | - |
16.0296 | 52000 | 0.0003 | 0.0010 | 0.9716 | - |
16.3379 | 53000 | 0.0003 | 0.0010 | 0.9712 | - |
16.6461 | 54000 | 0.0003 | 0.0010 | 0.9718 | - |
16.9544 | 55000 | 0.0003 | 0.0010 | 0.9716 | - |
17.2626 | 56000 | 0.0002 | 0.0010 | 0.9717 | - |
17.5709 | 57000 | 0.0002 | 0.0010 | 0.9716 | - |
17.8792 | 58000 | 0.0002 | 0.0010 | 0.9719 | - |
18.1874 | 59000 | 0.0002 | 0.0010 | 0.9718 | - |
18.4957 | 60000 | 0.0002 | 0.0010 | 0.9719 | - |
18.8039 | 61000 | 0.0002 | 0.0010 | 0.9723 | - |
19.1122 | 62000 | 0.0002 | 0.0010 | 0.9723 | - |
19.4205 | 63000 | 0.0002 | 0.0010 | 0.9724 | - |
19.7287 | 64000 | 0.0002 | 0.0009 | 0.9724 | - |
-1 | -1 | - | - | - | 0.9728 |
- The bold row denotes the saved checkpoint.
Framework Versions
- Python: 3.12.3
- Sentence Transformers: 5.0.0
- Transformers: 4.53.3
- PyTorch: 2.7.1+cu126
- Accelerate: 1.9.0
- Datasets: 4.0.0
- Tokenizers: 0.21.2
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",
}
- Downloads last month
- 229
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support
Model tree for andyP/ro-sentence-transformers-v2
Base model
readerbench/RoBERT-baseDataset used to train andyP/ro-sentence-transformers-v2
Evaluation results
- Pearson Cosine on Unknownself-reported0.991
- Spearman Cosine on Unknownself-reported0.972
- Pearson Cosine on ro similarity testself-reported0.992
- Spearman Cosine on ro similarity testself-reported0.973