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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: gemma-terms-of-use
|
| 4 |
+
license_link: https://ai.google.dev/gemma/terms
|
| 5 |
+
base_model: google/gemma-2b
|
| 6 |
+
datasets:
|
| 7 |
+
- ravithejads/samvaad-hi-filtered
|
| 8 |
+
- Telugu-LLM-Labs/telugu_teknium_GPTeacher_general_instruct_filtered_romanized
|
| 9 |
+
- Telugu-LLM-Labs/telugu_alpaca_yahma_cleaned_filtered_romanized
|
| 10 |
+
- Telugu-LLM-Labs/sindhi_alpaca_yahma_cleaned_filtered
|
| 11 |
+
- Telugu-LLM-Labs/urdu_alpaca_yahma_cleaned_filtered
|
| 12 |
+
- Telugu-LLM-Labs/marathi_alpaca_yahma_cleaned_filtered
|
| 13 |
+
- Telugu-LLM-Labs/assamese_alpaca_yahma_cleaned_filtered
|
| 14 |
+
- Telugu-LLM-Labs/konkani_alpaca_yahma_cleaned_filtered
|
| 15 |
+
- Telugu-LLM-Labs/nepali_alpaca_yahma_cleaned_filtered
|
| 16 |
+
- abhinand/tamil-alpaca
|
| 17 |
+
- Tensoic/airoboros-3.2_kn
|
| 18 |
+
- Tensoic/gpt-teacher_kn
|
| 19 |
+
- VishnuPJ/Alpaca_Instruct_Malayalam
|
| 20 |
+
- Tensoic/Alpaca-Gujarati
|
| 21 |
+
- HydraIndicLM/punjabi_alpaca_52K
|
| 22 |
+
- HydraIndicLM/bengali_alpaca_dolly_67k
|
| 23 |
+
- OdiaGenAI/Odia_Alpaca_instructions_52k
|
| 24 |
+
- yahma/alpaca-cleaned
|
| 25 |
+
language:
|
| 26 |
+
- te
|
| 27 |
+
- en
|
| 28 |
+
- ta
|
| 29 |
+
- ml
|
| 30 |
+
- mr
|
| 31 |
+
- hi
|
| 32 |
+
- kn
|
| 33 |
+
- sd
|
| 34 |
+
- ne
|
| 35 |
+
- ur
|
| 36 |
+
- as
|
| 37 |
+
- gu
|
| 38 |
+
- bn
|
| 39 |
+
- pa
|
| 40 |
+
- or
|
| 41 |
+
library_name: transformers
|
| 42 |
+
pipeline_tag: text-generation
|
| 43 |
+
---
|
| 44 |
+
|
| 45 |
+
# Indic-gemma-2b-finetuned-sft-Navarasa-2.0
|
| 46 |
+
|
| 47 |
+
This model is based on [google/gemma-2b](https://huggingface.co/google/gemma-2b) and hase been LoRA finetuned on 15 Indian languages and English language instruction datasets:
|
| 48 |
+
|
| 49 |
+
1. #### Hindi - [ravithejads/samvaad-hi-filtered](https://huggingface.co/datasets/ravithejads/samvaad-hi-filtered), [HydraIndicLM/hindi_alpaca_dolly_67k](https://huggingface.co/datasets/HydraIndicLM/hindi_alpaca_dolly_67k)(sampled)
|
| 50 |
+
2. #### Telugu - [Telugu-LLM-Labs/telugu_alpaca_yahma_cleaned_filtered_romanized](https://huggingface.co/datasets/Telugu-LLM-Labs/telugu_alpaca_yahma_cleaned_filtered_romanized), [Telugu-LLM-Labs/telugu_teknium_GPTeacher_general_instruct_filtered_romanized](https://huggingface.co/datasets/Telugu-LLM-Labs/telugu_teknium_GPTeacher_general_instruct_filtered_romanized)
|
| 51 |
+
3. #### Marathi - [Telugu-LLM-Labs/sindhi_alpaca_yahma_cleaned_filtered](https://huggingface.co/datasets/Telugu-LLM-Labs/sindhi_alpaca_yahma_cleaned_filtered)
|
| 52 |
+
4. #### Urdu - [Telugu-LLM-Labs/urdu_alpaca_yahma_cleaned_filtered](https://huggingface.co/datasets/Telugu-LLM-Labs/urdu_alpaca_yahma_cleaned_filtered)
|
| 53 |
+
5. #### Assamese - [Telugu-LLM-Labs/assamese_alpaca_yahma_cleaned_filtered](https://huggingface.co/datasets/Telugu-LLM-Labs/assamese_alpaca_yahma_cleaned_filtered)
|
| 54 |
+
6. #### Konkani - [Telugu-LLM-Labs/konkani_alpaca_yahma_cleaned_filtered](https://huggingface.co/datasets/Telugu-LLM-Labs/konkani_alpaca_yahma_cleaned_filtered)
|
| 55 |
+
7. #### Nepali - [Telugu-LLM-Labs/nepali_alpaca_yahma_cleaned_filtered](https://huggingface.co/datasets/Telugu-LLM-Labs/nepali_alpaca_yahma_cleaned_filtered)
|
| 56 |
+
8. #### Sindhi - [Telugu-LLM-Labs/sindhi_alpaca_yahma_cleaned_filtered](https://huggingface.co/datasets/Telugu-LLM-Labs/sindhi_alpaca_yahma_cleaned_filtered)
|
| 57 |
+
9. #### Tamil - [abhinand/tamil-alpaca](https://huggingface.co/datasets/abhinand/tamil-alpaca)
|
| 58 |
+
10. #### Kannada - [Tensoic/airoboros-3.2_kn](https://huggingface.co/datasets/Tensoic/airoboros-3.2_kn), [Tensoic/gpt-teacher_kn](https://huggingface.co/datasets/Tensoic/gpt-teacher_kn)
|
| 59 |
+
11. #### Malayalam - [VishnuPJ/Alpaca_Instruct_Malayalam](https://huggingface.co/datasets/VishnuPJ/Alpaca_Instruct_Malayalam)
|
| 60 |
+
12. #### Gujarati - [Tensoic/Alpaca-Gujarati](https://huggingface.co/datasets/Tensoic/Alpaca-Gujarati)
|
| 61 |
+
13. #### Punjabi - [HydraIndicLM/punjabi_alpaca_52K](https://huggingface.co/datasets/HydraIndicLM/punjabi_alpaca_52K)
|
| 62 |
+
14. #### Bengali - [HydraIndicLM/bengali_alpaca_dolly_67k](https://huggingface.co/datasets/HydraIndicLM/bengali_alpaca_dolly_67k)(alpaca filtered)
|
| 63 |
+
15. #### Odia - [OdiaGenAI/Odia_Alpaca_instructions_52k](https://huggingface.co/datasets/OdiaGenAI/Odia_Alpaca_instructions_52k), [OdiaGenAI/gpt-teacher-roleplay-odia-3k](https://huggingface.co/datasets/OdiaGenAI/gpt-teacher-roleplay-odia-3k)
|
| 64 |
+
16. #### English - [yahma/alpaca-cleaned](https://huggingface.co/datasets/yahma/alpaca-cleaned)
|
| 65 |
+
|
| 66 |
+
The model is finetuned using [unsloth](https://github.com/unslothai/unsloth) library and we provide inference code using the same for faster inference. Alternatively you can use HuggingFace Library for inference.
|
| 67 |
+
|
| 68 |
+
# Training Details:
|
| 69 |
+
|
| 70 |
+
The model is trained on approx 650K instruction samples.
|
| 71 |
+
1. GPU: 1 A100, 80GB
|
| 72 |
+
2. Time: 45 Hours
|
| 73 |
+
3. Platform: [E2E Networks](https://www.e2enetworks.com/)
|
| 74 |
+
# Installation
|
| 75 |
+
|
| 76 |
+
`!pip install -U xformers --index-url https://download.pytorch.org/whl/cu121`
|
| 77 |
+
`!pip install "unsloth[kaggle-new] @git+https://github.com/unslothai/unsloth.git@nightly"`
|
| 78 |
+
|
| 79 |
+
# Input Text Format
|
| 80 |
+
|
| 81 |
+
```
|
| 82 |
+
### Instruction: {instruction}
|
| 83 |
+
|
| 84 |
+
### Input: {input}
|
| 85 |
+
|
| 86 |
+
## Response: {response}
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
# Inference With Unsloth
|
| 90 |
+
|
| 91 |
+
```python3
|
| 92 |
+
from unsloth import FastLanguageModel
|
| 93 |
+
import torch
|
| 94 |
+
max_seq_length = 2048
|
| 95 |
+
dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+
|
| 96 |
+
load_in_4bit = False
|
| 97 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 98 |
+
model_name = "Telugu-LLM-Labs/Indic-gemma-2b-finetuned-sft-Navarasa-2.0",
|
| 99 |
+
max_seq_length = max_seq_length,
|
| 100 |
+
dtype = dtype,
|
| 101 |
+
load_in_4bit = load_in_4bit,
|
| 102 |
+
device_map="auto"
|
| 103 |
+
)
|
| 104 |
+
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
|
| 105 |
+
|
| 106 |
+
input_prompt = """
|
| 107 |
+
### Instruction:
|
| 108 |
+
{}
|
| 109 |
+
|
| 110 |
+
### Input:
|
| 111 |
+
{}
|
| 112 |
+
|
| 113 |
+
### Response:
|
| 114 |
+
{}"""
|
| 115 |
+
|
| 116 |
+
input_text = input_prompt.format(
|
| 117 |
+
"Tranlsate following sentence to Hindi.", # instruction
|
| 118 |
+
"India is a great country.", # input
|
| 119 |
+
"", # output - leave this blank for generation!
|
| 120 |
+
)
|
| 121 |
+
|
| 122 |
+
inputs = tokenizer([input_text], return_tensors = "pt").to("cuda")
|
| 123 |
+
|
| 124 |
+
outputs = model.generate(**inputs, max_new_tokens = 300, use_cache = True)
|
| 125 |
+
response = tokenizer.batch_decode(outputs)
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
# Inference with HuggingFace
|
| 129 |
+
|
| 130 |
+
```python3
|
| 131 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 132 |
+
import torch
|
| 133 |
+
|
| 134 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 135 |
+
"Telugu-LLM-Labs/Indic-gemma-2b-finetuned-sft-Navarasa-2.0",
|
| 136 |
+
load_in_4bit = False,
|
| 137 |
+
token = hf_token
|
| 138 |
+
)
|
| 139 |
+
model.to("cuda")
|
| 140 |
+
|
| 141 |
+
tokenizer = AutoTokenizer.from_pretrained("Telugu-LLM-Labs/Indic-gemma-2b-finetuned-sft-Navarasa-2.0")
|
| 142 |
+
|
| 143 |
+
input_prompt = """
|
| 144 |
+
### Instruction:
|
| 145 |
+
{}
|
| 146 |
+
|
| 147 |
+
### Input:
|
| 148 |
+
{}
|
| 149 |
+
|
| 150 |
+
### Response:
|
| 151 |
+
{}"""
|
| 152 |
+
|
| 153 |
+
input_text = input_prompt.format(
|
| 154 |
+
"Tranlsate following sentence to Hindi.", # instruction
|
| 155 |
+
"India is a great country.", # input
|
| 156 |
+
"", # output - leave this blank for generation!
|
| 157 |
+
)
|
| 158 |
+
|
| 159 |
+
inputs = tokenizer([input_text], return_tensors = "pt").to("cuda")
|
| 160 |
+
|
| 161 |
+
outputs = model.generate(**inputs, max_new_tokens = 300, use_cache = True)
|
| 162 |
+
response = tokenizer.batch_decode(outputs)[0]
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
Refer to the [blog post](https://ravidesetty.medium.com/introducing-navarasa-2-0-indic-gemma-7b-2b-instruction-tuned-model-on-15-indian-languages-31f6565b2750) for sample examples.
|
| 166 |
+
|
| 167 |
+
Please check our [Code Repository](https://github.com/TeluguLLMLabs/Indic-gemma-7b-Navarasa) for training and inference scripts.
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
# Developers:
|
| 171 |
+
|
| 172 |
+
The model is a collaborative effort by [Ravi Theja](https://twitter.com/ravithejads) and [Ramsri Goutham](https://twitter.com/ramsri_goutham). Feel free to DM either of us if you have any questions.
|
gitattributes
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|