Update README.md
Browse files
README.md
CHANGED
@@ -104,76 +104,6 @@ Benchmarking was done using [LLM-Autoeval](https://github.com/mlabonne/llm-autoe
|
|
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.
|
|
|
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 |
## Usage Note
|
108 |
|
109 |
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.
|