Views
No views yet
[!IMPORTANT] This model is sensitive to the chat template used. Ensure you use the correct template:
<s>system
[System message]</s>
<s>user
[Your question or message]</s>
<s>assistant
[The model's response]</s><s>user
What is the capital of France?</s>
<s>assistant
The capital of France is Paris.</s>
<s>user
What is the capital of Spain?</s>
<s>assistant
The capital of Spain is Madrid, which is known for its beautiful architecture and rich history.</s><s>user
Who wrote the play "Romeo and Juliet"?</s>
<s>assistant
The play "Romeo and Juliet" was written by William Shakespeare.</s><s>system
You are a helpful assistant.</s>
<s>user
I'd like to learn about language models. Can you break down the concept for me?</s>
<s>assistant
Of course! Language models are computer programs designed to mimic human language, which is the way humans understand and interact with each other.
They use algorithms to analyze data and generate responses that are similar to how humans do on their own.</s>[Input for the model]
<s>user
Let's roleplay. I'll be a customer at a restaurant, and you be the waiter. Ready?</s>
<s>assistant
Certainly! I'll play the role of a waiter. Please go ahead and start the roleplay when you're ready.</s>
<s>user
Hello, I'd like to see the menu please.</s>
<s>assistant
Good evening, sir! Welcome to our restaurant. Here's our menu for today. May I recommend our chef's special, the grilled salmon with lemon butter sauce? Let me know if you have any questions about our dishes.</s>
<s>user
I'll have the salmon. What wines do you recommend to go with it?</s>
[Model's response]
<s> assistant
To go with your salmon, we suggest a pair of red-tailed or white-tailed jackfights. The grilled salmon is creamy and has a nice acidity. The lemon butter sauce is a great addition to this dish.</s>| Benchmark | 5-shot (acc) | 5-shot (acc_norm) | 0-shot (acc) | 0-shot (acc_norm) |
|---|---|---|---|---|
| ARC Easy | 47.26 | 46.30 | 45.58 | 39.52 |
| BoolQ | 43.33 | - | 44.16 | - |
| HellaSWAG | 28.70 | 30.73 | 28.72 | 31.01 |
| MMLU | - | - | 25.28 | - |
| OpenBookQA | 16.00 | 28.00 | 18.20 | 28.40 |
| PIQA | 62.79 | 62.68 | 62.02 | 60.23 |
| Winogrande | 51.30 | - | 51.78 | - |
transformers library:1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
5
6model = AutoModelForCausalLM.from_pretrained("OuteAI/Lite-Mistral-150M-v2-Instruct").to(device)
7tokenizer = AutoTokenizer.from_pretrained("OuteAI/Lite-Mistral-150M-v2-Instruct")
8
9def generate_response(message: str, temperature: float = 0.4, repetition_penalty: float = 1.1) -> str:
10 # Apply the chat template and convert to PyTorch tensors
11 messages = [
12 {"role": "system", "content": "You are a helpful assistant."},
13 {"role": "user", "content": message}
14 ]
15 input_ids = tokenizer.apply_chat_template(
16 messages, add_generation_prompt=True, return_tensors="pt"
17 ).to(device)
18
19 # Generate the response
20 output = model.generate(
21 input_ids,
22 max_length=512,
23 temperature=temperature,
24 repetition_penalty=repetition_penalty,
25 do_sample=True
26 )
27
28 # Decode the generated output
29 generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
30 return generated_text
31
32message = "I'd like to learn about language models. Can you break down the concept for me?"
33response = generate_response(message)
34print(response)