
# Persian-t5-formality-transfer

This is a formality style transfer model for the Persian language to convert colloquial text into a formal one. It is based on [the monolingual T5 model for Persian.](https://huggingface.co/Ahmad/parsT5-base) and [Persian T5 paraphraser](https://huggingface.co/erfan226/persian-t5-paraphraser)

Note: This model is still in development and therefore its outputs might not be very good. However, you can experiment with different values for the decoder to get better results. For more info check this [link.](https://huggingface.co/blog/how-to-generate)

## Usage

```python
>>> pip install transformers
>>> from transformers import (T5ForConditionalGeneration, AutoTokenizer, pipeline)
>>> import torch

model_path = 'erfan226/persian-t5-formality-transfer'
model = T5ForConditionalGeneration.from_pretrained(model_path)
tokenizer = AutoTokenizer.from_pretrained(model_path)
pipe = pipeline(task='text2text-generation', model=model, tokenizer=tokenizer)

def paraphrase(text):
  for j in range(3):
    out = pipe(text, encoder_no_repeat_ngram_size=4, do_sample=True, num_beams=5, max_length=128)[0]['generated_text']
    print("Paraphrase:", out)

text = "من با دوستام میرم بازی"
print("Original:", text)
paraphrase(text)

# Original: من با دوستام میرم بازی
# Paraphrase: دوست دارم با دوستانم بازی کنم.
# Paraphrase: من با دوستانم میرم...
# Paraphrase: من با دوستام بازی می کنم.

```

## Training data
TBD
{"language": "fa", "tags": ["Style transfer", "Formality style transfer"], "widget": [{"text": "\u0645\u0646 \u0628\u0627 \u062f\u0648\u0633\u062a\u0627\u0645 \u0645\u06cc\u0631\u0645 \u0628\u0627\u0632\u06cc."}, {"text": "\u0645\u0646 \u0628\u0647 \u062e\u0648\u0646\u0647 \u062f\u0648\u0633\u062a\u0645 \u0631\u0641\u062a\u0645."}]}
transformers pytorch t5 text2text-generation Style transfer Formality style transfer fa autotrain_compatible endpoints_compatible has_space text-generation-inference region:us
TAGS
#transformers #pytorch #t5 #text2text-generation #Style transfer #Formality style transfer #fa #autotrain_compatible #endpoints_compatible #has_space #text-generation-inference #region-us 


# Persian-t5-formality-transfer

This is a formality style transfer model for the Persian language to convert colloquial text into a formal one. It is based on the monolingual T5 model for Persian. and Persian T5 paraphraser

Note: This model is still in development and therefore its outputs might not be very good. However, you can experiment with different values for the decoder to get better results. For more info check this link.

## Usage



## Training data
TBD
# Persian-t5-formality-transfer

This is a formality style transfer model for the Persian language to convert colloquial text into a formal one. It is based on the monolingual T5 model for Persian. and Persian T5 paraphraser

Note: This model is still in development and therefore its outputs might not be very good. However, you can experiment with different values for the decoder to get better results. For more info check this link. ## Usage ## Training data
TBD
TAGS
#transformers #pytorch #t5 #text2text-generation #Style transfer #Formality style transfer #fa #autotrain_compatible #endpoints_compatible #has_space #text-generation-inference #region-us 
 # Persian-t5-formality-transfer

This is a formality style transfer model for the Persian language to convert colloquial text into a formal one. It is based on the monolingual T5 model for Persian. and Persian T5 paraphraser

Note: This model is still in development and therefore its outputs might not be very good. However, you can experiment with different values for the decoder to get better results. For more info check this link. ## Usage ## Training data
TBD
passage: TAGS
#transformers #pytorch #t5 #text2text-generation #Style transfer #Formality style transfer #fa #autotrain_compatible #endpoints_compatible #has_space #text-generation-inference #region-us 
# Persian-t5-formality-transfer

This is a formality style transfer model for the Persian language to convert colloquial text into a formal one. It is based on the monolingual T5 model for Persian. and Persian T5 paraphraser

Note: This model is still in development and therefore its outputs might not be very good. However, you can experiment with different values for the decoder to get better results. For more info check this link.## Usage## Training data
TBD