Downloads · 30 days
131
2% of all-time downloads
erfan226/persian-t5-paraphraser
persian-t5-paraphraser is a machine learning model from erfan226. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
This is a paraphrasing model for the Persian language. It is based on the monolingual T5 model for Persian.
Downloads · 30 days
131
2% of all-time downloads
All-time downloads
5.7K
Public
Repo size
3 GB
Likes
2
Public
Click a slice to open those files.
.bin990 MB · 100%
From the Hugging Face model README
This is a paraphrasing model for the Persian language. It is based on the monolingual T5 model for Persian.
>>> pip install transformers
>>> from transformers import (T5ForConditionalGeneration, AutoTokenizer, pipeline)
>>> import torch
model_path = 'erfan226/persian-t5-paraphraser'
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(5):
out = pipe(text, encoder_no_repeat_ngram_size=5, 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: شما می توانید با گسترش این مقاله، به کسب و کار خود کمک کنید.
# Paraphrase: می توانید با گسترش این مقالهٔ خرد آلمان کمک کنید.
# Paraphrase: شما می توانید با گسترش این مقالهٔ خرد، به گسترش آن کمک کنید.
This model was trained on the Persian subset of the Tapaco dataset. It should be noted that this model was trained on a very small dataset and therefore the performance might not be as expected, for now.