jonatannietoa commited on
Commit
3c0941a
·
verified ·
1 Parent(s): 7dc32f6

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,18 +1,12 @@
1
  ---
2
  library_name: mlx
3
  license: apache-2.0
 
 
 
4
  tags:
5
- - finetuned
6
  - mistral-common
7
  - mlx
8
- new_version: mistralai/Mistral-7B-Instruct-v0.3
9
- inference: false
10
- widget:
11
- - messages:
12
- - role: user
13
- content: What is your favorite condiment?
14
- extra_gated_description: If you want to learn more about how we process your personal
15
- data, please read our <a href="https://mistral.ai/terms/">Privacy Policy</a>.
16
  pipeline_tag: text-generation
17
- base_model: mistralai/Mistral-7B-Instruct-v0.2
18
  ---
 
1
  ---
2
  library_name: mlx
3
  license: apache-2.0
4
+ base_model: mistralai/Mistral-7B-Instruct-v0.3
5
+ extra_gated_description: If you want to learn more about how we process your personal
6
+ data, please read our <a href="https://mistral.ai/terms/">Privacy Policy</a>.
7
  tags:
8
+ - vllm
9
  - mistral-common
10
  - mlx
 
 
 
 
 
 
 
 
11
  pipeline_tag: text-generation
 
12
  ---
chat_template.jinja CHANGED
@@ -1,24 +1,87 @@
1
- {%- if messages[0]['role'] == 'system' %}
2
- {%- set system_message = messages[0]['content'] %}
3
  {%- set loop_messages = messages[1:] %}
4
  {%- else %}
5
  {%- set loop_messages = messages %}
6
  {%- endif %}
 
 
 
 
7
 
8
- {{- bos_token }}
 
 
9
  {%- for message in loop_messages %}
10
- {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}
11
- {{- raise_exception('After the optional system message, conversation roles must alternate user/assistant/user/assistant/...') }}
 
 
 
12
  {%- endif %}
