abhinand commited on
Commit
7acdc04
1 Parent(s): c2d9a1b

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +202 -0
README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: abhinand/dr-llama-ta-instruct-v0
3
+ model-index:
4
+ - name: tamil-llama-instruct-v0.2
5
+ results: []
6
+ license: gpl-3.0
7
+ language:
8
+ - en
9
+ - ta
10
+ ---
11
+
12
+ # Tamil LLaMA 7B Instruct v0.2 [GGUF Quantized]
13
+
14
+ Welcome to the inaugural release of the Tamil LLaMA 7B instruct model – an important step in advancing LLMs for the Tamil language. This model is ready for immediate inference and is also primed for further fine-tuning to cater to your specific NLP tasks.
15
+
16
+ To dive deep into the development and capabilities of this model, please read the [research paper](https://arxiv.org/abs/2311.05845) and the [introductory blog post (WIP)]() that outlines our journey and the model's potential impact.
17
+
18
+ > **Note:** This model is based on the Tamil LLaMA series of models. The GitHub repository remains the same - [https://github.com/abhinand5/tamil-llama](https://github.com/abhinand5/tamil-llama). The base models and the updated code for Tamil LLaMA v0.2 (which this work is based on) will be released soon.
19
+
20
+ If you appreciate this work and would like to support its continued development, consider [buying me a coffee](https://www.buymeacoffee.com/abhinand.b). Your support is invaluable and greatly appreciated.
21
+
22
+ [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/abhinand.b)
23
+
24
+ ## Demo:
25
+
26
+ To access an easy-to-use, no-code demo, please open the provided Google Colab notebook. Complete instructions for usage are included within the notebook itself.
27
+
28
+ <a href="https://colab.research.google.com/drive/11_RHZim_HubD2NskxSwq4X_NW4XlnrtS?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Demo In Colab"></a></center>
29
+
30
+ ## Model description
31
+
32
+ The Tamil LLaMA models have been enhanced and tailored specifically with an extensive Tamil vocabulary of ~16,000 tokens, building upon the foundation set by the original LLaMA-2.
33
+
34
+ - **Model type:** A 7B parameter GPT-like model finetuned on ~500,000 samples consisting of an equal proportion of English and Tamil samples. (Dataset will be released soon)
35
+ - **Language(s):** Bilingual. English and Tamil.
36
+ - **License:** GNU General Public License v3.0
37
+ - **Finetuned from model:** [To be released soon]()
38
+ - **Training Precision:** `bfloat16`
39
+ - **Code:** [GitHub](https://github.com/abhinand5/tamil-llama) (To be updated soon)
40
+
41
+ ## Quantization Info
42
+
43
+ This repo contains GGUF format model files for [Tamil LLaMA 7B Instruct v0.2](https://huggingface.co/abhinand/tamil-llama-7b-instruct-v0.2).
44
+
45
+ ### About GGUF
46
+
47
+ GGUF is a new format introduced by the llama.cpp team on August 21st 2023. It is a replacement for GGML, which is no longer supported by llama.cpp. GGUF offers numerous advantages over GGML, such as better tokenisation, and support for special tokens. It is also supports metadata, and is designed to be extensible.
48
+
49
+ Here is an incomplate list of clients and libraries that are known to support GGUF:
50
+
51
+ * [llama.cpp](https://github.com/ggerganov/llama.cpp). The source project for GGUF. Offers a CLI and a server option.
52
+ * [text-generation-webui](https://github.com/oobabooga/text-generation-webui), the most widely used web UI, with many features and powerful extensions. Supports GPU acceleration.
53
+ * [KoboldCpp](https://github.com/LostRuins/koboldcpp), a fully featured web UI, with GPU accel across all platforms and GPU architectures. Especially good for story telling.
54
+ * [LM Studio](https://lmstudio.ai/), an easy-to-use and powerful local GUI for Windows and macOS (Silicon), with GPU acceleration.
55
+ * [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui), a great web UI with many interesting and unique features, including a full model library for easy model selection.
56
+ * [Faraday.dev](https://faraday.dev/), an attractive and easy to use character-based chat GUI for Windows and macOS (both Silicon and Intel), with GPU acceleration.
57
+ * [ctransformers](https://github.com/marella/ctransformers), a Python library with GPU accel, LangChain support, and OpenAI-compatible AI server.
58
+ * [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), a Python library with GPU accel, LangChain support, and OpenAI-compatible API server.
59
+ * [candle](https://github.com/huggingface/candle), a Rust ML framework with a focus on performance, including GPU support, and ease of use.
60
+
61
+ ### Provided files
62
+
63
+ | Name | Quant method | Bits | Size | Max RAM required | Use case |
64
+ |------------------------------------------------------------------------------------------------------------------------------------------------|--------------|------|---------|------------------|----------------------------------------------------------|
65
+ | [tamil-llama-7b-instruct-v0.2.Q4_K_M.gguf](https://huggingface.co/abhinand/tamil-llama-7b-instruct-v0.2-GGUF/blob/main/tamil-llama-7b-instruct-v0.2.Q4_K_M.gguf) | Q4_K_M | 4 | 4.18 GB | 6.8 GB | medium, balanced quality - recommended |
66
+ | [tamil-llama-7b-instruct-v0.2.Q5_K_M.gguf](https://huggingface.co/abhinand/tamil-llama-7b-instruct-v0.2-GGUF/blob/main/tamil-llama-7b-instruct-v0.2.Q5_K_M.gguf) | Q5_K_M | 5 | 4.89 GB | 7.5 GB | large, very low quality loss - recommended |
67
+
68
+
69
+ ## Prompt Template: ChatML
70
+
71
+ ```
72
+ <|im_start|>system
73
+ {system_message}<|im_end|>
74
+ <|im_start|>user
75
+ {prompt}<|im_end|>
76
+ <|im_start|>assistant
77
+ ```
78
+
79
+ ## Benchmark Results
80
+
81
+ Benchmarking was done using [LLM-Autoeval](https://github.com/mlabonne/llm-autoeval) on an RTX 3090 on [runpod](https://www.runpod.io/).
82
+
83
+ > **Note:** Please note that discrepancies have been observed between the Open LLM Leaderboard scores and those obtained from local runs using the LM Eval Harness with identical configurations. The results mentioned here are based on our own benchmarking. To replicate these findings, you can utilize the LLM-Autoeval or use [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness) locally with the configurations described in Open LLM Leaderboard's About page.
84
+
85
+ | Benchmark | Llama 2 Chat | Tamil Llama v0.2 Instruct | Telugu Llama Instruct | Malayalam Llama Instruct |
86
+ |---------------|--------------|---------------------------|-----------------------|--------------------------|
87
+ | ARC Challenge (25-shot) | 52.9 | **53.75** | 52.47 | 52.82 |
88
+ | TruthfulQA (0-shot) | 45.57 | 47.23 | **48.47** | 47.46 |
89
+ | Hellaswag (10-shot) | **78.55** | 76.11 | 76.13 | 76.91 |
90
+ | Winogrande (5-shot) | 71.74 | **73.95** | 71.74 | 73.16 |
91
+ | AGI Eval (0-shot) | 29.3 | **30.95** | 28.44 | 29.6 |
92
+ | BigBench (0-shot) | 32.6 | 33.08 | 32.99 | **33.26** |
93
+ | Average | 51.78 | **52.51** | 51.71 | 52.2 |
94
+
95
+
96
+ ## Related Models
97
+
98
+ | Model | Type | Data | Base Model | # Params | Download Links |
99
+ |--------------------------|-----------------------------|-------------------|----------------------|------|------------------------------------------------------------------------|
100
+ | Tamil LLaMA 7B v0.1 Base | Base model | 12GB | LLaMA 7B | 7B | [HF Hub](https://huggingface.co/abhinand/tamil-llama-7b-base-v0.1) |
101
+ | Tamil LLaMA 13B v0.1 Base | Base model | 4GB | LLaMA 13B | 13B | [HF Hub](https://huggingface.co/abhinand/tamil-llama-13b-base-v0.1) |
102
+ | Tamil LLaMA 7B v0.1 Instruct | Instruction following model | 145k instructions | Tamil LLaMA 7B Base | 7B | [HF Hub](https://huggingface.co/abhinand/tamil-llama-7b-instruct-v0.1) |
103
+ | Tamil LLaMA 13B v0.1 Instruct | Instruction following model | 145k instructions | Tamil LLaMA 13B Base | 13B | [HF Hub](https://huggingface.co/abhinand/tamil-llama-13b-instruct-v0.1) |
104
+ | Telugu LLaMA 7B v0.1 Instruct | Instruction/Chat model | 420k instructions | Telugu LLaMA 7B Base v0.1 | 7B | [HF Hub](https://huggingface.co/abhinand/telugu-llama-instruct-v0.1) |
105
+ | Malayalam LLaMA 7B v0.2 Instruct | Instruction/Chat model | 420k instructions | Malayalam LLaMA 7B Base v0.1 | 7B | [HF Hub](https://huggingface.co/abhinand/malayalam-llama-instruct-v0.1) |
106
+
107
+ ## Example Usage
108
+
109
+ ```python
110
+ from transformers import LlamaForCausalLM, AutoTokenizer, pipeline
111
+
112
+ model = LlamaForCausalLM.from_pretrained(
113
+ "abhinand/tamil-llama-instruct-v0.2",
114
+ #load_in_8bit=True, # Set this depending on the GPU you have
115
+ torch_dtype=torch.bfloat16,
116
+ device_map={"": 0}, # Set this depending on the number of GPUs you have
117
+ local_files_only=False # Optional
118
+ )
119
+ model.eval()
120
+
121
+ tokenizer = AutoTokenizer.from_pretrained("abhinand/tamil-llama-instruct-v0.2")
122
+
123
+ inf_pipeline = pipeline("conversational", model=model, tokenizer=tokenizer)
124
+
125
+
126
+ def format_instruction(system_prompt, question, return_dict=False):
127
+ if system_prompt is None:
128
+ messages = [
129
+ {'content': question, 'role': 'user'},
130
+ ]
131
+ else:
132
+ messages = [
133
+ {'content': system_prompt, 'role': 'system'},
134
+ {'content': question, 'role': 'user'},
135
+ ]
136
+
137
+ if return_dict:
138
+ return messages
139
+
140
+ prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
141
+
142
+ return prompt
143
+
144
+
145
+ # Set the generation configuration according to your needs
146
+ temperature = 0.6
147
+ repetition_penalty = 1.1
148
+ max_new_tokens = 256
149
+
150
+ SYSTEM_PROMPT = "You are an AI assistant who follows instructions extremely well. Do your best your best to help."
151
+ INPUT = "Can you explain the significance of Tamil festival Pongal?"
152
+
153
+ instruction = format_instruction(
154
+ system_prompt=SYSTEM_PROMPT,
155
+ question=INPUT,
156
+ return_dict=True,
157
+ )
158
+
159
+ output = inf_pipeline(
160
+ instruction,
161
+ temperature=temperature,
162
+ max_new_tokens=max_new_tokens,
163
+ repetition_penalty=repetition_penalty
164
+ )
165
+ print(output)
166
+ ```
167
+
168
+ **Example Output:**
169
+
170
+ ```
171
+ Conversation id: d57cdf33-01ff-4328-8efe-5c4fefdd6e77
172
+ system: You are an AI assistant who follows instructions extremely well. Do your best your best to help.
173
+ user: Can you explain the significance of Tamil festival Pongal?
174
+ assistant: Pongal is a significant harvest festival celebrated in Tamil Nadu and other parts of southern India. It marks the end of the rainy season and beginning of the agricultural year. The festival primarily revolves around giving gratitude to nature, particularly the Sun God Surya for his bountiful gifts like agriculture and health. People offer prayers to cattle, which play a significant role in agriculture, as well as their families for their continued support during the harvest season. The festival is marked by various colorful events, including preparing traditional Pongal dishes like rice cooked with milk, sugarcane, and banana, followed by exchanging gifts and celebrating among family members and friends. It also serves as a time for unity and strengthens the bond between people in their communities.
175
+ ```
176
+
177
+ ## Usage Note
178
+
179
+ It's important to note that the models have not undergone detoxification/censorship. Therefore, while they possess impressive linguistic capabilities, there is a possibility for them to generate content that could be deemed harmful or offensive. We urge users to exercise discretion and supervise the model's outputs closely, especially in public or sensitive applications.
180
+
181
+ ## Meet the Developers
182
+
183
+ Get to know the creators behind this innovative model and follow their contributions to the field:
184
+
185
+ - [Abhinand Balachandran](https://www.linkedin.com/in/abhinand-05/)
186
+
187
+ ## Citation
188
+
189
+ If you use this model or any of the the Tamil-Llama related work in your research, please cite:
190
+
191
+ ```bibtex
192
+ @misc{balachandran2023tamilllama,
193
+ title={Tamil-Llama: A New Tamil Language Model Based on Llama 2},
194
+ author={Abhinand Balachandran},
195
+ year={2023},
196
+ eprint={2311.05845},
197
+ archivePrefix={arXiv},
198
+ primaryClass={cs.CL}
199
+ }
200
+ ```
201
+
202
+ We hope this model serves as a valuable tool in your NLP toolkit and look forward to seeing the advancements it will enable in the understanding and generation of the Tamil language.