avacaondata commited on
Commit
f091093
·
verified ·
1 Parent(s): f33a07b

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: microsoft/Phi-4-mini-instruct
3
+ license: mit
4
+ license_link: https://huggingface.co/microsoft/Phi-4-mini-instruct/resolve/main/LICENSE
5
+ language:
6
+ - multilingual
7
+ pipeline_tag: text-generation
8
+ tags:
9
+ - phi
10
+ - phi4
11
+ - unsloth
12
+ - nlp
13
+ - code
14
+ - microsoft
15
+ - math
16
+ - chat
17
+ - conversational
18
+ library_name: transformers
19
+ ---
20
+ <div>
21
+ <p style="margin-bottom: 0; margin-top: 0;">
22
+ <strong>This is Phi-4-mini-instruct with our BUG FIXES. <br> See <a href="https://huggingface.co/collections/unsloth/phi-4-all-versions-677eecf93784e61afe762afa">our collection</a> for versions of Phi-4 with our bug fixes including GGUF & 4-bit formats.</strong>
23
+ </p>
24
+ <p style="margin-bottom: 0;">
25
+ <em>Unsloth's Phi-4 <a href="https://unsloth.ai/blog/dynamic-4bit">Dynamic Quants</a> is selectively quantized, greatly improving accuracy over standard 4-bit.</em>
26
+ </p>
27
+ <div style="display: flex; gap: 5px; align-items: center; ">
28
+ <a href="https://github.com/unslothai/unsloth/">
29
+ <img src="https://github.com/unslothai/unsloth/raw/main/images/unsloth%20new%20logo.png" width="133">
30
+ </a>
31
+ <a href="https://discord.gg/unsloth">
32
+ <img src="https://github.com/unslothai/unsloth/raw/main/images/Discord%20button.png" width="173">
33
+ </a>
34
+ <a href="https://docs.unsloth.ai/">
35
+ <img src="https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/images/documentation%20green%20button.png" width="143">
36
+ </a>
37
+ </div>
38
+ <h1 style="margin-top: 0rem;">Finetune your own Reasoning model like R1 with Unsloth!</h2>
39
+ </div>
40
+
41
+ We have a free Google Colab notebook for turning Phi-4 into a reasoning model: https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Phi_4_(14B)-GRPO.ipynb
42
+
43
+ ### Unsloth bug fixes:
44
+ 1. Padding and EOS tokens are the same - fixed this.
45
+ 2. Chat template had extra EOS token - removed this. Otherwise you will be <|end|> during inference.
46
+ 3. EOS token should be <|end|> not <|endoftext|>. Otherwise it'll terminate at <|endoftext|>
47
+ 4. Changed unk_token to � from EOS.
48
+ 5.
49
+ ## ✨ Finetune for Free
50
+
51
+ All notebooks are **beginner friendly**! Add your dataset, click "Run All", and you'll get a 2x faster finetuned model which can be exported to GGUF, vLLM or uploaded to Hugging Face.
52
+
53
+ | Unsloth supports | Free Notebooks | Performance | Memory use |
54
+ |-----------------|--------------------------------------------------------------------------------------------------------------------------|-------------|----------|
55
+ | **GRPO with Phi-4** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Phi_4_(14B)-GRPO.ipynb) | 2x faster | 80% less |
56
+ | **Llama-3.2 (3B)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Llama3.2_(1B_and_3B)-Conversational.ipynb) | 2.4x faster | 58% less |
57
+ | **Llama-3.2 (11B vision)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Llama3.2_(11B)-Vision.ipynb) | 2x faster | 60% less |
58
+ | **Qwen2 VL (7B)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Qwen2_VL_(7B)-Vision.ipynb) | 1.8x faster | 60% less |
59
+ | **Qwen2.5 (7B)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Qwen2.5_(7B)-Alpaca.ipynb) | 2x faster | 60% less |
60
+ | **Llama-3.1 (8B)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Llama3.1_(8B)-Alpaca.ipynb) | 2.4x faster | 58% less |
61
+ | **Phi-4 (14B)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Phi_4-Conversational.ipynb) | 2x faster | 50% less |
62
+ | **Gemma 2 (9B)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Gemma2_(9B)-Alpaca.ipynb) | 2.4x faster | 58% less |
63
+ | **Mistral (7B)** | [▶️ Start on Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Mistral_v0.3_(7B)-Conversational.ipynb) | 2.2x faster | 62% less |
64
+
65
+ [<img src="https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/images/documentation%20green%20button.png" width="200"/>](https://docs.unsloth.ai)
66
+
67
+ - This [Llama 3.2 conversational notebook](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Llama3.2_(1B_and_3B)-Conversational.ipynb) is useful for ShareGPT ChatML / Vicuna templates.
68
+ - This [text completion notebook](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Mistral_(7B)-Text_Completion.ipynb) is for raw text. This [DPO notebook](https://colab.research.google.com/drive/15vttTpzzVXv_tJwEk-hIcQ0S9FcEWvwP?usp=sharing) replicates Zephyr.
69
+ - \* Kaggle has 2x T4s, but we use 1. Due to overhead, 1x T4 is 5x faster.
70
+
71
+ ## Model Summary
72
+
73
+ Phi-4-mini-instruct is a lightweight open model built upon synthetic data and filtered publicly available websites - with a focus on high-quality, reasoning dense data. The model belongs to the Phi-4 model family and supports 128K token context length. The model underwent an enhancement process, incorporating both supervised fine-tuning and direct preference optimization to support precise instruction adherence and robust safety measures.
74
+
75
+ 📰 [Phi-4-mini Microsoft Blog](https://aka.ms/phi4-feb2025) <br>
76
+ 📖 [Phi-4-mini Technical Report](https://aka.ms/phi-4-multimodal/techreport) <br>
77
+ 👩‍🍳 [Phi Cookbook](https://github.com/microsoft/PhiCookBook) <br>
78
+ 🏡 [Phi Portal](https://azure.microsoft.com/en-us/products/phi) <br>
79
+ 🖥️ Try It [Azure](https://aka.ms/phi-4-mini/azure), [Huggingface](https://huggingface.co/spaces/microsoft/phi-4-mini) <br>
80
+
81
+ **Phi-4**:
82
+ [[mini-instruct](https://huggingface.co/microsoft/Phi-4-mini-instruct) | [onnx](https://huggingface.co/microsoft/Phi-4-mini-instruct-onnx)];
83
+ [multimodal-instruct](https://huggingface.co/microsoft/Phi-4-multimodal-instruct);
84
+
85
+ ## Intended Uses
86
+
87
+ ### Primary Use Cases
88
+
89
+ The model is intended for broad multilingual commercial and research use. The model provides uses for general purpose AI systems and applications which require:
90
+
91
+ 1) Memory/compute constrained environments
92
+ 2) Latency bound scenarios
93
+ 3) Strong reasoning (especially math and logic).
94
+
95
+ The model is designed to accelerate research on language and multimodal models, for use as a building block for generative AI powered features.
96
+
97
+ ### Use Case Considerations
98
+
99
+ The model is not specifically designed or evaluated for all downstream purposes. Developers should consider common limitations of language models, as well as performance difference across languages, as they select use cases, and evaluate and mitigate for accuracy, safety, and fairness before using within a specific downstream use case, particularly for high-risk scenarios.
100
+ Developers should be aware of and adhere to applicable laws or regulations (including but not limited to privacy, trade compliance laws, etc.) that are relevant to their use case.
101
+
102
+ ***Nothing contained in this Model Card should be interpreted as or deemed a restriction or modification to the license the model is released under.***
103
+
104
+ ## Release Notes
105
+
106
+ This release of Phi-4-mini-instruct is based on valuable user feedback from the Phi-3 series. The Phi-4-mini model employed new architecture for efficiency, larger vocabulary for multilingual support, and better post-training techniques were used for instruction following, function calling, as well as additional data leading to substantial gains on key capabilities. It is anticipated that most use cases will benefit from this release, but users are encouraged to test in their particular AI applications. The enthusiastic support for the Phi-4 series is greatly appreciated. Feedback on Phi-4-mini-instruct is welcomed and crucial to the model’s evolution and improvement.
107
+
108
+ ### Model Quality
109
+
110
+ To understand the capabilities, the 3.8B parameters Phi-4-mini-instruct model was compared with a set of models over a variety of benchmarks using an internal benchmark platform (See Appendix A for benchmark methodology). A high-level overview of the model quality is as follows:
111
+
112
+ | Benchmark | Similar size | | | | |2x size | | | | | |
113
+ |----------------------------------|-------------|-------------------|-------------------|-------------------|-----------------|-----------------|-----------------|-----------------|-----------------|-----------------|-----------------|
114
+ | | Phi-4 mini-Ins | Phi-3.5-mini-Ins | Llama-3.2-3B-Ins | Mistral-3B | Qwen2.5-3B-Ins | Qwen2.5-7B-Ins | Mistral-8B-2410 | Llama-3.1-8B-Ins | Llama-3.1-Tulu-3-8B | Gemma2-9B-Ins | GPT-4o-mini-2024-07-18 |
115
+ | **Popular aggregated benchmark** | | | | | | | | | | | |
116
+ | Arena Hard | 32.8 | 34.4 | 17.0 | 26.9 | 32.0 | 55.5 | 37.3 | 25.7 | 42.7 | 43.7 | 53.7 |
117
+ | BigBench Hard (0-shot, CoT) | 70.4 | 63.1 | 55.4 | 51.2 | 56.2 | 72.4 | 53.3 | 63.4 | 55.5 | 65.7 | 80.4 |
118
+ | MMLU (5-shot) | 67.3 | 65.5 | 61.8 | 60.8 | 65.0 | 72.6 | 63.0 | 68.1 | 65.0 | 71.3 | 77.2 |
119
+ | MMLU-Pro (0-shot, CoT) | 52.8 | 47.4 | 39.2 | 35.3 | 44.7 | 56.2 | 36.6 | 44.0 | 40.9 | 50.1 | 62.8 |
120
+ | **Reasoning** | | | | | | | | | | | |
121
+ | ARC Challenge (10-shot) | 83.7 | 84.6 | 76.1 | 80.3 | 82.6 | 90.1 | 82.7 | 83.1 | 79.4 | 89.8 | 93.5 |
122
+ | BoolQ (2-shot) | 81.2 | 77.7 | 71.4 | 79.4 | 65.4 | 80.0 | 80.5 | 82.8 | 79.3 | 85.7 | 88.7 |
123
+ | GPQA (0-shot, CoT) | 25.2 | 26.6 | 24.3 | 24.4 | 23.4 | 30.6 | 26.3 | 26.3 | 29.9 | 39.1 | 41.1 |
124
+ | HellaSwag (5-shot) | 69.1 | 72.2 | 77.2 | 74.6 | 74.6 | 80.0 | 73.5 | 72.8 | 80.9 | 87.1 | 88.7 |
125
+ | OpenBookQA (10-shot) | 79.2 | 81.2 | 72.6 | 79.8 | 79.3 | 82.6 | 80.2 | 84.8 | 79.8 | 90.0 | 90.0 |
126
+ | PIQA (5-shot) | 77.6 | 78.2 | 68.2 | 73.2 | 72.6 | 76.2 | 81.2 | 83.2 | 78.3 | 83.7 | 88.7 |
127
+ | Social IQA (5-shot) | 72.5 | 75.1 | 68.3 | 73.9 | 75.3 | 75.3 | 77.6 | 71.8 | 73.4 | 74.7 | 82.9 |
128
+ | TruthfulQA (MC2) (10-shot) | 66.4 | 65.2 | 59.2 | 62.9 | 64.3 | 69.4 | 63.0 | 69.2 | 64.1 | 76.6 | 78.2 |
129
+ | Winogrande (5-shot) | 67.0 | 72.2 | 53.2 | 59.8 | 63.3 | 71.1 | 63.1 | 64.7 | 65.4 | 74.0 | 76.9 |
130
+ | **Multilingual** | | | | | | | | | | | |
131
+ | Multilingual MMLU (5-shot) | 49.3 | 51.8 | 48.1 | 46.4 | 55.9 | 64.4 | 53.7 | 56.2 | 54.5 | 63.8 | 72.9 |
132
+ | MGSM (0-shot, CoT) | 63.9 | 49.6 | 44.6 | 44.6 | 53.5 | 64.5 | 56.7 | 56.7 | 58.6 | 75.1 | 81.7 |
133
+ | **Math** | | | | | | | | | | | |
134
+ | GSM8K (8-shot, CoT) | 88.6 | 76.9 | 75.6 | 80.1 | 80.6 | 88.7 | 81.9 | 82.4 | 84.3 | 84.9 | 91.3 |
135
+ | MATH (0-shot, CoT) | 64.0 | 49.8 | 46.7 | 41.8 | 61.7 | 60.4 | 41.6 | 47.6 | 46.1 | 51.3 | 70.2 |
136
+ | **Overall** | **63.5** | **60.5** | **56.2** | **56.9** | **60.1** | **67.9** | **60.2** | **62.3** | **60.9** | **65.0** | **75.5** |
137
+
138
+ Overall, the model with only 3.8B-param achieves a similar level of multilingual language understanding and reasoning ability as much larger models. However, it is still fundamentally limited by its size for certain tasks. The model simply does not have the capacity to store too much factual knowledge, therefore, users may experience factual incorrectness. However, it may be possible to resolve such weakness by augmenting Phi-4 with a search engine, particularly when using the model under RAG settings.
139
+
140
+ ## Usage
141
+
142
+ ### Tokenizer
143
+
144
+ Phi-4-mini-instruct supports a vocabulary size of up to `200064` tokens. The [tokenizer files](https://huggingface.co/microsoft/Phi-4-mini-instruct/blob/main/added_tokens.json) already provide placeholder tokens that can be used for downstream fine-tuning, but they can also be extended up to the model's vocabulary size.
145
+
146
+ ### Input Formats
147
+
148
+ Given the nature of the training data, the Phi-4-mini-instruct
149
+ model is best suited for prompts using specific formats.
150
+ Below are the two primary formats:
151
+
152
+ #### Chat format
153
+
154
+ This format is used for general conversation and instructions:
155
+
156
+ ```yaml
157
+ <|system|>Insert System Message<|end|><|user|>Insert User Message<|end|><|assistant|>
158
+ ```
159
+
160
+ #### Tool-enabled function-calling format
161
+
162
+ This format is used when the user wants the model to provide function calls based on the given tools. The user should provide the available tools in the system prompt, wrapped by <|tool|> and <|/tool|> tokens. The tools should be specified in JSON format, using a JSON dump structure. Example:
163
+
164
+ `
165
+ <|system|>You are a helpful assistant with some tools.<|tool|>[{"name": "get_weather_updates", "description": "Fetches weather updates for a given city using the RapidAPI Weather API.", "parameters": {"city": {"description": "The name of the city for which to retrieve weather information.", "type": "str", "default": "London"}}}]<|/tool|><|end|><|user|>What is the weather like in Paris today?<|end|><|assistant|>
166
+ `
167
+
168
+ ### Inference with vLLM
169
+
170
+ #### Requirements
171
+
172
+ List of required packages:
173
+
174
+ ```
175
+ flash_attn==2.7.4.post1
176
+ torch==2.6.0
177
+ vllm>=0.7.2
178
+ ```
179
+
180
+ #### Example
181
+
182
+ To perform inference using vLLM, you can use the following code snippet:
183
+
184
+ ```python
185
+ from vllm import LLM, SamplingParams
186
+
187
+ llm = LLM(model="microsoft/Phi-4-mini-instruct", trust_remote_code=True)
188
+
189
+ messages = [
190
+ {"role": "system", "content": "You are a helpful AI assistant."},
191
+ {"role": "user", "content": "Can you provide ways to eat combinations of bananas and dragonfruits?"},
192
+ {"role": "assistant", "content": "Sure! Here are some ways to eat bananas and dragonfruits together: 1. Banana and dragonfruit smoothie: Blend bananas and dragonfruits together with some milk and honey. 2. Banana and dragonfruit salad: Mix sliced bananas and dragonfruits together with some lemon juice and honey."},
193
+ {"role": "user", "content": "What about solving an 2x + 3 = 7 equation?"},
194
+ ]
195
+
196
+ sampling_params = SamplingParams(
197
+ max_tokens=500,
198
+ temperature=0.0,
199
+ )
200
+
201
+ output = llm.chat(messages=messages, sampling_params=sampling_params)
202
+ print(output[0].outputs[0].text)
203
+ ```
204
+
205
+ ### Inference with Transformers
206
+
207
+ #### Requirements
208
+
209
+
210
+ Phi-4 family has been integrated in the `4.49.0` version of `transformers`. The current `transformers` version can be verified with: `pip list | grep transformers`.
211
+
212
+ List of required packages:
213
+
214
+ ```
215
+ flash_attn==2.7.4.post1
216
+ torch==2.6.0
217
+ transformers==4.49.0
218
+ accelerate==1.3.0
219
+ ```
220
+
221
+ Phi-4-mini-instruct is also available in [Azure AI Studio]()
222
+
223
+ #### Example
224
+
225
+ After obtaining the Phi-4-mini-instruct model checkpoints, users can use this sample code for inference.
226
+
227
+ ```python
228
+ import torch
229
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
230
+
231
+ torch.random.manual_seed(0)
232
+
233
+ model_path = "microsoft/Phi-4-mini-instruct"
234
+
235
+ model = AutoModelForCausalLM.from_pretrained(
236
+ model_path,
237
+ device_map="auto",
238
+ torch_dtype="auto",
239
+ trust_remote_code=True,
240
+ )
241
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
242
+
243
+ messages = [
244
+ {"role": "system", "content": "You are a helpful AI assistant."},
245
+ {"role": "user", "content": "Can you provide ways to eat combinations of bananas and dragonfruits?"},
246
+ {"role": "assistant", "content": "Sure! Here are some ways to eat bananas and dragonfruits together: 1. Banana and dragonfruit smoothie: Blend bananas and dragonfruits together with some milk and honey. 2. Banana and dragonfruit salad: Mix sliced bananas and dragonfruits together with some lemon juice and honey."},
247
+ {"role": "user", "content": "What about solving an 2x + 3 = 7 equation?"},
248
+ ]
249
+
250
+ pipe = pipeline(
251
+ "text-generation",
252
+ model=model,
253
+ tokenizer=tokenizer,
254
+ )
255
+
256
+ generation_args = {
257
+ "max_new_tokens": 500,
258
+ "return_full_text": False,
259
+ "temperature": 0.0,
260
+ "do_sample": False,
261
+ }
262
+
263
+ output = pipe(messages, **generation_args)
264
+ print(output[0]['generated_text'])
265
+ ```
266
+
267
+ ## Responsible AI Considerations
268
+
269
+ Like other language models, the Phi family of models can potentially behave in ways that are unfair, unreliable, or offensive. Some of the limiting behaviors to be aware of include:
270
+
271
+ + Quality of Service: The Phi models are trained primarily on English text and some additional multilingual text. Languages other than English will experience worse performance as well as performance disparities across non-English. English language varieties with less representation in the training data might experience worse performance than standard American English.
272
+ + Multilingual performance and safety gaps: We believe it is important to make language models more widely available across different languages, but the Phi 4 models still exhibit challenges common across multilingual releases. As with any deployment of LLMs, developers will be better positioned to test for performance or safety gaps for their linguistic and cultural context and customize the model with additional fine-tuning and appropriate safeguards.
273
+ + Representation of Harms & Perpetuation of Stereotypes: These models can over- or under-represent groups of people, erase representation of some groups, or reinforce demeaning or negative stereotypes. Despite safety post-training, these limitations may still be present due to differing levels of representation of different groups, cultural contexts, or prevalence of examples of negative stereotypes in training data that reflect real-world patterns and societal biases.
274
+ + Inappropriate or Offensive Content: These models may produce other types of inappropriate or offensive content, which may make it inappropriate to deploy for sensitive contexts without additional mitigations that are specific to the case.
275
+ + Information Reliability: Language models can generate nonsensical content or fabricate content that might sound reasonable but is inaccurate or outdated.
276
+ + Limited Scope for Code: The majority of Phi 4 training data is based in Python and uses common packages such as "typing, math, random, collections, datetime, itertools". If the model generates Python scripts that utilize other packages or scripts in other languages, it is strongly recommended that users manually verify all API uses.
277
+ + Long Conversation: Phi 4 models, like other models, can in some cases generate responses that are repetitive, unhelpful, or inconsistent in very long chat sessions in both English and non-English languages. Developers are encouraged to place appropriate mitigations, like limiting conversation turns to account for the possible conversational drift.
278
+
279
+ Developers should apply responsible AI best practices, including mapping, measuring, and mitigating risks associated with their specific use case and cultural, linguistic context. Phi 4 family of models are general purpose models. As developers plan to deploy these models for specific use cases, they are encouraged to fine-tune the models for their use case and leverage the models as part of broader AI systems with language-specific safeguards in place. Important areas for consideration include:
280
+
281
+ + Allocation: Models may not be suitable for scenarios that could have consequential impact on legal status or the allocation of resources or life opportunities (ex: housing, employment, credit, etc.) without further assessments and additional debiasing techniques.
282
+ + High-Risk Scenarios: Developers should assess the suitability of using models in high-risk scenarios where unfair, unreliable or offensive outputs might be extremely costly or lead to harm. This includes providing advice in sensitive or expert domains where accuracy and reliability are critical (ex: legal or health advice). Additional safeguards should be implemented at the application level according to the deployment context.
283
+ + Misinformation: Models may produce inaccurate information. Developers should follow transparency best practices and inform end-users they are interacting with an AI system. At the application level, developers can build feedback mechanisms and pipelines to ground responses in use-case specific, contextual information, a technique known as Retrieval Augmented Generation (RAG).
284
+ + Generation of Harmful Content: Developers should assess outputs for their context and use available safety classifiers or custom solutions appropriate for their use case.
285
+ + Misuse: Other forms of misuse such as fraud, spam, or malware production may be possible, and developers should ensure that their applications do not violate applicable laws and regulations.
286
+
287
+
288
+ ## Training
289
+
290
+ ### Model
291
+
292
+ + **Architecture:** Phi-4-mini-instruct has 3.8B parameters and is a dense decoder-only Transformer model. When compared with Phi-3.5-mini, the major changes with Phi-4-mini-instruct are 200K vocabulary, grouped-query attention, and shared input and output embedding.<br>
293
+ + **Inputs:** Text. It is best suited for prompts using the chat format.<br>
294
+ + **Context length:** 128K tokens<br>
295
+ + **GPUs:** 512 A100-80G<br>
296
+ + **Training time:** 21 days<br>
297
+ + **Training data:** 5T tokens<br>
298
+ + **Outputs:** Generated text in response to the input<br>
299
+ + **Dates:** Trained between November and December 2024<br>
300
+ + **Status:** This is a static model trained on offline datasets with the cutoff date of June 2024 for publicly available data.<br>
301
+ + **Supported languages:** Arabic, Chinese, Czech, Danish, Dutch, English, Finnish, French, German, Hebrew, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, Portuguese, Russian, Spanish, Swedish, Thai, Turkish, Ukrainian<br>
302
+ + **Release date:** February 2025<br>
303
+
304
+ ### Training Datasets
305
+
306
+ Phi-4-mini’s training data includes a wide variety of sources, totaling 5 trillion tokens, and is a combination of
307
+ 1) publicly available documents filtered for quality, selected high-quality educational data, and code
308
+ 2) newly created synthetic, “textbook-like” data for the purpose of teaching math, coding, common sense reasoning, general knowledge of the world (e.g., science, daily activities, theory of mind, etc.)
309
+ 3) high quality chat format supervised data covering various topics to reflect human preferences on different aspects such as instruct-following, truthfulness, honesty and helpfulness. Focus was placed on the quality of data that could potentially improve the reasoning ability for the model, and the publicly available documents were filtered to contain a preferred level of knowledge. As an example, the result of a game in premier league on a particular day might be good training data for frontier models, but such information was removed to leave more model capacity for reasoning for the model’s small size. More details about data can be found in the Phi-4-mini-instruct technical report.
310
+
311
+ The decontamination process involved normalizing and tokenizing the dataset, then generating and comparing n-grams between the target dataset and benchmark datasets. Samples with matching n-grams above a threshold were flagged as contaminated and removed from the dataset. A detailed contamination report was generated, summarizing the matched text, matching ratio, and filtered results for further analysis.
312
+
313
+ ### Fine-tuning
314
+
315
+ A basic example of multi-GPUs supervised fine-tuning (SFT) with TRL and Accelerate modules is provided [here](https://huggingface.co/microsoft/Phi-4-mini-instruct/resolve/main/sample_finetune.py).
316
+
317
+ ## Safety Evaluation and Red-Teaming
318
+
319
+ Various evaluation techniques including red teaming, adversarial conversation simulations, and multilingual safety evaluation benchmark datasets were leveraged to evaluate Phi-4 models’ propensity to produce undesirable outputs across multiple languages and risk categories. Several approaches were used to compensate for the limitations of one approach alone. Findings across the various evaluation methods indicate that safety post-training that was done as detailed in the Phi 3 Safety Post-Training paper had a positive impact across multiple languages and risk categories as observed by refusal rates (refusal to output undesirable outputs) and robustness to jailbreak techniques. Details on prior red team evaluations across Phi models can be found in the Phi 3 Safety Post-Training paper. For this release, the red team tested the model in English, Chinese, Japanese, Spanish, Portuguese, Arabic, Thai, and Russian for the following potential harms: Hate Speech and Bias, Violent Crimes, Specialized Advice, and Election Information. Their findings indicate that the model is resistant to jailbreak techniques across languages, but that language-specific attack prompts leveraging cultural context can cause the model to output harmful content. Another insight was that with function calling scenarios, the model could sometimes hallucinate function names or URL’s. The model may also be more susceptible to longer multi-turn jailbreak techniques across both English and non-English languages. These findings highlight the need for industry-wide investment in the development of high-quality safety evaluation datasets across multiple languages, including low resource languages, and risk areas that account for cultural nuances where those languages are spoken.
320
+
321
+ ## Software
322
+ * [PyTorch](https://github.com/pytorch/pytorch)
323
+ * [Transformers](https://github.com/huggingface/transformers)
324
+ * [Flash-Attention](https://github.com/HazyResearch/flash-attention)
325
+
326
+ ## Hardware
327
+ Note that by default, the Phi-4-mini-instruct model uses flash attention, which requires certain types of GPU hardware to run. We have tested on the following GPU types:
328
+ * NVIDIA A100
329
+ * NVIDIA A6000
330
+ * NVIDIA H100
331
+
332
+ If you want to run the model on:
333
+ * NVIDIA V100 or earlier generation GPUs: call AutoModelForCausalLM.from_pretrained() with attn_implementation="eager"
334
+
335
+ ## License
336
+ The model is licensed under the [MIT license](./LICENSE).
337
+
338
+ ## Trademarks
339
+ This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft’s Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.
340
+
341
+
342
+ ## Appendix A: Benchmark Methodology
343
+
344
+ We include a brief word on methodology here - and in particular, how we think about optimizing prompts.
345
+ In an ideal world, we would never change any prompts in our benchmarks to ensure it is always an apples-to-apples comparison when comparing different models. Indeed, this is our default approach, and is the case in the vast majority of models we have run to date.
346
+ There are, however, some exceptions to this. In some cases, we see a model that performs worse than expected on a given eval due to a failure to respect the output format. For example:
347
+
348
+ + A model may refuse to answer questions (for no apparent reason), or in coding tasks models may prefix their response with “Sure, I can help with that. ��” which may break the parser. In such cases, we have opted to try different system messages (e.g. “You must always respond to a question” or “Get to the point!”).
349
+ + With some models, we observed that few shots actually hurt model performance. In this case we did allow running the benchmarks with 0-shots for all cases.
350
+ + We have tools to convert between chat and completions APIs. When converting a chat prompt to a completion prompt, some models have different keywords e.g. Human vs User. In these cases, we do allow for model-specific mappings for chat to completion prompts.
351
+
352
+ However, we do not:
353
+
354
+ + Pick different few-shot examples. Few shots will always be the same when comparing different models.
355
+ + Change prompt format: e.g. if it is an A/B/C/D multiple choice, we do not tweak this to 1/2/3/4 multiple choice.
356
+
357
+ ### Benchmark datasets
358
+
359
+ The model was evaluated across a breadth of public and internal benchmarks to understand the model’s capabilities under multiple tasks and conditions. While most evaluations use English, the leading multilingual benchmark was incorporated that covers performance in select languages. More specifically,
360
+
361
+ + Reasoning:
362
+ + Winogrande: commonsense reasoning around pronoun resolution
363
+ + PIQA: physical commonsense reasoning around everyday situations
364
+ + ARC-challenge: grade-school multiple choice science questions
365
+ + GPQA: very hard questions written and validated by experts in biology, physics, and chemistry
366
+ + MedQA: medical questions answering
367
+ + Social IQA: social commonsense intelligence
368
+ + BoolQ: natural questions from context
369
+ + TruthfulQA: grounded reasoning
370
+ + Language understanding:
371
+ + HellaSwag: commonsense natural language inference around everyday events
372
+ + ANLI: adversarial natural language inference
373
+ + Function calling:
374
+ + Berkeley function calling function and tool call
375
+ + Internal function calling benchmarks
376
+ + World knowledge:
377
+ + TriviaQA: trivia question on general topics
378
+ + Math:
379
+ + GSM8K: grade-school math word problems
380
+ + GSM8K Hard: grade-school math word problems with large values and some absurdity.
381
+ + MATH: challenging competition math problems
382
+ + Code:
383
+ + HumanEval HumanEval+, MBPP, MBPP+: python coding tasks
384
+ + LiveCodeBenh, LiveBench: contamination-free code tasks
385
+ + BigCode Bench: challenging programming tasks
386
+ + Spider: SQL query tasks
387
+ + Internal coding benchmarks
388
+ + Instructions following:
389
+ + IFEval: verifiable instructions
390
+ + Internal instructions following benchmarks
391
+ + Multilingual:
392
+ + MGSM: multilingual grade-school math
393
+ + Multilingual MMLU and MMLU-pro
394
+ + MEGA: multilingual NLP tasks
395
+ + Popular aggregated datasets: MMLU, MMLU-pro, BigBench-Hard, AGI Eval
396
+ + Multi-turn conversations:
397
+ + Data generated by in-house adversarial conversation simulation tool
398
+ + Single-turn trustworthiness evaluation:
399
+ + DecodingTrust: a collection of trustworthiness benchmarks in eight different perspectives
400
+ + XSTest: exaggerated safety evaluation
401
+ + Toxigen: adversarial and hate speech detection
402
+ + Red Team:
403
+ + Responses to prompts provided by AI Red Team at Microsoft
added_tokens.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "<|/tool_call|>": 200026,
3
+ "<|/tool|>": 200024,
4
+ "<|assistant|>": 200019,
5
+ "<|end|>": 200020,
6
+ "<|system|>": 200022,
7
+ "<|tag|>": 200028,
8
+ "<|tool_call|>": 200025,
9
+ "<|tool_response|>": 200027,
10
+ "<|tool|>": 200023,
11
+ "<|user|>": 200021,
12
+ "<|PAD▁TOKEN|>": 200029
13
+ }
config.json ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "unsloth/Phi-4-mini-instruct",
3
+ "architectures": [
4
+ "Phi3ForCausalLM"
5
+ ],
6
+ "attention_bias": false,
7
+ "attention_dropout": 0.0,
8
+ "auto_map": {
9
+ "AutoConfig": "configuration_phi3.Phi3Config",
10
+ "AutoModelForCausalLM": "modeling_phi3.Phi3ForCausalLM",
11
+ "AutoTokenizer": "Xenova/gpt-4o"
12
+ },
13
+ "bos_token_id": 199999,
14
+ "embd_pdrop": 0.0,
15
+ "eos_token_id": 200020,
16
+ "full_attn_mod": 1,
17
+ "hidden_act": "silu",
18
+ "hidden_size": 3072,
19
+ "initializer_range": 0.02,
20
+ "intermediate_size": 8192,
21
+ "interpolate_factor": 1,
22
+ "lm_head_bias": false,
23
+ "max_position_embeddings": 131072,
24
+ "mlp_bias": false,
25
+ "model_type": "phi3",
26
+ "num_attention_heads": 24,
27
+ "num_hidden_layers": 32,
28
+ "num_key_value_heads": 8,
29
+ "original_max_position_embeddings": 4096,
30
+ "pad_token_id": 200029,
31
+ "partial_rotary_factor": 0.75,
32
+ "quantization_config": {
33
+ "_load_in_4bit": true,
34
+ "_load_in_8bit": false,
35
+ "bnb_4bit_compute_dtype": "bfloat16",
36
+ "bnb_4bit_quant_storage": "uint8",
37
+ "bnb_4bit_quant_type": "nf4",
38
+ "bnb_4bit_use_double_quant": true,
39
+ "llm_int8_enable_fp32_cpu_offload": false,
40
+ "llm_int8_has_fp16_weight": false,
41
+ "llm_int8_skip_modules": [
42
+ "lm_head",
43
+ "multi_modal_projector",
44
+ "merger",
45
+ "modality_projection",
46
+ "model.layers.1.mlp",
47
+ "model.layers.3.mlp",
48
+ "model.layers.30.mlp"
49
+ ],
50
+ "llm_int8_threshold": 6.0,
51
+ "load_in_4bit": true,
52
+ "load_in_8bit": false,
53
+ "quant_method": "bitsandbytes"
54
+ },
55
+ "resid_pdrop": 0.0,
56
+ "rms_norm_eps": 1e-05,
57
+ "rope_scaling": {
58
+ "long_factor": [
59
+ 1,
60
+ 1.118320672,
61
+ 1.250641126,
62
+ 1.398617824,
63
+ 1.564103225,
64
+ 1.74916897,
65
+ 1.956131817,
66
+ 2.187582649,
67
+ 2.446418898,
68
+ 2.735880826,
69
+ 3.059592084,
70
+ 3.421605075,
71
+ 3.826451687,
72
+ 4.279200023,
73
+ 4.785517845,
74
+ 5.351743533,
75
+ 5.984965424,
76
+ 6.693110555,
77
+ 7.485043894,
78
+ 8.370679318,
79
+ 9.36110372,
80
+ 10.4687158,
81
+ 11.70738129,
82
+ 13.09260651,
83
+ 14.64173252,
84
+ 16.37415215,
85
+ 18.31155283,
86
+ 20.47818807,
87
+ 22.90118105,
88
+ 25.61086418,
89
+ 28.64115884,
90
+ 32.03,
91
+ 32.1,
92
+ 32.13,
93
+ 32.23,
94
+ 32.6,
95
+ 32.61,
96
+ 32.64,
97
+ 32.66,
98
+ 32.7,
99
+ 32.71,
100
+ 32.93,
101
+ 32.97,
102
+ 33.28,
103
+ 33.49,
104
+ 33.5,
105
+ 44.16,
106
+ 47.77
107
+ ],
108
+ "short_factor": [
109
+ 1.0,
110
+ 1.0,
111
+ 1.0,
112
+ 1.0,
113
+ 1.0,
114
+ 1.0,
115
+ 1.0,
116
+ 1.0,
117
+ 1.0,
118
+ 1.0,
119
+ 1.0,
120
+ 1.0,
121
+ 1.0,
122
+ 1.0,
123
+ 1.0,
124
+ 1.0,
125
+ 1.0,
126
+ 1.0,
127
+ 1.0,
128
+ 1.0,
129
+ 1.0,
130
+ 1.0,
131
+ 1.0,
132
+ 1.0,
133
+ 1.0,
134
+ 1.0,
135
+ 1.0,
136
+ 1.0,
137
+ 1.0,
138
+ 1.0,
139
+ 1.0,
140
+ 1.0,
141
+ 1.0,
142
+ 1.0,
143
+ 1.0,
144
+ 1.0,
145
+ 1.0,
146
+ 1.0,
147
+ 1.0,
148
+ 1.0,
149
+ 1.0,
150
+ 1.0,
151
+ 1.0,
152
+ 1.0,
153
+ 1.0,
154
+ 1.0,
155
+ 1.0,
156
+ 1.0
157
+ ],
158
+ "type": "longrope"
159
+ },
160
+ "rope_theta": 10000.0,
161
+ "sliding_window": 262144,
162
+ "tie_word_embeddings": true,
163
+ "torch_dtype": "bfloat16",
164
+ "transformers_version": "4.49.0",
165
+ "unsloth_fixed": true,
166
+ "use_cache": true,
167
+ "vocab_size": 200064
168
+ }
configuration_phi3.py ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2024 Microsoft and the HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ """Phi-3 model configuration"""
17
+
18
+ from transformers.configuration_utils import PretrainedConfig
19
+ from transformers.utils import logging
20
+
21
+
22
+ logger = logging.get_logger(__name__)
23
+
24
+
25
+ class Phi3Config(PretrainedConfig):
26
+ r"""
27
+ This is the configuration class to store the configuration of a [`Phi3Model`]. It is used to instantiate a Phi-3
28
+ model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
29
+ defaults will yield a similar configuration to that of the
30
+ [microsoft/Phi-3-mini-4k-instruct](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct).
31
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
32
+ documentation from [`PretrainedConfig`] for more information.
33
+ Args:
34
+ vocab_size (`int`, *optional*, defaults to 32064):
35
+ Vocabulary size of the Phi-3 model. Defines the number of different tokens that can be represented by the
36
+ `inputs_ids` passed when calling [`Phi3Model`].
37
+ hidden_size (`int`, *optional*, defaults to 3072):
38
+ Dimension of the hidden representations.
39
+ intermediate_size (`int`, *optional*, defaults to 8192):
40
+ Dimension of the MLP representations.
41
+ num_hidden_layers (`int`, *optional*, defaults to 32):
42
+ Number of hidden layers in the Transformer decoder.
43
+ num_attention_heads (`int`, *optional*, defaults to 32):
44
+ Number of attention heads for each attention layer in the Transformer decoder.
45
+ num_key_value_heads (`int`, *optional*):
46
+ This is the number of key_value heads that should be used to implement Grouped Query Attention. If
47
+ `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
48
+ `num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
49
+ converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
50
+ by meanpooling all the original heads within that group. For more details checkout [this
51
+ paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to
52
+ `num_attention_heads`.
53
+ resid_pdrop (`float`, *optional*, defaults to 0.0):
54
+ Dropout probability for mlp outputs.
55
+ embd_pdrop (`int`, *optional*, defaults to 0.0):
56
+ The dropout ratio for the embeddings.
57
+ attention_dropout (`float`, *optional*, defaults to 0.0):
58
+ The dropout ratio after computing the attention scores.
59
+ hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
60
+ The non-linear activation function (function or string) in the decoder.
61
+ max_position_embeddings (`int`, *optional*, defaults to 4096):
62
+ The maximum sequence length that this model might ever be used with.
63
+ original_max_position_embeddings (`int`, *optional*, defaults to 4096):
64
+ The maximum sequence length that this model was trained with. This is used to determine the size of the
65
+ original RoPE embeddings when using long scaling.
66
+ initializer_range (`float`, *optional*, defaults to 0.02):
67
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
68
+ rms_norm_eps (`float`, *optional*, defaults to 1e-05):
69
+ The epsilon value used for the RMSNorm.
70
+ use_cache (`bool`, *optional*, defaults to `True`):
71
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
72
+ relevant if `config.is_decoder=True`. Whether to tie weight embeddings or not.
73
+ tie_word_embeddings (`bool`, *optional*, defaults to `False`):
74
+ Whether to tie weight embeddings
75
+ rope_theta (`float`, *optional*, defaults to 10000.0):
76
+ The base period of the RoPE embeddings.
77
+ rope_scaling (`dict`, *optional*):
78
+ The scaling strategy for the RoPE embeddings. If `None`, no scaling is applied. If a dictionary, it must
79
+ contain the following keys: `type`, `short_factor` and `long_factor`. The `type` must be `longrope` and
80
+ the `short_factor` and `long_factor` must be lists of numbers with the same length as the hidden size
81
+ divided by the number of attention heads divided by 2.
82
+ partial_rotary_factor (`float`, *optional*, defaults to 1.0):
83
+ Percentage of the query and keys which will have rotary embedding. Must be between 0.0 and 1.0.
84
+ bos_token_id (`int`, *optional*, defaults to 1):
85
+ The id of the "beginning-of-sequence" token.
86
+ eos_token_id (`int`, *optional*, defaults to 32000):
87
+ The id of the "end-of-sequence" token.
88
+ pad_token_id (`int`, *optional*, defaults to 32000):
89
+ The id of the padding token.
90
+ sliding_window (`int`, *optional*):
91
+ Sliding window attention window size. If `None`, no sliding window is applied.
92
+ Example:
93
+ ```python
94
+ >>> from transformers import Phi3Model, Phi3Config
95
+ >>> # Initializing a Phi-3 style configuration
96
+ >>> configuration = Phi3Config.from_pretrained("microsoft/Phi-3-mini-4k-instruct")
97
+ >>> # Initializing a model from the configuration
98
+ >>> model = Phi3Model(configuration)
99
+ >>> # Accessing the model configuration
100
+ >>> configuration = model.config
101
+ ```"""
102
+
103
+ model_type = "phi3"
104
+ keys_to_ignore_at_inference = ["past_key_values"]
105
+
106
+ def __init__(
107
+ self,
108
+ vocab_size=32064,
109
+ hidden_size=3072,
110
+ intermediate_size=8192,
111
+ num_hidden_layers=32,
112
+ num_attention_heads=32,
113
+ num_key_value_heads=None,
114
+ resid_pdrop=0.0,
115
+ embd_pdrop=0.0,
116
+ attention_dropout=0.0,
117
+ hidden_act="silu",
118
+ max_position_embeddings=4096,
119
+ original_max_position_embeddings=4096,
120
+ initializer_range=0.02,
121
+ rms_norm_eps=1e-5,
122
+ use_cache=True,
123
+ tie_word_embeddings=False,
124
+ rope_theta=10000.0,
125
+ rope_scaling=None,
126
+ partial_rotary_factor=1.0,
127
+ bos_token_id=1,
128
+ eos_token_id=32000,
129
+ pad_token_id=32000,
130
+ sliding_window=None,
131
+ **kwargs,
132
+ ):
133
+ self.vocab_size = vocab_size
134
+ self.hidden_size = hidden_size
135
+ self.intermediate_size = intermediate_size
136
+ self.num_hidden_layers = num_hidden_layers
137
+ self.num_attention_heads = num_attention_heads
138
+
139
+ if num_key_value_heads is None:
140
+ num_key_value_heads = num_attention_heads
141
+
142
+ self.num_key_value_heads = num_key_value_heads
143
+ self.resid_pdrop = resid_pdrop
144
+ self.embd_pdrop = embd_pdrop
145
+ self.attention_dropout = attention_dropout
146
+ self.hidden_act = hidden_act
147
+ self.max_position_embeddings = max_position_embeddings
148
+ self.original_max_position_embeddings = original_max_position_embeddings
149
+ self.initializer_range = initializer_range
150
+ self.rms_norm_eps = rms_norm_eps
151
+ self.use_cache = use_cache
152
+ self.rope_theta = rope_theta
153
+ self.rope_scaling = rope_scaling
154
+ self.partial_rotary_factor = partial_rotary_factor
155
+ self._rope_scaling_adjustment()
156
+ self._rope_scaling_validation()
157
+ self.sliding_window = sliding_window
158
+
159
+ super().__init__(
160
+ bos_token_id=bos_token_id,
161
+ eos_token_id=eos_token_id,
162
+ pad_token_id=pad_token_id,
163
+ tie_word_embeddings=tie_word_embeddings,
164
+ **kwargs,
165
+ )
166
+
167
+ def _rope_scaling_adjustment(self):
168
+ """
169
+ Adjust the `type` of the `rope_scaling` configuration for backward compatibility.
170
+ """
171
+ if self.rope_scaling is None:
172
+ return
173
+
174
+ rope_scaling_type = self.rope_scaling.get("type", None)
175
+
176
+ # For backward compatibility if previous version used "su" or "yarn"
177
+ if rope_scaling_type is not None and rope_scaling_type in ["su", "yarn"]:
178
+ self.rope_scaling["type"] = "longrope"
179
+
180
+ def _rope_scaling_validation(self):
181
+ """
182
+ Validate the `rope_scaling` configuration.
183
+ """
184
+ if self.rope_scaling is None:
185
+ return
186
+
187
+ if not isinstance(self.rope_scaling, dict) or len(self.rope_scaling) != 3:
188
+ raise ValueError(
189
+ "`rope_scaling` must be a dictionary with three fields, `type`, `short_factor` and `long_factor`, "
190
+ f"got {self.rope_scaling}"
191
+ )
192
+ rope_scaling_type = self.rope_scaling.get("type", None)
193
+ rope_scaling_short_factor = self.rope_scaling.get("short_factor", None)
194
+ rope_scaling_long_factor = self.rope_scaling.get("long_factor", None)
195
+ if rope_scaling_type is None or rope_scaling_type not in ["longrope"]:
196
+ raise ValueError(f"`rope_scaling`'s type field must be one of ['longrope'], got {rope_scaling_type}")
197
+ if not (
198
+ isinstance(rope_scaling_short_factor, list)
199
+ and all(isinstance(x, (int, float)) for x in rope_scaling_short_factor)
200
+ ):
201
+ raise ValueError(
202
+ f"`rope_scaling`'s short_factor field must be a list of numbers, got {rope_scaling_short_factor}"
203
+ )
204
+ rotary_ndims = int(self.hidden_size // self.num_attention_heads * self.partial_rotary_factor)
205
+ if not len(rope_scaling_short_factor) == rotary_ndims // 2:
206
+ raise ValueError(
207
+ f"`rope_scaling`'s short_factor field must have length {rotary_ndims // 2}, got {len(rope_scaling_short_factor)}"
208
+ )
209
+ if not (
210
+ isinstance(rope_scaling_long_factor, list)
211
+ and all(isinstance(x, (int, float)) for x in rope_scaling_long_factor)
212
+ ):
213
+ raise ValueError(
214
+ f"`rope_scaling`'s long_factor field must be a list of numbers, got {rope_scaling_long_factor}"
215
+ )
216
+ if not len(rope_scaling_long_factor) == rotary_ndims // 2:
217
+ raise ValueError(
218
+ f"`rope_scaling`'s long_factor field must have length {rotary_ndims // 2}, got {len(rope_scaling_long_factor)}"
219
+ )
generation_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 199999,
4
+ "eos_token_id": 200020,
5
+ "max_length": 131072,
6
+ "pad_token_id": 200029,
7
+ "transformers_version": "4.49.0"
8
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4b3bf98272046c8d9cc97882b1d25438f8d3bf6680612e6c14c275c5b7793fd4
3
+ size 3227717993
model.safetensors.index.json ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 7672043520
4
+ },
5
+ "weight_map": {
6
+ "model.embed_tokens.weight": "model-00001-of-00002.safetensors",
7
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00002.safetensors",
8
+ "model.layers.0.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
9
+ "model.layers.0.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
10
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
11
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
12
+ "model.layers.0.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
13
+ "model.layers.1.input_layernorm.weight": "model-00001-of-00002.safetensors",
14
+ "model.layers.1.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
15
+ "model.layers.1.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
16
+ "model.layers.1.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
17
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
18
+ "model.layers.1.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
19
+ "model.layers.10.input_layernorm.weight": "model-00001-of-00002.safetensors",
20
+ "model.layers.10.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
21
+ "model.layers.10.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
22
+ "model.layers.10.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
23
+ "model.layers.10.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
24
+ "model.layers.10.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
25
+ "model.layers.11.input_layernorm.weight": "model-00001-of-00002.safetensors",
26
+ "model.layers.11.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
27
+ "model.layers.11.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
28
+ "model.layers.11.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
29
+ "model.layers.11.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
30
+ "model.layers.11.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
31
+ "model.layers.12.input_layernorm.weight": "model-00001-of-00002.safetensors",
32
+ "model.layers.12.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
33
+ "model.layers.12.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
34
+ "model.layers.12.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
35
+ "model.layers.12.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
36
+ "model.layers.12.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
37
+ "model.layers.13.input_layernorm.weight": "model-00001-of-00002.safetensors",
38
+ "model.layers.13.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
39
+ "model.layers.13.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
40
+ "model.layers.13.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
41
+ "model.layers.13.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
42
+ "model.layers.13.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
43
+ "model.layers.14.input_layernorm.weight": "model-00001-of-00002.safetensors",
44
+ "model.layers.14.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
45
+ "model.layers.14.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
46
+ "model.layers.14.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
47
+ "model.layers.14.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
48
+ "model.layers.14.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
49
+ "model.layers.15.input_layernorm.weight": "model-00001-of-00002.safetensors",
50
+ "model.layers.15.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
51
+ "model.layers.15.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
52
+ "model.layers.15.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
53
+ "model.layers.15.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
54
+ "model.layers.15.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
55
+ "model.layers.16.input_layernorm.weight": "model-00001-of-00002.safetensors",
56
+ "model.layers.16.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
57
+ "model.layers.16.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
58
+ "model.layers.16.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
59
+ "model.layers.16.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
60
+ "model.layers.16.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
61
+ "model.layers.17.input_layernorm.weight": "model-00001-of-00002.safetensors",
62
+ "model.layers.17.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
63
+ "model.layers.17.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
64
+ "model.layers.17.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
65
+ "model.layers.17.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
66
+ "model.layers.17.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
67
+ "model.layers.18.input_layernorm.weight": "model-00002-of-00002.safetensors",
68
+ "model.layers.18.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
69
+ "model.layers.18.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
70
+ "model.layers.18.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
71
+ "model.layers.18.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
72
+ "model.layers.18.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
73
+ "model.layers.19.input_layernorm.weight": "model-00002-of-00002.safetensors",
74
+ "model.layers.19.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
75
+ "model.layers.19.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
76
+ "model.layers.19.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
77
+ "model.layers.19.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
78
+ "model.layers.19.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
79
+ "model.layers.2.input_layernorm.weight": "model-00001-of-00002.safetensors",
80
+ "model.layers.2.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
81
+ "model.layers.2.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
82
+ "model.layers.2.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
83
+ "model.layers.2.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
84
+ "model.layers.2.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
85
+ "model.layers.20.input_layernorm.weight": "model-00002-of-00002.safetensors",
86
+ "model.layers.20.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
87
+ "model.layers.20.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
88
+ "model.layers.20.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
89
+ "model.layers.20.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
90
+ "model.layers.20.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
91
+ "model.layers.21.input_layernorm.weight": "model-00002-of-00002.safetensors",
92
+ "model.layers.21.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
93
+ "model.layers.21.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
94
+ "model.layers.21.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
95
+ "model.layers.21.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
96
+ "model.layers.21.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
97
+ "model.layers.22.input_layernorm.weight": "model-00002-of-00002.safetensors",
98
+ "model.layers.22.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
99
+ "model.layers.22.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
100
+ "model.layers.22.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
101
+ "model.layers.22.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
102
+ "model.layers.22.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
103
+ "model.layers.23.input_layernorm.weight": "model-00002-of-00002.safetensors",
104
+ "model.layers.23.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
105
+ "model.layers.23.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
106
+ "model.layers.23.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
107
+ "model.layers.23.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
108
+ "model.layers.23.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
109
+ "model.layers.24.input_layernorm.weight": "model-00002-of-00002.safetensors",
110
+ "model.layers.24.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
111
+ "model.layers.24.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
112
+ "model.layers.24.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
113
+ "model.layers.24.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
114
+ "model.layers.24.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
115
+ "model.layers.25.input_layernorm.weight": "model-00002-of-00002.safetensors",
116
+ "model.layers.25.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
117
+ "model.layers.25.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
118
+ "model.layers.25.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
119
+ "model.layers.25.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
120
+ "model.layers.25.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
121
+ "model.layers.26.input_layernorm.weight": "model-00002-of-00002.safetensors",
122
+ "model.layers.26.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
123
+ "model.layers.26.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
124
+ "model.layers.26.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
125
+ "model.layers.26.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
126
+ "model.layers.26.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
127
+ "model.layers.27.input_layernorm.weight": "model-00002-of-00002.safetensors",
128
+ "model.layers.27.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
129
+ "model.layers.27.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
130
+ "model.layers.27.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
131
+ "model.layers.27.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
132
+ "model.layers.27.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
133
+ "model.layers.28.input_layernorm.weight": "model-00002-of-00002.safetensors",
134
+ "model.layers.28.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
135
+ "model.layers.28.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
136
+ "model.layers.28.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
137
+ "model.layers.28.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
138
+ "model.layers.28.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
139
+ "model.layers.29.input_layernorm.weight": "model-00002-of-00002.safetensors",
140
+ "model.layers.29.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
141
+ "model.layers.29.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
142
+ "model.layers.29.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
143
+ "model.layers.29.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
144
+ "model.layers.29.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
145
+ "model.layers.3.input_layernorm.weight": "model-00001-of-00002.safetensors",
146
+ "model.layers.3.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
147
+ "model.layers.3.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
148
+ "model.layers.3.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
149
+ "model.layers.3.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
150
+ "model.layers.3.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
151
+ "model.layers.30.input_layernorm.weight": "model-00002-of-00002.safetensors",
152
+ "model.layers.30.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
153
+ "model.layers.30.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
154
+ "model.layers.30.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
155
+ "model.layers.30.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
156
+ "model.layers.30.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
157
+ "model.layers.31.input_layernorm.weight": "model-00002-of-00002.safetensors",
158
+ "model.layers.31.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
159
+ "model.layers.31.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
160
+ "model.layers.31.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
161
+ "model.layers.31.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
162
+ "model.layers.31.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
163
+ "model.layers.4.input_layernorm.weight": "model-00001-of-00002.safetensors",
164
+ "model.layers.4.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
165
+ "model.layers.4.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
166
+ "model.layers.4.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
167
+ "model.layers.4.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
168
+ "model.layers.4.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
169
+ "model.layers.5.input_layernorm.weight": "model-00001-of-00002.safetensors",
170
+ "model.layers.5.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
171
+ "model.layers.5.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
172
+ "model.layers.5.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
173
+ "model.layers.5.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
174
+ "model.layers.5.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
175
+ "model.layers.6.input_layernorm.weight": "model-00001-of-00002.safetensors",
176
+ "model.layers.6.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
177
+ "model.layers.6.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
178
+ "model.layers.6.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
179
+ "model.layers.6.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
180
+ "model.layers.6.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
181
+ "model.layers.7.input_layernorm.weight": "model-00001-of-00002.safetensors",
182
+ "model.layers.7.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
183
+ "model.layers.7.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
184
+ "model.layers.7.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
185
+ "model.layers.7.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
186
+ "model.layers.7.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
187
+ "model.layers.8.input_layernorm.weight": "model-00001-of-00002.safetensors",
188
+ "model.layers.8.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
189
+ "model.layers.8.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
190
+ "model.layers.8.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
191
+ "model.layers.8.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
192
+ "model.layers.8.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
193
+ "model.layers.9.input_layernorm.weight": "model-00001-of-00002.safetensors",
194
+ "model.layers.9.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
195
+ "model.layers.9.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
196
+ "model.layers.9.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
197
+ "model.layers.9.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
198
+ "model.layers.9.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
199
+ "model.norm.weight": "model-00002-of-00002.safetensors"
200
+ }
201
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|endoftext|>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": "<|end|>",
10
+ "pad_token": "<|PAD▁TOKEN|>",
11
+ "unk_token": "�"
12
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37b10016a39382ff2d24acc20a291ed83243a26c4549ab01f6240e72c6291d56
3
+ size 15524472
tokenizer_config.json ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_eos_token": false,
4
+ "add_prefix_space": false,
5
+ "added_tokens_decoder": {
6
+ "3251": {
7
+ "content": "�",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "199999": {
15
+ "content": "<|endoftext|>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": true
21
+ },
22
+ "200018": {
23
+ "content": "<|endofprompt|>",
24
+ "lstrip": false,
25
+ "normalized": false,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": true
29
+ },
30
+ "200019": {
31
+ "content": "<|assistant|>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": true,
35
+ "single_word": false,
36
+ "special": true
37
+ },
38
+ "200020": {
39
+ "content": "<|end|>",
40
+ "lstrip": false,
41
+ "normalized": false,
42
+ "rstrip": true,
43
+ "single_word": false,
44
+ "special": true
45
+ },
46
+ "200021": {
47
+ "content": "<|user|>",
48
+ "lstrip": false,
49
+ "normalized": false,
50
+ "rstrip": true,
51
+ "single_word": false,
52
+ "special": true
53
+ },
54
+ "200022": {
55
+ "content": "<|system|>",
56
+ "lstrip": false,
57
+ "normalized": false,
58
+ "rstrip": true,
59
+ "single_word": false,
60
+ "special": true
61
+ },
62
+ "200023": {
63
+ "content": "<|tool|>",
64
+ "lstrip": false,
65
+ "normalized": false,
66
+ "rstrip": true,
67
+ "single_word": false,
68
+ "special": false
69
+ },
70
+ "200024": {
71
+ "content": "<|/tool|>",
72
+ "lstrip": false,
73
+ "normalized": false,
74
+ "rstrip": true,
75
+ "single_word": false,
76
+ "special": false
77
+ },
78
+ "200025": {
79
+ "content": "<|tool_call|>",
80
+ "lstrip": false,
81
+ "normalized": false,
82
+ "rstrip": true,
83
+ "single_word": false,
84
+ "special": false
85
+ },
86
+ "200026": {
87
+ "content": "<|/tool_call|>",
88
+ "lstrip": false,
89
+ "normalized": false,
90
+ "rstrip": true,
91
+ "single_word": false,
92
+ "special": false
93
+ },
94
+ "200027": {
95
+ "content": "<|tool_response|>",
96
+ "lstrip": false,
97
+ "normalized": false,
98
+ "rstrip": true,
99
+ "single_word": false,
100
+ "special": false
101
+ },
102
+ "200028": {
103
+ "content": "<|tag|>",
104
+ "lstrip": false,
105
+ "normalized": false,
106
+ "rstrip": true,
107
+ "single_word": false,
108
+ "special": true
109
+ },
110
+ "200029": {
111
+ "content": "<|PAD▁TOKEN|>",
112
+ "lstrip": false,
113
+ "normalized": false,
114
+ "rstrip": false,
115
+ "single_word": false,
116
+ "special": true
117
+ }
118
+ },
119
+ "bos_token": "<|endoftext|>",
120
+ "chat_template": "{% for message in messages %}{% if message['role'] == 'system' and 'tools' in message and message['tools'] is not none %}{{ '<|' + message['role'] + '|>' + message['content'] + '<|tool|>' + message['tools'] + '<|/tool|>' + '<|end|>' }}{% else %}{{ '<|' + message['role'] + '|>' + message['content'] + '<|end|>' }}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '<|assistant|>' }}{% endif %}",
121
+ "clean_up_tokenization_spaces": false,
122
+ "eos_token": "<|end|>",
123
+ "extra_special_tokens": {},
124
+ "model_max_length": 131072,
125
+ "pad_token": "<|PAD▁TOKEN|>",
126
+ "padding_side": "left",
127
+ "tokenizer_class": "GPT2Tokenizer",
128
+ "unk_token": "�"
129
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff