s-nlp / ruRoberta-large-paraphrase-v1

huggingface.co
Total runs: 155
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Model's Last Updated: April 04 2023
text-classification

Introduction of ruRoberta-large-paraphrase-v1

Model Details of ruRoberta-large-paraphrase-v1

This is a cross-encoder model trained to predict semantic equivalence of two Russian sentences.

It classifies text pairs as paraphrases (class 1) or non-paraphrases (class 0). Its scores can be used as a metric of content preservation for paraphrasing or text style transfer.

It is a sberbank-ai/ruRoberta-large model fine-tuned on a union of 3 datasets:

  1. RuPAWS : https://github.com/ivkrotova/rupaws_dataset based on Quora and QQP;
  2. ru_paraphraser : https://huggingface.co/merionum/ru_paraphraser ;
  3. Results of the manual check of content preservation for the RUSSE-2022 text detoxification dataset collection ( content_5.tsv ).

The task was formulated as binary classification: whether the two sentences have the same meaning (1) or different (0).

The table shows the training dataset size after duplication (joining text1 + text2 and text2 + text1 pairs):

source \ label 0 1
detox 1412 3843
paraphraser 5539 1688
rupaws_qqp 1112 792
rupaws_wiki 3526 2166

The model was trained with Adam optimizer and the following hyperparameters:

learning_rate = 1e-5
batch_size = 8
gradient_accumulation_steps = 4
n_epochs = 3
max_grad_norm = 1.0

After training, the model had the following ROC AUC scores on the test sets:

set ROC AUC
detox 0.857112
paraphraser 0.858465
rupaws_qqp 0.859195
rupaws_wiki 0.906121

Example usage:

import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer

model = AutoModelForSequenceClassification.from_pretrained('SkolkovoInstitute/ruRoberta-large-paraphrase-v1')
tokenizer = AutoTokenizer.from_pretrained('SkolkovoInstitute/ruRoberta-large-paraphrase-v1')

def get_similarity(text1, text2):
    """ Predict the probability that two Russian sentences are paraphrases of each other. """
    with torch.inference_mode():
        batch = tokenizer(
            text1, text2, 
            truncation=True, max_length=model.config.max_position_embeddings, return_tensors='pt',
        ).to(model.device)
        proba = torch.softmax(model(**batch).logits, -1)
    return proba[0][1].item()

print(get_similarity('Я тебя люблю', 'Ты мне нравишься'))  # 0.9798
print(get_similarity('Я тебя люблю', 'Я тебя ненавижу'))   # 0.0008

Runs of s-nlp ruRoberta-large-paraphrase-v1 on huggingface.co

155
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs

More Information About ruRoberta-large-paraphrase-v1 huggingface.co Model

ruRoberta-large-paraphrase-v1 huggingface.co

ruRoberta-large-paraphrase-v1 huggingface.co is an AI model on huggingface.co that provides ruRoberta-large-paraphrase-v1's model effect (), which can be used instantly with this s-nlp ruRoberta-large-paraphrase-v1 model. huggingface.co supports a free trial of the ruRoberta-large-paraphrase-v1 model, and also provides paid use of the ruRoberta-large-paraphrase-v1. Support call ruRoberta-large-paraphrase-v1 model through api, including Node.js, Python, http.

ruRoberta-large-paraphrase-v1 huggingface.co Url

https://huggingface.co/s-nlp/ruRoberta-large-paraphrase-v1

s-nlp ruRoberta-large-paraphrase-v1 online free

ruRoberta-large-paraphrase-v1 huggingface.co is an online trial and call api platform, which integrates ruRoberta-large-paraphrase-v1's modeling effects, including api services, and provides a free online trial of ruRoberta-large-paraphrase-v1, you can try ruRoberta-large-paraphrase-v1 online for free by clicking the link below.

s-nlp ruRoberta-large-paraphrase-v1 online free url in huggingface.co:

https://huggingface.co/s-nlp/ruRoberta-large-paraphrase-v1

ruRoberta-large-paraphrase-v1 install

ruRoberta-large-paraphrase-v1 is an open source model from GitHub that offers a free installation service, and any user can find ruRoberta-large-paraphrase-v1 on GitHub to install. At the same time, huggingface.co provides the effect of ruRoberta-large-paraphrase-v1 install, users can directly use ruRoberta-large-paraphrase-v1 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

ruRoberta-large-paraphrase-v1 install url in huggingface.co:

https://huggingface.co/s-nlp/ruRoberta-large-paraphrase-v1

Url of ruRoberta-large-paraphrase-v1

ruRoberta-large-paraphrase-v1 huggingface.co Url

Provider of ruRoberta-large-paraphrase-v1 huggingface.co

s-nlp
ORGANIZATIONS

Other API from s-nlp

huggingface.co

Total runs: 27
Run Growth: 11
Growth Rate: 40.74%
Updated:September 08 2023
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:June 25 2024