Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,82 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
datasets:
|
| 4 |
+
- HariprasathSB/tamil_summarization
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
- ta
|
| 8 |
+
tags:
|
| 9 |
+
- summarization
|
| 10 |
+
- translation
|
| 11 |
+
pipeline_tag: text2text-generation
|
| 12 |
---
|
| 13 |
+
# Tamil Summarization and English-to-Tamil Translation Model
|
| 14 |
+
|
| 15 |
+
## Overview
|
| 16 |
+
This repository contains a fine-tuned model for both Tamil summarization and English-to-Tamil translation. The model was fine-tuned using the Hugging Face Transformers library. This README provides information on how to use the model and its capabilities.
|
| 17 |
+
|
| 18 |
+
## Model Details
|
| 19 |
+
- **Model Name**: [suriya7/Tamil-Summarization]
|
| 20 |
+
- **Model Type**: [Summarization , Translation]
|
| 21 |
+
- **Framework**: Hugging Face Transformers
|
| 22 |
+
- **Original Model**: [Mr-Vicky-01/Fine_tune_english_to_tamil](Mr-Vicky-01/Fine_tune_english_to_tamil)
|
| 23 |
+
- **Fine-tuning Dataset**: [HariprasathSB/tamil_summarization](https://huggingface.co/datasets/HariprasathSB/tamil_summarization)
|
| 24 |
+
- **Languages Supported**: English, Tamil
|
| 25 |
+
|
| 26 |
+
## Usage
|
| 27 |
+
### Installation
|
| 28 |
+
|
| 29 |
+
You can install the necessary dependencies using pip:
|
| 30 |
+
|
| 31 |
+
```bash
|
| 32 |
+
pip install transformers
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
## Inference
|
| 36 |
+
|
| 37 |
+
Below is an example of how to use the model for both summarization and translation tasks:
|
| 38 |
+
```python
|
| 39 |
+
# Load model directly
|
| 40 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 41 |
+
|
| 42 |
+
tokenizer = AutoTokenizer.from_pretrained("Mr-Vicky-01/Finetuned_tamil_summarization")
|
| 43 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("Mr-Vicky-01/Finetuned_tamil_summarization")
|
| 44 |
+
|
| 45 |
+
# Example English-to-Tamil Translation:
|
| 46 |
+
|
| 47 |
+
input_text = "Be the change that you wish to see in the world."
|
| 48 |
+
input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids
|
| 49 |
+
outputs = model.generate(input_ids,max_length=128)
|
| 50 |
+
translated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 51 |
+
print("Translated Tamil Sentence:", translated_text)
|
| 52 |
+
|
| 53 |
+
# Example Tamil Summarization:
|
| 54 |
+
|
| 55 |
+
tamil_article = """இது குறித்து அவர் பிபிசி தமிழிடம் கூறுகையில், "இத்தீர்ப்பை மிகச் சிறந்த முற்போக்கான தீர்ப்பாக பார்க்கிறேன்.
|
| 56 |
+
அடிப்படை உரிமை என்ன என்பதை மிகவும் தீவிரமாக இத்தீர்ப்பு விளக்கியுள்ளது" என்றார்.
|
| 57 |
+
"இந்திய அரசியலமைப்பின் 21-ஆவது விதியை மிகவும் ஆழமாக நீதிமன்றம் விளக்கியுள்ளது என்றும்,
|
| 58 |
+
ஏற்கனவே இரு வேறு வழக்குகளில் தனி நபர் அந்தரங்கத்தை அடிப்படை உரிமை பாதுகாக்காது எனக் குறிப்பிட்ட தீர்ப்புகளைத் திருத்தி
|
| 59 |
+
அந்த உரிமையை தற்போது உச்ச நீதிமன்றம் பாதுகாத்துள்ளது" என்று என்.ராம் கூறினார்.
|
| 60 |
+
"ஆதார் பதிவு விவகாரத்தில் இந்த தீர்ப்பு நிச்சயமாக பிரதிபலிக்கும் என்று கூறும் அவர், ஆதார் முறையைத் திணிக்க முயற்சிக்கும்
|
| 61 |
+
மத்திய அரசின் எண்ணம் இனி கடினமாக இருக்கும்" என்றார். "நெருக்கடி காலத்தில் நீதிபதி எச்.ஆர். கன்னா அளித்த தீர்ப்பு ஏற்படுத்திய
|
| 62 |
+
மாற்றத்தைப் போல இந்தத் தீர்ப்பும் சமூகத்தில் மாற்றத்தை ஏற்படுத்தலாம் என்று சிலர் கருதுவதாகவும்,மொத்தத்தில் இது ஒரு முக்கியத்துவம் நிறைந்த தீர்ப்பாகும்"
|
| 63 |
+
என்றும் என்.ராம் தெரிவித்தார். பிற செய்திகள் : சமூக ஊடகங்களில் பிபிசி தமிழ்"""
|
| 64 |
+
|
| 65 |
+
tamil_input_ids = tokenizer.encode(tamil_article, return_tensors="pt",truncation=True).input_ids
|
| 66 |
+
summary_ids = model.generate(tamil_input_ids, max_length=128)
|
| 67 |
+
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
| 68 |
+
print("Summarized Tamil Text:", summary)
|
| 69 |
+
```
|
| 70 |
+
## Model Output
|
| 71 |
+
- **For translation tasks, the model outputs translated text in Tamil.**
|
| 72 |
+
- **For summarization tasks, the model outputs a summarized version of the input Tamil text.**
|
| 73 |
+
|
| 74 |
+
## Fine-Tuning
|
| 75 |
+
If you want to fine-tune the model on your own dataset, you can follow these steps:
|
| 76 |
+
|
| 77 |
+
Prepare your dataset in the appropriate format
|
| 78 |
+
- for summarization use prefix as "summarize: "
|
| 79 |
+
- for translation default no prefix, directely u can tokenize the input and tokenize the output using target_text
|
| 80 |
+
|
| 81 |
+
## Model Performance
|
| 82 |
+

|