abhinand commited on
Commit
b49908f
1 Parent(s): 46ceb00

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +124 -138
README.md CHANGED
@@ -1,165 +1,151 @@
1
  ---
2
- library_name: peft
3
- tags:
4
- - axolotl
5
- - generated_from_trainer
6
  base_model: abhinand/dr-llama-te-instruct-v0
7
  model-index:
8
- - name: dr-llama-te-instruct-v0-lora-ext
9
  results: []
 
 
 
 
10
  ---
11
 
12
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
13
- should probably proofread and complete it, then remove this comment. -->
14
 
15
- [<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)
16
- <details><summary>See axolotl config</summary>
17
 
18
- axolotl version: `0.3.0`
19
- ```yaml
20
- base_model: abhinand/dr-llama-te-instruct-v0
21
- model_type: AutoModelForCausalLM
22
- tokenizer_type: AutoTokenizer
23
- trust_remote_code: true
24
- is_llama_derived_model: true
25
-
26
- # huggingface repo
27
- datasets:
28
- - path: abhinand/telugu_llama_instruct
29
- name: regional_sharegpt_gs8
30
- type: sharegpt.load_role
31
- conversation: chatml
32
- train_on_split: train
33
-
34
- - path: abhinand/detox-dpo-te
35
- name: sharegpt_gs8
36
- type: sharegpt.load_role
37
- conversation: chatml
38
- train_on_split: train
39
-
40
- load_in_4bit: false
41
- load_in_8bit: false
42
- bf16: true # require >=ampere
43
- chat_template: chatml
44
-
45
- dataset_prepared_path: last_run_prepared_path
46
- hub_model_id: abhinand/dr-llama-te-instruct-v0-lora-ext
47
- group_by_length: false
48
-
49
- val_set_size: 0.0
50
- sequence_len: 4096
51
- sample_packing: true
52
- pad_to_sequence_len: true
53
-
54
- adapter: lora
55
- lora_model_dir:
56
- lora_r: 64
57
- lora_alpha: 128
58
- lora_target_modules:
59
- - q_proj
60
- - v_proj
61
- - k_proj
62
- - o_proj
63
- - gate_proj
64
- - down_proj
65
- - up_proj
66
- lora_modules_to_save:
67
- - embed_tokens
68
- - lm_head
69
- lora_dropout: 0.1
70
- lora_target_linear: true
71
- lora_fan_in_fan_out:
72
-
73
- output_dir: /home/dev/axolotl/saved_models/telugu-instruct-extended
74
-
75
- gradient_accumulation_steps: 8
76
- micro_batch_size: 4
77
- eval_batch_size: 4
78
- num_epochs: 1
79
- logging_steps: 1
80
- save_steps: 10
81
- save_total_limit: 3
82
-
83
- save_safetensors: false
84
- gradient_checkpointing: true
85
-
86
- lr_scheduler: cosine
87
- optimizer: "adamw_bnb_8bit"
88
- adam_beta2: 0.95
89
- adam_epsilon: 0.00001
90
- weight_decay: 0.1
91
- learning_rate: 0.0005
92
- max_grad_norm: 1.0
93
- warmup_ratio: 0.05
94
- # warmup_steps: 10
95
-
96
- flash_attention: true
97
-
98
- # Resume from a specific checkpoint dir
99
- resume_from_checkpoint:
100
- # If resume_from_checkpoint isn't set and you simply want it to start where it left off.
101
- # Be careful with this being turned on between different models.
102
- # auto_resume_from_checkpoints: true
103
-
104
- # wandb configuration if you're using it
105
- # Make sure your `WANDB_API_KEY` environment variable is set (recommended) or you login to wandb with `wandb login`.
106
- wandb_mode: # "offline" to save run metadata locally and not sync to the server, "disabled" to turn off wandb
107
- wandb_project: "telugu-llama-sft"
108
- wandb_name:
109
- wandb_run_id:
110
-
111
- special_tokens:
112
- bos_token: "<s>"
113
- eos_token: "</s>"
114
- unk_token: "<unk>"
115
- tokens: # these are delimiters
116
- - "<|im_start|>"
117
- - "<|im_end|>"
118
 
 
 
 
 
 
 
 
 
119
  ```
120
 
121
- </details><br>
122
 
123
- # dr-llama-te-instruct-v0-lora-ext
124
 
