myrkur commited on
Commit
de63e28
1 Parent(s): 8ebea64

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +79 -1
README.md CHANGED
@@ -3,6 +3,7 @@ license: apache-2.0
3
  language:
4
  - fa
5
  library_name: transformers
 
6
  widget:
7
  - text: >-
8
  generate title for: در صورت بروز آتش‌سوزی، انجام اقدامات زیر می‌تواند به نجات جان شما و کاهش خسارات کمک کند:
@@ -23,4 +24,81 @@ widget:
23
  همچنین، پیشگیری از آتش‌سوزی با رعایت اصول ایمنی بسیار مهم است. مواردی مانند بررسی سیستم‌های برق، نصب دتکتورهای دود و خاموش‌کننده‌های آتش در خانه، آموزش‌های ایمنی به اعضای خانواده و نگهداری صحیح مواد قابل اشتعال می‌تواند به کاهش خطرات آتش‌سوزی کمک کند.
24
  example_title: Summarization Example 1
25
  pipeline_tag: summarization
26
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  language:
4
  - fa
5
  library_name: transformers
6
+ base_model: google/mt5-base
7
  widget:
8
  - text: >-
9
  generate title for: در صورت بروز آتش‌سوزی، انجام اقدامات زیر می‌تواند به نجات جان شما و کاهش خسارات کمک کند:
 
24
  همچنین، پیشگیری از آتش‌سوزی با رعایت اصول ایمنی بسیار مهم است. مواردی مانند بررسی سیستم‌های برق، نصب دتکتورهای دود و خاموش‌کننده‌های آتش در خانه، آموزش‌های ایمنی به اعضای خانواده و نگهداری صحیح مواد قابل اشتعال می‌تواند به کاهش خطرات آتش‌سوزی کمک کند.
25
  example_title: Summarization Example 1
26
  pipeline_tag: summarization
27
+ ---
28
+ Sure, here is a model card for your Hugging Face model:
29
+
30
+ ---
31
+
32
+ # Model Card: Persian Title Generator (mT5)
33
+
34
+ ## Model Details
35
+
36
+ - **Model Name**: Persian Title Generator (mT5)
37
+ - **Model Type**: Seq2Seq
38
+ - **Language**: Persian (Farsi)
39
+ - **Base Model**: [google/mt5-base](https://huggingface.co/google/mt5-base)
40
+ - **License**: MIT License
41
+
42
+ ## Model Description
43
+
44
+ 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.
45
+
46
+ ## Training Data
47
+
48
+ The training data used for this model consists of a custom dataset gathered and preprocessed from various sources. The dataset includes two main columns:
49
+
50
+ - `title`: The target title for the given text.
51
+ - `context`: The text for which a title is to be generated.
52
+
53
+ The dataset was divided into training and validation sets to ensure the model's ability to generalize to new, unseen texts.
54
+
55
+ ## Training Procedure
56
+
57
+ The model was fine-tuned using the Hugging Face Transformers library. The training process involved the following steps:
58
+
59
+ 1. **Tokenization**: The texts were tokenized using the `google/mt5-base` tokenizer, with a prefix "generate a title for: " added to the context.
60
+ 2. **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.
61
+ 3. **Evaluation**: The model's performance was evaluated periodically during training, and the best-performing model checkpoint was retained.
62
+
63
+ ## Intended Use
64
+
65
+ This model is intended to be used for generating titles for Persian texts. It can be applied in various contexts, including:
66
+
67
+ - **News Articles**: Generating catchy and relevant titles for news articles.
68
+ - **Blog Posts**: Creating engaging titles for blog entries.
69
+ - **Academic Papers**: Suggesting titles for academic abstracts and papers.
70
+
71
+ ## Example
72
+
73
+ Here is an example of how to use the model to generate a title for a given Persian text:
74
+
75
+ ```python
76
+ from transformers import pipeline
77
+
78
+ text = """generate title for: هنگام آتش‌سوزی، آرام باشید و مراقب سلامتی خود و دیگران باشید. چند توصیه زیر را انجام دهید:
79
+
80
+ * فوراً، تلفن آتش‌نشانی را فراخوانید تا آنها بتوانند سریع‌ترین پاسخ ممکن را ارائه دهند.
81
+ * از نزدیکترین راه خروجی خارج شوید و بیرون بیایید.
82
+ * هیچ چیزی را جمع نکنید، زیرا زمان کمی دارید و احتمال دارد که دیر شود.
83
+ * هیچ کاری را انجام ندهید که خطرناک باشد و سلامت شما را تهدید کند.
84
+ * اگر امکان دارد، آب را روی شعله‌های کوچک آتش بسپارید، اما فقط اگر اطمینان حاصل کنید که امنیت کامل وجود دارد.
85
+ * پس از اینکه همه افراد سالم بیرون آمدند، آتش‌نشانی‌ها رسیدگی خواهند کرد.
86
+
87
+ به یاد داشته باشید: سرعت و احتیاط کلیدی در مدیریت آتش‌سوزی هستند. مطمئن شوید که تمام مسیرها بسته شده‌اند و وسایل اضطراری مانند ماسک هوایی یا لباس گرم آماده باشند. همچنین، آموزش‌هایی دریافت کنید که نحوه واکنش مناسب در صورت آتش‌سوزی را نشان دهد."""
88
+
89
+ translator = pipeline("summarization", model="your_model_checkpoint", max_length=512, repetition_penalty=0.9)
90
+ print(translator(text))
91
+ ```
92
+
93
+ ## Limitations and Biases
94
+
95
+ While this model aims to generate relevant titles, there are some limitations and potential biases:
96
+
97
+ - **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.
98
+ - **Language Specificity**: The model is fine-tuned specifically for Persian and may not perform well with texts in other languages.
99
+ - **Context Length**: The model's ability to generate accurate titles may degrade for very long texts due to tokenization limits.
100
+
101
+ ## Contact
102
+ For questions or further information, please contact:
103
+
104
+ - Amir Masoud Ahmadi: [amirmasoud.ahkol@gmail.com](mailto:amirmasoud.ahkol@gmail.com)