13
- {%- if message['role'] == 'user' %}
14
- {%- if loop.first and system_message is defined %}
15
- {{- ' [INST] ' + system_message + '\n\n' + message['content'] + ' [/INST]' }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  {%- else %}
17
- {{- ' [INST] ' + message['content'] + ' [/INST]' }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  {%- endif %}
19
- {%- elif message['role'] == 'assistant' %}
20
- {{- ' ' + message['content'] + eos_token}}
21
  {%- else %}
22
- {{- raise_exception('Only user and assistant roles are supported, with the exception of an initial optional system message!') }}
23
  {%- endif %}
24
  {%- endfor %}
 
1
+ {%- if messages[0]["role"] == "system" %}
2
+ {%- set system_message = messages[0]["content"] %}
3
  {%- set loop_messages = messages[1:] %}
4
  {%- else %}
5
  {%- set loop_messages = messages %}
6
  {%- endif %}
7
+ {%- if not tools is defined %}
8
+ {%- set tools = none %}
9
+ {%- endif %}
10
+ {%- set user_messages = loop_messages | selectattr("role", "equalto", "user") | list %}
11
 
12
+ {#- This block checks for alternating user/assistant messages, skipping tool calling messages #}
13
+ {%- set ns = namespace() %}
14
+ {%- set ns.index = 0 %}
15
  {%- for message in loop_messages %}
16
+ {%- if not (message.role == "tool" or message.role == "tool_results" or (message.tool_calls is defined and message.tool_calls is not none)) %}
17
+ {%- if (message["role"] == "user") != (ns.index % 2 == 0) %}
18
+ {{- raise_exception("After the optional system message, conversation roles must alternate user/assistant/user/assistant/...") }}
19
+ {%- endif %}
20
+ {%- set ns.index = ns.index + 1 %}
21
  {%- endif %}
22
+ {%- endfor %}
23
+
24
+ {{- bos_token }}
25
+ {%- for message in loop_messages %}
26
+ {%- if message["role"] == "user" %}
27
+ {%- if tools is not none and (message == user_messages[-1]) %}
28
+ {{- "[AVAILABLE_TOOLS] [" }}
29
+ {%- for tool in tools %}
30
+ {%- set tool = tool.function %}
31
+ {{- '{"type": "function", "function": {' }}
32
+ {%- for key, val in tool.items() if key != "return" %}
33
+ {%- if val is string %}
34
+ {{- '"' + key + '": "' + val + '"' }}
35
+ {%- else %}
36
+ {{- '"' + key + '": ' + val|tojson }}
37
+ {%- endif %}
38
+ {%- if not loop.last %}
39
+ {{- ", " }}
40
+ {%- endif %}
41
+ {%- endfor %}
42
+ {{- "}}" }}
43
+ {%- if not loop.last %}
44
+ {{- ", " }}
45
+ {%- else %}
46
+ {{- "]" }}
47
+ {%- endif %}
48
+ {%- endfor %}
49
+ {{- "[/AVAILABLE_TOOLS]" }}
50
+ {%- endif %}
51
+ {%- if loop.last and system_message is defined %}
52
+ {{- "[INST] " + system_message + "\n\n" + message["content"] + "[/INST]" }}
53
  {%- else %}
54
+ {{- "[INST] " + message["content"] + "[/INST]" }}
55
+ {%- endif %}
56
+ {%- elif message.tool_calls is defined and message.tool_calls is not none %}
57
+ {{- "[TOOL_CALLS] [" }}
58
+ {%- for tool_call in message.tool_calls %}
59
+ {%- set out = tool_call.function|tojson %}
60
+ {{- out[:-1] }}
61
+ {%- if not tool_call.id is defined or tool_call.id|length != 9 %}
62
+ {{- raise_exception("Tool call IDs should be alphanumeric strings with length 9!") }}
63
+ {%- endif %}
64
+ {{- ', "id": "' + tool_call.id + '"}' }}
65
+ {%- if not loop.last %}
66
+ {{- ", " }}
67
+ {%- else %}
68
+ {{- "]" + eos_token }}
69
+ {%- endif %}
70
+ {%- endfor %}
71
+ {%- elif message["role"] == "assistant" %}
72
+ {{- " " + message["content"]|trim + eos_token}}
73
+ {%- elif message["role"] == "tool_results" or message["role"] == "tool" %}
74
+ {%- if message.content is defined and message.content.content is defined %}
75
+ {%- set content = message.content.content %}
76
+ {%- else %}
77
+ {%- set content = message.content %}
78
+ {%- endif %}
79
+ {{- '[TOOL_RESULTS] {"content": ' + content|string + ", " }}
80
+ {%- if not message.tool_call_id is defined or message.tool_call_id|length != 9 %}
81
+ {{- raise_exception("Tool call IDs should be alphanumeric strings with length 9!") }}
82
  {%- endif %}
83
+ {{- '"call_id": "' + message.tool_call_id + '"}[/TOOL_RESULTS]' }}
 
84
  {%- else %}
85
+ {{- raise_exception("Only user and assistant roles are supported, with the exception of an initial optional system message!") }}
86
  {%- endif %}
87
  {%- endfor %}
config.json CHANGED
@@ -19,7 +19,7 @@
19
  "sliding_window": null,
20
  "tie_word_embeddings": false,
21
  "torch_dtype": "bfloat16",
22
- "transformers_version": "4.36.0",
23
  "use_cache": true,
24
- "vocab_size": 32000
25
  }
 
19
  "sliding_window": null,
20
  "tie_word_embeddings": false,
21
  "torch_dtype": "bfloat16",
22
+ "transformers_version": "4.42.0.dev0",
23
  "use_cache": true,
24
+ "vocab_size": 32768
25
  }
generation_config.json CHANGED
@@ -2,5 +2,5 @@
2
  "_from_model_config": true,
3
  "bos_token_id": 1,
4
  "eos_token_id": 2,
5
- "transformers_version": "4.36.0"
6
  }
 
2
  "_from_model_config": true,
3
  "bos_token_id": 1,
4
  "eos_token_id": 2,
5
+ "transformers_version": "4.42.0.dev0"
6
  }
model-00001-of-00003.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:1d38a7736a030ef9cace5ae9ba093a165cd23c2fe97a375c78cb6fe67dc4c5a4
3
- size 5261946744
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bff1097a50c91877a325700af3e0b239517c120ea5844cc0ee3423ff3a786a22
3
+ size 5268238200
model-00002-of-00003.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:aea2f633eb475e4d00e0299532806777168cec776f06e795b7507b0a537ef27f
3
  size 5352141224
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:78a80a48e6ccaac1872dd05c83e2b01e6ac18867575380ce95c49ee9b3d6eb4d
3
  size 5352141224
model-00003-of-00003.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:99c92a47a81851c89df1646d919e1f16c050225f2ac6df0346be4a06428f4a5e
3
- size 3869410030
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5d8624018968752db5bfdb0c8c949fa415d25e7e482579f7868a94c417c9d282
3
+ size 3875701486
model.safetensors.index.json CHANGED
@@ -1,7 +1,7 @@
1
  {
2
  "metadata": {
3
- "total_size": 14483464192,
4
- "total_parameters": 7241732096
5
  },
6
  "weight_map": {
7
  "lm_head.weight": "model-00003-of-00003.safetensors",
 
1
  {
2
  "metadata": {
3
+ "total_size": 14496047104,
4
+ "total_parameters": 7248023552
5
  },
6
  "weight_map": {
7
  "lm_head.weight": "model-00003-of-00003.safetensors",
tokenizer.json CHANGED
The diff for this file is too large to render. See raw diff
 
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37f00374dea48658ee8f5d0f21895b9bc55cb0103939607c8185bfd1c6ca1f89
3
+ size 587404
tokenizer_config.json CHANGED
The diff for this file is too large to render. See raw diff