125
- This model is a fine-tuned version of [abhinand/dr-llama-te-instruct-v0](https://huggingface.co/abhinand/dr-llama-te-instruct-v0) on the None dataset.
126
 
127
- ## Model description
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
 
129
- More information needed
 
 
 
 
 
 
 
130
 
131
- ## Intended uses & limitations
132
 
133
- More information needed
134
 
135
- ## Training and evaluation data
136
 
137
- More information needed
 
 
 
 
 
 
 
 
 
138
 
139
- ## Training procedure
 
140
 
141
- ### Training hyperparameters
142
 
143
- The following hyperparameters were used during training:
144
- - learning_rate: 0.0005
145
- - train_batch_size: 4
146
- - eval_batch_size: 4
147
- - seed: 42
148
- - gradient_accumulation_steps: 8
149
- - total_train_batch_size: 32
150
- - optimizer: Adam with betas=(0.9,0.95) and epsilon=1e-05
151
- - lr_scheduler_type: cosine
152
- - lr_scheduler_warmup_steps: 3
153
- - num_epochs: 1
154
 
155
- ### Training results
156
 
 
 
 
 
157
 
 
 
158
 
159
- ### Framework versions
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
 
161
- - PEFT 0.7.0
162
- - Transformers 4.37.0.dev0
163
- - Pytorch 2.0.1+cu117
164
- - Datasets 2.16.1
165
- - Tokenizers 0.15.0
 
1
  ---
 
 
 
 
2
  base_model: abhinand/dr-llama-te-instruct-v0
3
  model-index:
4
+ - name: telugu-llama-instruct-v0.1
5
  results: []
6
+ license: gpl-3.0
7
+ language:
8
+ - en
9
+ - te
10
  ---
11
 
12
+ # Telugu LLaMA 7B Instruct v0.1
 
13
 
14
+ Welcome to the inaugural release of the Telugu LLaMA 7B instruct model – an important step in advancing LLMs for the Telugu 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
+ ## Model description
21
+
22
+ The Telugu LLaMA models have been enhanced and tailored specifically with an extensive Telugu vocabulary of ~16,000 tokens, building upon the foundation set by the original LLaMA-2.
23
+
24
+ - **Model type:** A 7B parameter GPT-like model finetuned on ~500,000 samples consisting of an equal proportion of English and Telugu samples.
25
+ - **Language(s):** Bilingual. English and Telugu.
26
+ - **License:** GNU General Public License v3.0
27
+ - **Finetuned from model:** [To be released soon]()
28
+ - **Training Precision:** `bfloat16`
29
+ - **Code:** [GitHub](https://github.com/abhinand5/tamil-llama) (To be updated soon)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
+ ## Prompt Template: ChatML
32
+
33
+ ```
34
+ <|im_start|>system
35
+ {system_message}<|im_end|>
36
+ <|im_start|>user
37
+ {prompt}<|im_end|>
38
+ <|im_start|>assistant
39
  ```
40
 
41
+ ## Benchmark Results
42
 
43
+ Benchmarking was done using [LLM-Autoeval](https://github.com/mlabonne/llm-autoeval) on an RTX 3090 on [runpod](https://www.runpod.io/).
44
 
45
+ ![Benchmark results](https://cdn-uploads.huggingface.co/production/uploads/60c8619d95d852a24572b025/P_0y9pvGg2Gn1Uz7SSJ7E.png)
46
 
47
+ ## Related Models
48
+
49
+ | Model | Type | Data | Base Model | # Params | Download Links |
50
+ |--------------------------|-----------------------------|-------------------|----------------------|------|------------------------------------------------------------------------|
51
+ | Tamil LLaMA 7B v0.1 Base | Base model | 12GB | LLaMA 7B | 7B | [HF Hub](https://huggingface.co/abhinand/tamil-llama-7b-base-v0.1) |
52
+ | Tamil LLaMA 13B v0.1 Base | Base model | 4GB | LLaMA 13B | 13B | [HF Hub](https://huggingface.co/abhinand/tamil-llama-13b-base-v0.1) |
53
+ | 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) |
54
+ | Tamil LLaMA 13B v0.1 Instruct | Instruction following model | 145k instructions | Tamil LLaMA 13B Base | 13B | [HF Hub](abhinand/tamil-llama-13b-instruct-v0.1) |
55
+ | Tamil LLaMA 7B v0.2 Instruct | Instruction/Chat model | 500k instructions | Tamil LLaMA 7B Base v0.2 | 7B | [HF Hub](abhinand/tamil-llama-13b-instruct-v0.1) |
56
+ | Malayalam LLaMA 7B v0.2 Instruct | Instruction/Chat model | 500k instructions | Malayalam LLaMA 7B Base v0.1 | 7B | [HF Hub](abhinand/tamil-llama-13b-instruct-v0.1) |
57
+
58
+ ## Example Usage
59
+
60
+ ```python
61
+ from transformers import LlamaForCausalLM, AutoTokenizer, pipeline
62
 
63
+ model = LlamaForCausalLM.from_pretrained(
64
+ "abhinand/telugu-llama-instruct-v0.1",
65
+ #load_in_8bit=True, # Set this depending on the GPU you have
66
+ torch_dtype=torch.bfloat16,
67
+ device_map={"": 0}, # Set this depending on the number of GPUs you have
68
+ local_files_only=False # Optional
69
+ )
70
+ model.eval()
71
 
72
+ tokenizer = AutoTokenizer.from_pretrained("abhinand/telugu-llama-instruct-v0.1")
73
 
74
+ inf_pipeline = pipeline("conversational", model=model, tokenizer=tokenizer)
75
 
 
76
 
77
+ def format_instruction(system_prompt, question, return_dict=False):
78
+ if system_prompt is None:
79
+ messages = [
80
+ {'content': question, 'role': 'user'},
81
+ ]
82
+ else:
83
+ messages = [
84
+ {'content': system_prompt, 'role': 'system'},
85
+ {'content': question, 'role': 'user'},
86
+ ]
87
 
88
+ if return_dict:
89
+ return messages
90
 
91
+ prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
92
 
93
+ return prompt
 
 
 
 
 
 
 
 
 
 
94
 
 
95
 
96
+ # Set the generation configuration according to your needs
97
+ temperature = 0.6
98
+ repetition_penalty = 1.1
99
+ max_new_tokens = 256
100
 
101
+ SYSTEM_PROMPT = "You are an AI assistant who follows instructions extremely well. Do your best your best to help."
102
+ INPUT = "Who were the Nizams of Hyderabad?"
103
 
104
+ instruction = format_instruction(
105
+ system_prompt=SYSTEM_PROMPT,
106
+ question=INPUT,
107
+ return_dict=True,
108
+ )
109
+
110
+ output = inf_pipeline(
111
+ instruction,
112
+ temperature=temperature,
113
+ max_new_tokens=max_new_tokens,
114
+ repetition_penalty=repetition_penalty
115
+ )
116
+ print(output)
117
+
118
+ # =========== EXAMPLE OUTPUT ===========
119
+ # Conversation id: d57cdf33-01ff-4328-8efe-5c4fefdd6e77
120
+ # system: You are an AI assistant who follows instructions extremely well. Do your best your best to help.
121
+ # user: Who were the Nizams of Hyderabad?
122
+ # assistant: The Nizams of Hyderabad were a dynasty that ruled the Deccan Plateau in southern India, including the city of Hyderabad. They were known for their wealth and patronage of art and culture. The last Nizam, Mir Osman Ali Khan, was one of the richest people in the world at the time of his death in 1967.
123
+ # ======================================
124
+ ```
125
+
126
+ ## Usage Note
127
+
128
+ It's important to note that the models have not undergone detoxification. 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.
129
+
130
+ ## Meet the Developers
131
+
132
+ Get to know the creators behind this innovative model and follow their contributions to the field:
133
+
134
+ - [Abhinand Balachandran](https://www.linkedin.com/in/abhinand-05/)
135
+
136
+ ## Citation
137
+
138
+ If you use this model or any of the the Tamil-Llama related work in your research, please cite:
139
+
140
+ ```bibtex
141
+ @misc{balachandran2023tamilllama,
142
+ title={Tamil-Llama: A New Tamil Language Model Based on Llama 2},
143
+ author={Abhinand Balachandran},
144
+ year={2023},
145
+ eprint={2311.05845},
146
+ archivePrefix={arXiv},
147
+ primaryClass={cs.CL}
148
+ }
149
+ ```
150
 
151
+ 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.