Views
No views yet

| Parameter | Value |
|---|---|
| direction_index | 37.86 |
| attn.o_proj.max_weight | 1.27 |
| attn.o_proj.max_weight_position | 64.44 |
| attn.o_proj.min_weight | 1.26 |
| attn.o_proj.min_weight_distance | 47.53 |
| mlp.down_proj.max_weight | 1.44 |
| mlp.down_proj.max_weight_position | 61.73 |
| mlp.down_proj.min_weight | 1.38 |
| mlp.down_proj.min_weight_distance | 46.10 |
| Metric | This model | Original model (mistralai/Mistral-Large-Instruct-2411) |
|---|---|---|
| KL divergence | 0.0578 | 0 (by definition) |
| Refusals | 2/100 | 87/100 |
<s>[SYSTEM_PROMPT] <system prompt>[/SYSTEM_PROMPT][INST] <user message>[/INST] <assistant response></s>[INST] <user message>[/INST]vLLM >= v0.6.4.post1:pip install --upgrade vllmmistral_common >= 1.5.0 installed:pip install --upgrade mistral_commonvllm serve mistralai/Mistral-Large-Instruct-2411 --tokenizer_mode mistral --config_format mistral --load_format mistral --tensor_parallel_size 81import requests
2import json
3from huggingface_hub import hf_hub_download
4from datetime import datetime, timedelta
5
6url = "http://<your-server>:8000/v1/chat/completions"
7headers = {"Content-Type": "application/json", "Authorization": "Bearer token"}
8
9model = "mistralai/Mistral-Large-Instruct-2411"
10
11
12def load_system_prompt(repo_id: str, filename: str) -> str:
13 file_path = hf_hub_download(repo_id=repo_id, filename=filename)
14 with open(file_path, "r") as file:
15 system_prompt = file.read()
16 today = datetime.today().strftime("%Y-%m-%d")
17 yesterday = (datetime.today() - timedelta(days=1)).strftime("%Y-%m-%d")
18 model_name = repo_id.split("/")[-1]
19 return system_prompt.format(name=model_name, today=today, yesterday=yesterday)
20
21
22SYSTEM_PROMPT = load_system_prompt(model, "SYSTEM_PROMPT.txt")
23
24
25messages = [
26 {"role": "system", "content": SYSTEM_PROMPT + "\n\nThink step by step. You're a math genius."},
27 {
28 "role": "user",
29 "content": "Think of four random numbers. Then add, substract or multiply them so that the solution is 10. If it's not possible, say it."
30 },
31]
32
33data = {"model": model, "messages": messages}
34
35response = requests.post(url, headers=headers, data=json.dumps(data))
36print(response.json()["choices"][0]["message"]["content"])
37# Sure, let's start by thinking of four random numbers. For example, let's take 3, 5, 2, and 1.
38#
39# Now, we need to find a combination of addition, subtraction, or multiplication that results in 10.
40
41# Let's try:
42
43# \[ 3 + 5 + 2 - 1 = 9 \]
44
45# This doesn't work. Let's try another combination:
46
47# \[ 3 \times 2 + 5 - 1 = 6 + 5 - 1 = 10 \]
48
49# This works! So, with the numbers 3, 5, 2, and 1, we can achieve the result 10 by performing the operations \( 3 \times 2 + 5 - 1 \).1from vllm import LLM
2from vllm.sampling_params import SamplingParams
3from huggingface_hub import hf_hub_download
4from datetime import datetime, timedelta
5
6model_name = "mistralai/Mistral-Large-Instruct-2411"
7
8def load_system_prompt(repo_id: str, filename: str) -> str:
9 file_path = hf_hub_download(repo_id=repo_id, filename=filename)
10 with open(file_path, 'r') as file:
11 system_prompt = file.read()
12 today = datetime.today().strftime('%Y-%m-%d')
13 yesterday = (datetime.today() - timedelta(days=1)).strftime('%Y-%m-%d')
14 model_name = repo_id.split("/")[-1]
15 return system_prompt.format(name=model_name, today=today, yesterday=yesterday)
16
17
18SYSTEM_PROMPT = load_system_prompt(model_name, "SYSTEM_PROMPT.txt") + "\n\nThink step by step. You're a math genius."
19
20user_prompt = "Without browsing the web, how many days ago was Mistral founded?"
21
22messages = [
23 {
24 "role": "system",
25 "content": SYSTEM_PROMPT
26 },
27 {
28 "role": "user",
29 "content": user_prompt
30 },
31]
32
33# note that running this model on GPU requires over 300 GB of GPU RAM
34llm = LLM(model=model_name, tokenizer_mode="mistral", tensor_parallel_size=8)
35
36sampling_params = SamplingParams(max_tokens=512)
37
38outputs = llm.chat(messages, sampling_params=sampling_params)
39
40print(outputs[0].outputs[0].text)
41# I don't have real-time web browsing capabilities or access to current data, but I can help you calculate the number of days based on the information I have.
42#
43#Mistral AI was founded in April 2023. To determine how many days ago that was from today's date, November 18, 2024, we need to calculate the total number of days between April 2023 and November 2024.
44#
45#Here's the step-by-step calculation:
46#
47#1. **Days from April 2023 to December 2023:**
48# - April 2023: 30 days (April has 30 days)
49# - May 2023: 31 days
50# - June 2023: 30 days
51# - July 2023: 31 days
52# - August 2023: 31 days
53# - September 2023: 30 days
54# - October 2023: 31 days
55# - November 2023: 30 days
56# - December 2023: 31 days
57#
58# Total days in 2023 from April to December = 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31 = 275 days
59#
60#2. **Days from January 2024 to November 18, 2024:**
61# - January 2024: 31 days
62# - February 2024: 29 days (2024 is a leap year)
63# - March 2024: 31 days
64# - April 2024: 30 days
65# - May 2024: 31 days
66# - June 2024: 30 days
67# - July 2024: 31 days
68# - August 2024: 31 days
69# - September 2024: 30 days
70# - October 2024: 31 days
71# - November 2024 (up to the 18th): 18 days
72#
73# Total days in 2024 from January to November 18 = 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 18 = 323 days
74#
75#3. **Total days from April 2023 to November 18, 2024:**
76# Total days = 275 days (2023) + 323 days (2024) = 598 days
77#
78#Therefore, Mistral AI was founded 598 days ago from today's date, November 18, 2024.mistral_common >= 1.5.0 and vLLM >= v0.6.4.post1.vllm serve mistralai/Pixtral-Large-Instruct-2411 --tokenizer_mode mistral --config_format mistral --load_format mistral --tensor-parallel-size 8 --tool-call-parser mistral --enable-auto-tool-choice1import requests
2import json
3from huggingface_hub import hf_hub_download
4from datetime import datetime, timedelta
5
6url = "http://<your-server>:8000/v1/chat/completions"
7headers = {"Content-Type": "application/json", "Authorization": "Bearer token"}
8
9model = "mistralai/Mistral-Large-Instruct-2411"
10
11
12def load_system_prompt(repo_id: str, filename: str) -> str:
13 file_path = hf_hub_download(repo_id=repo_id, filename=filename)
14 with open(file_path, "r") as file:
15 system_prompt = file.read()
16 today = datetime.today().strftime("%Y-%m-%d")
17 yesterday = (datetime.today() - timedelta(days=1)).strftime("%Y-%m-%d")
18 model_name = repo_id.split("/")[-1]
19 return system_prompt.format(name=model_name, today=today, yesterday=yesterday)
20
21
22SYSTEM_PROMPT = load_system_prompt(model, "SYSTEM_PROMPT.txt")
23
24
25tools = [
26 {
27 "type": "function",
28 "function": {
29 "name": "get_current_weather",
30 "description": "Get the current weather in a given location",
31 "parameters": {
32 "type": "object",
33 "properties": {
34 "city": {
35 "type": "string",
36 "description": "The city to find the weather for, e.g. 'San Francisco'",
37 },
38 "state": {
39 "type": "string",
40 "description": "The state abbreviation, e.g. 'CA' for California",
41 },
42 "unit": {
43 "type": "string",
44 "description": "The unit for temperature",
45 "enum": ["celsius", "fahrenheit"],
46 },
47 },
48 "required": ["city", "state", "unit"],
49 },
50 },
51 },
52 {
53 "type": "function",
54 "function": {
55 "name": "rewrite",
56 "description": "Rewrite a given text for improved clarity",
57 "parameters": {
58 "type": "object",
59 "properties": {
60 "text": {
61 "type": "string",
62 "description": "The input text to rewrite",
63 }
64 },
65 },
66 },
67 },
68]
69
70messages = [
71 {"role": "system", "content": SYSTEM_PROMPT},
72 {
73 "role": "user",
74 "content": "Could you please make the below article more concise?\n\nOpenAI is an artificial intelligence research laboratory consisting of the non-profit OpenAI Incorporated and its for-profit subsidiary corporation OpenAI Limited Partnership.",
75 },
76 {
77 "role": "assistant",
78 "content": "",
79 "tool_calls": [
80 {
81 "id": "bbc5b7ede",
82 "type": "function",
83 "function": {
84 "name": "rewrite",
85 "arguments": '{"text": "OpenAI is an artificial intelligence research laboratory consisting of the non-profit OpenAI Incorporated and its for-profit subsidiary corporation OpenAI Limited Partnership."}',
86 },
87 }
88 ],
89 },
90 {
91 "role": "tool",
92 "content": '{"action":"rewrite","outcome":"OpenAI is a FOR-profit company."}',
93 "tool_call_id": "bbc5b7ede",
94 "name": "rewrite",
95 },
96 {
97 "role": "assistant",
98 "content": "---\n\nOpenAI is a FOR-profit company.",
99 },
100 {
101 "role": "user",
102 "content": "Can you tell me what the temperature will be in Dallas, in Fahrenheit?",
103 },
104]
105
106data = {"model": model, "messages": messages, "tools": tools}
107
108response = requests.post(url, headers=headers, data=json.dumps(data))
109print(response.json()["choices"][0]["message"]["tool_calls"])
110# [{'id': '8PdihwL6d', 'type': 'function', 'function': {'name': 'get_current_weather', 'arguments': '{"city": "Dallas", "state": "TX", "unit": "fahrenheit"}'}}]