Update README.md
Browse files
README.md
CHANGED
@@ -25,7 +25,37 @@ This repository contains a fine-tuned model for both Tamil summarization and Eng
|
|
25 |
![W&B Chart 23_3_2024, 11_46_59 pm.png](https://cdn-uploads.huggingface.co/production/uploads/65ae9249e50627e40c159b16/82PwF19H9V9o1CVoYuuJo.png)
|
26 |
## Usage
|
27 |
### Installation
|
|
|
28 |
You can install the necessary dependencies using pip:
|
29 |
|
30 |
```bash
|
31 |
-
pip install transformers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
![W&B Chart 23_3_2024, 11_46_59 pm.png](https://cdn-uploads.huggingface.co/production/uploads/65ae9249e50627e40c159b16/82PwF19H9V9o1CVoYuuJo.png)
|
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("suriya7/Tamil-Summarization")
|
43 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("suriya7/Tamil-Summarization")
|
44 |
+
|
45 |
+
- **Example English-to-Tamil Translation**
|
46 |
+
input_text = "This is an example English sentence."
|
47 |
+
input_ids = tokenizer.encode(input_text, return_tensors="pt").input_ids
|
48 |
+
outputs = model.generate(input_ids,max_length=128)
|
49 |
+
translated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
50 |
+
print("Translated Tamil Sentence:", translated_text)
|
51 |
+
|
52 |
+
- **Example Tamil Summarization**
|
53 |
+
tamil_article = "தமிழ் உரையினை சுருக்கமாக சுருக்கமாக உரையிடுவது எப்படி?"
|
54 |
+
tamil_input_ids = tokenizer.encode(tamil_article, return_tensors="pt",truncation=True).input_ids
|
55 |
+
summary_ids = model.generate(tamil_input_ids, max_length=128)
|
56 |
+
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
57 |
+
print("Summarized Tamil Text:", summary)
|
58 |
+
```
|
59 |
+
## Model Output
|
60 |
+
- **For translation tasks, the model outputs translated text in Tamil.**
|
61 |
+
- **For summarization tasks, the model outputs a summarized version of the input Tamil text.**
|