File size: 5,318 Bytes
f30b7f9
 
c9e09fc
 
 
 
 
 
 
 
a5c2d8c
f30b7f9
1df277c
 
 
 
 
 
c034279
1df277c
 
 
 
 
d6145b4
1df277c
 
cb857f8
1df277c
 
 
cb857f8
 
 
 
 
 
 
 
 
 
 
 
 
3b47336
 
3d1a6c0
cb857f8
 
 
 
 
3b47336
 
3d1a6c0
2e242c2
 
 
 
 
 
 
 
3d1a6c0
cb857f8
 
 
 
 
 
 
2e242c2
 
 
 
 
57eedae
7b89966
 
d6145b4
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
license: mit
datasets:
- HariprasathSB/tamil_summarization
language:
- en
- ta
tags:
- summarization
- translation
pipeline_tag: text2text-generation
---
# Tamil Summarization and English-to-Tamil Translation Model

## Overview
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.

## Model Details
- **Model Name**: [suriya7/Tamil-Summarization]
- **Model Type**: [Summarization , Translation]
- **Framework**: Hugging Face Transformers
- **Original Model**: [Mr-Vicky-01/Fine_tune_english_to_tamil](Mr-Vicky-01/Fine_tune_english_to_tamil)
- **Fine-tuning Dataset**: [HariprasathSB/tamil_summarization](https://huggingface.co/datasets/HariprasathSB/tamil_summarization)
- **Languages Supported**: English, Tamil

## Usage
### Installation

You can install the necessary dependencies using pip:

```bash
pip install transformers
```

## Inference

Below is an example of how to use the model for both summarization and translation tasks:
```python
# Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

tokenizer = AutoTokenizer.from_pretrained("suriya7/Tamil-Summarization")
model = AutoModelForSeq2SeqLM.from_pretrained("suriya7/Tamil-Summarization")

# Example English-to-Tamil Translation:

input_text = "Be the change that you wish to see in the world."
input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids
outputs = model.generate(input_ids,max_length=128)
translated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print("Translated Tamil Sentence:", translated_text)

# Example Tamil Summarization:

tamil_article = """இது குறித்து அவர் பிபிசி தமிழிடம் கூறுகையில், "இத்தீர்ப்பை மிகச் சிறந்த முற்போக்கான தீர்ப்பாக பார்க்கிறேன்.
அடிப்படை உரிமை என்ன என்பதை மிகவும் தீவிரமாக இத்தீர்ப்பு விளக்கியுள்ளது" என்றார்.
"இந்திய அரசியலமைப்பின் 21-ஆவது விதியை மிகவும் ஆழமாக நீதிமன்றம் விளக்கியுள்ளது என்றும்,
ஏற்கனவே இரு வேறு வழக்குகளில் தனி நபர் அந்தரங்கத்தை அடிப்படை உரிமை பாதுகாக்காது எனக் குறிப்பிட்ட தீர்ப்புகளைத் திருத்தி
அந்த உரிமையை தற்போது உச்ச நீதிமன்றம் பாதுகாத்துள்ளது" என்று என்.ராம் கூறினார்.
"ஆதார் பதிவு விவகாரத்தில் இந்த தீர்ப்பு நிச்சயமாக பிரதிபலிக்கும் என்று கூறும் அவர், ஆதார் முறையைத் திணிக்க முயற்சிக்கும்
மத்திய அரசின் எண்ணம் இனி கடினமாக இருக்கும்" என்றார். "நெருக்கடி காலத்தில் நீதிபதி எச்.ஆர். கன்னா அளித்த தீர்ப்பு ஏற்படுத்திய
மாற்றத்தைப் போல இந்தத் தீர்ப்பும் சமூகத்தில் மாற்றத்தை ஏற்படுத்தலாம் என்று சிலர் கருதுவதாகவும்,மொத்தத்தில் இது ஒரு முக்கியத்துவம் நிறைந்த தீர்ப்பாகும்"
என்றும் என்.ராம் தெரிவித்தார். பிற செய்திகள் : சமூக ஊடகங்களில் பிபிசி தமிழ்"""

tamil_input_ids = tokenizer.encode(tamil_article, return_tensors="pt",truncation=True).input_ids
summary_ids = model.generate(tamil_input_ids, max_length=128)
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
print("Summarized Tamil Text:", summary)
```
## Model Output
- **For translation tasks, the model outputs translated text in Tamil.**
- **For summarization tasks, the model outputs a summarized version of the input Tamil text.**

## Fine-Tuning
If you want to fine-tune the model on your own dataset, you can follow these steps:

Prepare your dataset in the appropriate format
- for summarization use prefix as "summarize: "
- for translation default no prefix, directely u can tokenize the input and tokenize the output using target_text

## Model Performance
![W&B Chart 23_3_2024, 11_46_59 pm.png](https://cdn-uploads.huggingface.co/production/uploads/65ae9249e50627e40c159b16/82PwF19H9V9o1CVoYuuJo.png)