Persian Title Generator (mT5)
Model Details
- Model Name: Persian Title Generator (mT5)
- Model Type: Seq2Seq
- Language: Persian (Farsi)
- Base Model: google/mt5-base
- License: MIT License
Model Description
This model is a fine-tuned version of the mT5 model, specifically designed for generating titles in Persian. The base model, mT5, is a multilingual variant of the T5 model, capable of performing various natural language processing tasks in multiple languages. This fine-tuned version focuses on generating appropriate titles for given Persian texts.
Training Data
The training data used for this model consists of a custom dataset gathered and preprocessed from various sources. The dataset includes two main columns:
title
: The target title for the given text.context
: The text for which a title is to be generated.
The dataset was divided into training and validation sets to ensure the model's ability to generalize to new, unseen texts.
Training Procedure
The model was fine-tuned using the Hugging Face Transformers library. The training process involved the following steps:
- Tokenization: The texts were tokenized using the
google/mt5-base
tokenizer, with a prefix "generate a title for: " added to the context. - Training Configuration: The model was trained with a learning rate of 5e-5, batch size of 8, and for 2 epochs. A cosine learning rate scheduler was used, and the best model was saved based on evaluation performance.
- Evaluation: The model's performance was evaluated periodically during training, and the best-performing model checkpoint was retained.
Intended Use
This model is intended to be used for generating titles for Persian texts. It can be applied in various contexts, including:
- News Articles: Generating catchy and relevant titles for news articles.
- Blog Posts: Creating engaging titles for blog entries.
- Academic Papers: Suggesting titles for academic abstracts and papers.
Example
Here is an example of how to use the model to generate a title for a given Persian text:
from transformers import pipeline
text = """generate title for: هنگام آتشسوزی، آرام باشید و مراقب سلامتی خود و دیگران باشید. چند توصیه زیر را انجام دهید:
* فوراً، تلفن آتشنشانی را فراخوانید تا آنها بتوانند سریعترین پاسخ ممکن را ارائه دهند.
* از نزدیکترین راه خروجی خارج شوید و بیرون بیایید.
* هیچ چیزی را جمع نکنید، زیرا زمان کمی دارید و احتمال دارد که دیر شود.
* هیچ کاری را انجام ندهید که خطرناک باشد و سلامت شما را تهدید کند.
* اگر امکان دارد، آب را روی شعلههای کوچک آتش بسپارید، اما فقط اگر اطمینان حاصل کنید که امنیت کامل وجود دارد.
* پس از اینکه همه افراد سالم بیرون آمدند، آتشنشانیها رسیدگی خواهند کرد.
به یاد داشته باشید: سرعت و احتیاط کلیدی در مدیریت آتشسوزی هستند. مطمئن شوید که تمام مسیرها بسته شدهاند و وسایل اضطراری مانند ماسک هوایی یا لباس گرم آماده باشند. همچنین، آموزشهایی دریافت کنید که نحوه واکنش مناسب در صورت آتشسوزی را نشان دهد."""
translator = pipeline("summarization", model="your_model_checkpoint", max_length=512, repetition_penalty=0.9)
print(translator(text))
Limitations and Biases
While this model aims to generate relevant titles, there are some limitations and potential biases:
- Data Bias: The model's performance is dependent on the quality and diversity of the training data. Biases in the training data can result in biased outputs.
- Language Specificity: The model is fine-tuned specifically for Persian and may not perform well with texts in other languages.
- Context Length: The model's ability to generate accurate titles may degrade for very long texts due to tokenization limits.
Contact
For questions or further information, please contact:
- Amir Masoud Ahmadi: [email protected]
- Downloads last month
- 12
Model tree for myrkur/persian-title-generator
Base model
google/mt5-base