Upload 15 files
Browse files- README.md +292 -3
- added_tokens.json +13 -0
- config.json +35 -0
- generation_config.json +11 -0
- model.yaml +10 -0
- openvino_detokenizer.bin +3 -0
- openvino_detokenizer.xml +97 -0
- openvino_model.bin +3 -0
- openvino_model.xml +0 -0
- openvino_tokenizer.bin +3 -0
- openvino_tokenizer.xml +231 -0
- special_tokens_map.json +30 -0
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +130 -0
README.md
CHANGED
@@ -1,3 +1,292 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
license_link: https://huggingface.co/microsoft/Phi-3-medium-4k-instruct/resolve/main/LICENSE
|
4 |
+
|
5 |
+
language:
|
6 |
+
- multilingual
|
7 |
+
pipeline_tag: text-generation
|
8 |
+
tags:
|
9 |
+
- nlp
|
10 |
+
- code
|
11 |
+
inference:
|
12 |
+
parameters:
|
13 |
+
temperature: 0.7
|
14 |
+
widget:
|
15 |
+
- messages:
|
16 |
+
- role: user
|
17 |
+
content: Can you provide ways to eat combinations of bananas and dragonfruits?
|
18 |
+
---
|
19 |
+
|
20 |
+
|
21 |
+
# OpenVINO IR model with int8 quantization
|
22 |
+
|
23 |
+
Model definition for LocalAI:
|
24 |
+
```
|
25 |
+
name: phi3-medium
|
26 |
+
backend: transformers
|
27 |
+
parameters:
|
28 |
+
model: fakezeta/Phi-3-medium-4k-instruct-ov-int4
|
29 |
+
context_size: 4096
|
30 |
+
trust_remote_code: true
|
31 |
+
type: OVModelForCausalLM
|
32 |
+
template:
|
33 |
+
use_tokenizer_template: true
|
34 |
+
```
|
35 |
+
|
36 |
+
To run the model directly with LocalAI:
|
37 |
+
```
|
38 |
+
local-ai run huggingface://fakezeta/Phi-3-medium-4k-instruct-ov-int4/model.yaml
|
39 |
+
```
|
40 |
+
|
41 |
+
## Model Summary
|
42 |
+
|
43 |
+
The Phi-3-Medium-4K-Instruct is a 14B parameters, lightweight, state-of-the-art open model trained with the Phi-3 datasets that includes both synthetic data and the filtered publicly available websites data with a focus on high-quality and reasoning dense properties.
|
44 |
+
The model belongs to the Phi-3 family with the Medium version in two variants [4K](https://huggingface.co/microsoft/Phi-3-medium-4k-instruct) and [128K](https://huggingface.co/microsoft/Phi-3-medium-128k-instruct) which is the context length (in tokens) that it can support.
|
45 |
+
|
46 |
+
The model has underwent a post-training process that incorporates both supervised fine-tuning and direct preference optimization for the instruction following and safety measures.
|
47 |
+
When assessed against benchmarks testing common sense, language understanding, math, code, long context and logical reasoning, Phi-3-Medium-4K-Instruct showcased a robust and state-of-the-art performance among models of the same-size and next-size-up.
|
48 |
+
|
49 |
+
Resources and Technical Documentation:
|
50 |
+
|
51 |
+
+ [Phi-3 Microsoft Blog](https://aka.ms/Phi-3Build2024)
|
52 |
+
+ [Phi-3 Technical Report](https://aka.ms/phi3-tech-report)
|
53 |
+
+ [Phi-3 on Azure AI Studio](https://aka.ms/phi3-azure-ai)
|
54 |
+
+ [Phi-3 Cookbook](https://github.com/microsoft/Phi-3CookBook)
|
55 |
+
|
56 |
+
| | Short Context | Long Context |
|
57 |
+
| ------- | ------------- | ------------ |
|
58 |
+
| Mini | 4K [[HF]](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct) ; [[ONNX]](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct-onnx) ; [[GGUF]](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct-gguf) | 128K [[HF]](https://huggingface.co/microsoft/Phi-3-mini-128k-instruct) ; [[ONNX]](https://huggingface.co/microsoft/Phi-3-mini-128k-instruct-onnx)|
|
59 |
+
| Small | 8K [[HF]](https://huggingface.co/microsoft/Phi-3-small-8k-instruct) ; [[ONNX]](https://huggingface.co/microsoft/Phi-3-small-8k-instruct-onnx-cuda) | 128K [[HF]](https://huggingface.co/microsoft/Phi-3-small-128k-instruct) ; [[ONNX]](https://huggingface.co/microsoft/Phi-3-small-128k-instruct-onnx-cuda)|
|
60 |
+
| Medium | 4K [[HF]](https://huggingface.co/microsoft/Phi-3-medium-4k-instruct) ; [[ONNX]](https://huggingface.co/microsoft/Phi-3-medium-4k-instruct-onnx-cuda) | 128K [[HF]](https://huggingface.co/microsoft/Phi-3-medium-128k-instruct) ; [[ONNX]](https://huggingface.co/microsoft/Phi-3-medium-128k-instruct-onnx-cuda)|
|
61 |
+
| Vision | | 128K [[HF]](https://huggingface.co/microsoft/Phi-3-vision-128k-instruct)|
|
62 |
+
|
63 |
+
## Intended Uses
|
64 |
+
|
65 |
+
**Primary use cases**
|
66 |
+
|
67 |
+
The model is intended for broad commercial and research use in English. The model provides uses for general purpose AI systems and applications which require:
|
68 |
+
|
69 |
+
1) Memory/compute constrained environments
|
70 |
+
2) Latency bound scenarios
|
71 |
+
3) Strong reasoning (especially code, math and logic)
|
72 |
+
|
73 |
+
Our model is designed to accelerate research on language and multimodal models, for use as a building block for generative AI powered features.
|
74 |
+
|
75 |
+
**Use case considerations**
|
76 |
+
|
77 |
+
Our models are not specifically designed or evaluated for all downstream purposes. Developers should consider common limitations of language models as they select use cases, and evaluate and mitigate for accuracy, safety, and fariness before using within a specific downstream use case, particularly for high risk scenarios. Developers should be aware of and adhere to applicable laws or regulations (including privacy, trade compliance laws, etc.) that are relevant to their use case.
|
78 |
+
|
79 |
+
Nothing contained in this Model Card should be interpreted as or deemed a restriction or modification to the license the model is released under.
|
80 |
+
|
81 |
+
## How to Use
|
82 |
+
|
83 |
+
Phi-3-Medium-4K-Instruct has been integrated in the development version (4.40.2) of `transformers`. Until the official version is released through `pip`, ensure that you are doing one of the following:
|
84 |
+
* When loading the model, ensure that `trust_remote_code=True` is passed as an argument of the `from_pretrained()` function.
|
85 |
+
|
86 |
+
* Update your local `transformers` to the development version: `pip uninstall -y transformers && pip install git+https://github.com/huggingface/transformers`. The previous command is an alternative to cloning and installing from the source.
|
87 |
+
|
88 |
+
The current `transformers` version can be verified with: `pip list | grep transformers`.
|
89 |
+
|
90 |
+
Phi-3-Medium-4K-Instruct is also available in [Azure AI Studio](https://aka.ms/phi3-azure-ai).
|
91 |
+
|
92 |
+
### Tokenizer
|
93 |
+
|
94 |
+
Phi-3-Medium-4K-Instruct supports a vocabulary size of up to `32064` tokens. The [tokenizer files](https://huggingface.co/microsoft/Phi-3-medium-4k-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.
|
95 |
+
|
96 |
+
### Chat Format
|
97 |
+
|
98 |
+
Given the nature of the training data, the Phi-3-Medium-4K-Instruct model is best suited for prompts using the chat format as follows.
|
99 |
+
You can provide the prompt as a question with a generic template as follow:
|
100 |
+
```markdown
|
101 |
+
<|user|>\nQuestion <|end|>\n<|assistant|>
|
102 |
+
```
|
103 |
+
For example:
|
104 |
+
```markdown
|
105 |
+
<|user|>
|
106 |
+
How to explain Internet for a medieval knight?<|end|>
|
107 |
+
<|assistant|>
|
108 |
+
```
|
109 |
+
|
110 |
+
where the model generates the text after `<|assistant|>` . In case of few-shots prompt, the prompt can be formatted as the following:
|
111 |
+
|
112 |
+
```markdown
|
113 |
+
<|user|>
|
114 |
+
I am going to Paris, what should I see?<|end|>
|
115 |
+
<|assistant|>
|
116 |
+
Paris, the capital of France, is known for its stunning architecture, art museums, historical landmarks, and romantic atmosphere. Here are some of the top attractions to see in Paris:\n\n1. The Eiffel Tower: The iconic Eiffel Tower is one of the most recognizable landmarks in the world and offers breathtaking views of the city.\n2. The Louvre Museum: The Louvre is one of the world's largest and most famous museums, housing an impressive collection of art and artifacts, including the Mona Lisa.\n3. Notre-Dame Cathedral: This beautiful cathedral is one of the most famous landmarks in Paris and is known for its Gothic architecture and stunning stained glass windows.\n\nThese are just a few of the many attractions that Paris has to offer. With so much to see and do, it's no wonder that Paris is one of the most popular tourist destinations in the world."<|end|>
|
117 |
+
<|user|>
|
118 |
+
What is so great about #1?<|end|>
|
119 |
+
<|assistant|>
|
120 |
+
```
|
121 |
+
|
122 |
+
### Sample inference code
|
123 |
+
|
124 |
+
This code snippets show how to get quickly started with running the model on a GPU:
|
125 |
+
|
126 |
+
```python
|
127 |
+
import torch
|
128 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
129 |
+
|
130 |
+
torch.random.manual_seed(0)
|
131 |
+
model_id = "microsoft/Phi-3-medium-4k-instruct"
|
132 |
+
model = AutoModelForCausalLM.from_pretrained(
|
133 |
+
model_id,
|
134 |
+
device_map="cuda",
|
135 |
+
torch_dtype="auto",
|
136 |
+
trust_remote_code=True,
|
137 |
+
)
|
138 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
139 |
+
|
140 |
+
messages = [
|
141 |
+
{"role": "user", "content": "Can you provide ways to eat combinations of bananas and dragonfruits?"},
|
142 |
+
{"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."},
|
143 |
+
{"role": "user", "content": "What about solving an 2x + 3 = 7 equation?"},
|
144 |
+
]
|
145 |
+
|
146 |
+
pipe = pipeline(
|
147 |
+
"text-generation",
|
148 |
+
model=model,
|
149 |
+
tokenizer=tokenizer,
|
150 |
+
)
|
151 |
+
|
152 |
+
generation_args = {
|
153 |
+
"max_new_tokens": 500,
|
154 |
+
"return_full_text": False,
|
155 |
+
"temperature": 0.0,
|
156 |
+
"do_sample": False,
|
157 |
+
}
|
158 |
+
|
159 |
+
output = pipe(messages, **generation_args)
|
160 |
+
print(output[0]['generated_text'])
|
161 |
+
```
|
162 |
+
|
163 |
+
*Some applications/frameworks might not include a BOS token (`<s>`) at the start of the conversation. Please ensure that it is included since it provides more reliable results.*
|
164 |
+
|
165 |
+
## Responsible AI Considerations
|
166 |
+
|
167 |
+
Like other language models, the Phi series models can potentially behave in ways that are unfair, unreliable, or offensive. Some of the limiting behaviors to be aware of include:
|
168 |
+
|
169 |
+
+ Quality of Service: the Phi models are trained primarily on English text. Languages other than English will experience worse performance. English language varieties with less representation in the training data might experience worse performance than standard American English.
|
170 |
+
+ 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 or prevalence of examples of negative stereotypes in training data that reflect real-world patterns and societal biases.
|
171 |
+
+ 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 use case.
|
172 |
+
+ Information Reliability: Language models can generate nonsensical content or fabricate content that might sound reasonable but is inaccurate or outdated.
|
173 |
+
+ Limited Scope for Code: Majority of Phi-3 training data is based in Python and use 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, we strongly recommend users manually verify all API uses.
|
174 |
+
|
175 |
+
Developers should apply responsible AI best practices and are responsible for ensuring that a specific use case complies with relevant laws and regulations (e.g. privacy, trade, etc.). Important areas for consideration include:
|
176 |
+
|
177 |
+
+ 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.
|
178 |
+
+ High-Risk Scenarios: Developers should assess 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.
|
179 |
+
+ 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).
|
180 |
+
+ Generation of Harmful Content: Developers should assess outputs for their context and use available safety classifiers or custom solutions appropriate for their use case.
|
181 |
+
+ 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.
|
182 |
+
|
183 |
+
|
184 |
+
## Training
|
185 |
+
|
186 |
+
### Model
|
187 |
+
|
188 |
+
* Architecture: Phi-3-Medium-4K-Instruct has 14B parameters and is a dense decoder-only Transformer model. The model is fine-tuned with Supervised fine-tuning (SFT) and Direct Preference Optimization (DPO) to ensure alignment with human preferences and safety guidlines.
|
189 |
+
* Inputs: Text. It is best suited for prompts using chat format.
|
190 |
+
* Context length: 4K tokens
|
191 |
+
* GPUs: 512 H100-80G
|
192 |
+
* Training time: 42 days
|
193 |
+
* Training data: 4.8T tokens
|
194 |
+
* Outputs: Generated text in response to the input
|
195 |
+
* Dates: Our models were trained between February and April 2024
|
196 |
+
* Status: This is a static model trained on an offline dataset with cutoff date October 2023. Future versions of the tuned models may be released as we improve models.
|
197 |
+
* Release dates: The model weight is released on May 21, 2024.
|
198 |
+
|
199 |
+
### Datasets
|
200 |
+
|
201 |
+
Our training data includes a wide variety of sources, totaling 4.8 trillion tokens (including 10% multilingual), and is a combination of
|
202 |
+
1) Publicly available documents filtered rigorously for quality, selected high-quality educational data, and code;
|
203 |
+
2) Newly created synthetic, “textbook-like” data for the purpose of teaching math, coding, common sense reasoning, general knowledge of the world (science, daily activities, theory of mind, etc.);
|
204 |
+
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.
|
205 |
+
|
206 |
+
We are focusing on the quality of data that could potentially improve the reasoning ability for the model, and we filter the publicly available documents to contain the correct level of knowledge. As an example, the result of a game in premier league in a particular day might be good training data for frontier models, but we need to remove such information to leave more model capacity for reasoning for the small size models. More details about data can be found in the [Phi-3 Technical Report](https://aka.ms/phi3-tech-report).
|
207 |
+
|
208 |
+
## Benchmarks
|
209 |
+
|
210 |
+
We report the results for Phi-3-Medium-4K-Instruct on standard open-source benchmarks measuring the model's reasoning ability (both common sense reasoning and logical reasoning). We compare to Mixtral-8x22b, Gemini-Pro, Command R+ 104B, Llama-3-70B-Instruct, GPT-3.5-Turbo-1106, and GPT-4-Turbo-1106(Chat).
|
211 |
+
|
212 |
+
All the reported numbers are produced with the exact same pipeline to ensure that the numbers are comparable. These numbers might differ from other published numbers due to slightly different choices in the evaluation.
|
213 |
+
|
214 |
+
As is now standard, we use few-shot prompts to evaluate the models, at temperature 0.
|
215 |
+
The prompts and number of shots are part of a Microsoft internal tool to evaluate language models, and in particular we did no optimization to the pipeline for Phi-3.
|
216 |
+
More specifically, we do not change prompts, pick different few-shot examples, change prompt format, or do any other form of optimization for the model.
|
217 |
+
|
218 |
+
The number of k–shot examples is listed per-benchmark.
|
219 |
+
|
220 |
+
|Benchmark|Phi-3-Medium-4K-Instruct<br>14b|Command R+<br>104B|Mixtral<br>8x22B|Llama-3-70B-Instruct|GPT3.5-Turbo<br>version 1106|Gemini<br>Pro|GPT-4-Turbo<br>version 1106 (Chat)|
|
221 |
+
|---------|-----------------------|--------|-------------|-------------------|-------------------|----------|------------------------|
|
222 |
+
|AGI Eval<br>5-shot|50.2|50.1|54.0|56.9|48.4|49.0|59.6|
|
223 |
+
|MMLU<br>5-shot|78.0|73.8|76.2|80.2|71.4|66.7|84.0|
|
224 |
+
|BigBench Hard<br>3-shot|81.4|74.1|81.8|80.4|68.3|75.6|87.7|
|
225 |
+
|ANLI<br>7-shot|55.8|63.4|65.2|68.3|58.1|64.2|71.7|
|
226 |
+
|HellaSwag<br>5-shot|82.4|78.0|79.0|82.6|78.8|76.2|88.3|
|
227 |
+
|ARC Challenge<br>10-shot|91.6|86.9|91.3|93.0|87.4|88.3|95.6|
|
228 |
+
|ARC Easy<br>10-shot|97.7|95.7|96.9|98.2|96.3|96.1|98.8|
|
229 |
+
|BoolQ<br>2-shot|86.5|86.1|82.7|89.1|79.1|86.4|91.3|
|
230 |
+
|CommonsenseQA<br>10-shot|82.8|82.0|82.0|84.4|79.6|81.8|86.7|
|
231 |
+
|MedQA<br>2-shot|69.9|59.2|67.9|78.5|63.4|58.2|83.7|
|
232 |
+
|OpenBookQA<br>10-shot|87.4|86.8|88.6|91.8|86.0|86.4|93.4|
|
233 |
+
|PIQA<br>5-shot|87.9|86.4|85.0|85.3|86.6|86.2|90.1|
|
234 |
+
|Social IQA<br>5-shot|80.2|75.3|78.2|81.1|68.3|75.4|81.7|
|
235 |
+
|TruthfulQA (MC2)<br>10-shot|75.1|57.8|67.4|81.9|67.7|72.6|85.2|
|
236 |
+
|WinoGrande<br>5-shot|81.5|77.0|75.3|83.3|68.8|72.2|86.7|
|
237 |
+
|TriviaQA<br>5-shot|73.9|82.8|84.5|78.5|85.8|80.2|73.3|
|
238 |
+
|GSM8K Chain of Thought<br>8-shot|91.0|78.3|83.8|93.5|78.1|80.4|94.2|
|
239 |
+
|HumanEval<br>0-shot|62.2|61.6|39.6|78.7|62.2|64.4|79.9|
|
240 |
+
|MBPP<br>3-shot|75.2|68.9|70.7|81.3|77.8|73.2|86.7|
|
241 |
+
|Average|78.5|75.0|76.3|82.5|74.3|75.4|85.2|
|
242 |
+
|
243 |
+
We take a closer look at different categories across 80 public benchmark datasets at the table below:
|
244 |
+
|
245 |
+
|Benchmark|Phi-3-Medium-4K-Instruct<br>14b|Command R+<br>104B|Mixtral<br>8x22B|Llama-3-70B-Instruct|GPT3.5-Turbo<br>version 1106|Gemini<br>Pro|GPT-4-Turbo<br>version 1106 (Chat)|
|
246 |
+
|--------|------------------------|--------|-------------|-------------------|-------------------|----------|------------------------|
|
247 |
+
|Popular aggregated benchmark|75.4|69.9|73.4|76.3|67.0|67.5|80.5|
|
248 |
+
|Reasoning|84.1|79.3|81.5|86.7|78.3|80.4|89.3|
|
249 |
+
|Language understanding|73.9|75.6|78.1|76.9|68.7|76.2|80.7|
|
250 |
+
|Code generation|66.1|68.6|60.0|69.3|70.4|66.7|76.1|
|
251 |
+
|Math|52.8|45.3|52.5|59.7|52.8|50.9|67.1|
|
252 |
+
|Factual knowledge|48.3|60.3|60.6|52.4|63.4|54.6|45.9|
|
253 |
+
|Multilingual|62.9|67.8|69.8|62.0|67.0|73.4|78.2|
|
254 |
+
|Robustness|66.5|57.9|65.5|78.7|69.3|69.7|84.6|
|
255 |
+
|
256 |
+
|
257 |
+
## Software
|
258 |
+
|
259 |
+
* [PyTorch](https://github.com/pytorch/pytorch)
|
260 |
+
* [DeepSpeed](https://github.com/microsoft/DeepSpeed)
|
261 |
+
* [Transformers](https://github.com/huggingface/transformers)
|
262 |
+
* [Flash-Attention](https://github.com/HazyResearch/flash-attention)
|
263 |
+
|
264 |
+
## Hardware
|
265 |
+
Note that by default, the Phi-3-Medium model uses flash attention, which requires certain types of GPU hardware to run. We have tested on the following GPU types:
|
266 |
+
* NVIDIA A100
|
267 |
+
* NVIDIA A6000
|
268 |
+
* NVIDIA H100
|
269 |
+
|
270 |
+
If you want to run the model on:
|
271 |
+
+ Optimized inference on GPU, CPU, and Mobile: use the **ONNX** models [4K](https://huggingface.co/microsoft/Phi-3-medium-4k-instruct-onnx-cuda)
|
272 |
+
|
273 |
+
## Cross Platform Support
|
274 |
+
|
275 |
+
ONNX runtime ecosystem now supports Phi3 Medium models across platforms and hardware.
|
276 |
+
Optimized phi-3 models are also published here in ONNX format, to run with ONNX Runtime on CPU and GPU across devices, including server platforms, Windows, Linux and Mac desktops, and mobile CPUs, with the precision best suited to each of these targets. DirectML GPU acceleration is supported for Windows desktops GPUs (AMD, Intel, and NVIDIA).
|
277 |
+
Along with DML, ONNX Runtime provides cross platform support for Phi3 Medium across a range of devices CPU, GPU, and mobile.
|
278 |
+
Here are some of the optimized configurations we have added:
|
279 |
+
|
280 |
+
|
281 |
+
1. ONNX models for int4 DML: Quantized to int4 via AWQ
|
282 |
+
2. ONNX model for fp16 CUDA
|
283 |
+
3. ONNX model for int4 CUDA: Quantized to int4 via RTN
|
284 |
+
4. ONNX model for int4 CPU and Mobile: Quantized to int4 via RTN
|
285 |
+
|
286 |
+
## License
|
287 |
+
|
288 |
+
The model is licensed under the [MIT license](https://huggingface.co/microsoft/Phi-3-medium-4k/resolve/main/LICENSE).
|
289 |
+
|
290 |
+
## Trademarks
|
291 |
+
|
292 |
+
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.
|
added_tokens.json
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"<|assistant|>": 32001,
|
3 |
+
"<|endoftext|>": 32000,
|
4 |
+
"<|end|>": 32007,
|
5 |
+
"<|placeholder1|>": 32002,
|
6 |
+
"<|placeholder2|>": 32003,
|
7 |
+
"<|placeholder3|>": 32004,
|
8 |
+
"<|placeholder4|>": 32005,
|
9 |
+
"<|placeholder5|>": 32008,
|
10 |
+
"<|placeholder6|>": 32009,
|
11 |
+
"<|system|>": 32006,
|
12 |
+
"<|user|>": 32010
|
13 |
+
}
|
config.json
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "microsoft/Phi-3-medium-4k-instruct",
|
3 |
+
"architectures": [
|
4 |
+
"Phi3ForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_bias": false,
|
7 |
+
"attention_dropout": 0.0,
|
8 |
+
"auto_map": {
|
9 |
+
"AutoConfig": "microsoft/Phi-3-medium-4k-instruct--configuration_phi3.Phi3Config",
|
10 |
+
"AutoModelForCausalLM": "microsoft/Phi-3-medium-4k-instruct--modeling_phi3.Phi3ForCausalLM"
|
11 |
+
},
|
12 |
+
"bos_token_id": 1,
|
13 |
+
"embd_pdrop": 0.0,
|
14 |
+
"eos_token_id": 32000,
|
15 |
+
"hidden_act": "silu",
|
16 |
+
"hidden_size": 5120,
|
17 |
+
"initializer_range": 0.02,
|
18 |
+
"intermediate_size": 17920,
|
19 |
+
"max_position_embeddings": 4096,
|
20 |
+
"model_type": "phi3",
|
21 |
+
"num_attention_heads": 40,
|
22 |
+
"num_hidden_layers": 40,
|
23 |
+
"num_key_value_heads": 10,
|
24 |
+
"original_max_position_embeddings": 4096,
|
25 |
+
"pad_token_id": 32000,
|
26 |
+
"resid_pdrop": 0.0,
|
27 |
+
"rms_norm_eps": 1e-05,
|
28 |
+
"rope_scaling": null,
|
29 |
+
"rope_theta": 10000.0,
|
30 |
+
"sliding_window": 2047,
|
31 |
+
"tie_word_embeddings": false,
|
32 |
+
"transformers_version": "4.40.2",
|
33 |
+
"use_cache": true,
|
34 |
+
"vocab_size": 32064
|
35 |
+
}
|
generation_config.json
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 1,
|
4 |
+
"eos_token_id": [
|
5 |
+
32000,
|
6 |
+
32001,
|
7 |
+
32007
|
8 |
+
],
|
9 |
+
"pad_token_id": 32000,
|
10 |
+
"transformers_version": "4.40.2"
|
11 |
+
}
|
model.yaml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: phi3-medium
|
2 |
+
backend: transformers
|
3 |
+
parameters:
|
4 |
+
model: fakezeta/Phi-3-medium-4k-instruct-ov-int4
|
5 |
+
context_size: 4096
|
6 |
+
trust_remote_code: true
|
7 |
+
type: OVModelForCausalLM
|
8 |
+
template:
|
9 |
+
use_tokenizer_template: true
|
10 |
+
|
openvino_detokenizer.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e1f06b61953c9af7ee2a9b4ba718b2233dc3ec25c64074ba80cdd6a842d18801
|
3 |
+
size 499969
|
openvino_detokenizer.xml
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<net name="detokenizer" version="11">
|
3 |
+
<layers>
|
4 |
+
<layer id="0" name="Parameter_305146" type="Parameter" version="opset1">
|
5 |
+
<data shape="?,?" element_type="i64" />
|
6 |
+
<output>
|
7 |
+
<port id="0" precision="I64" names="Parameter_305146">
|
8 |
+
<dim>-1</dim>
|
9 |
+
<dim>-1</dim>
|
10 |
+
</port>
|
11 |
+
</output>
|
12 |
+
</layer>
|
13 |
+
<layer id="1" name="Constant_305126" type="Const" version="opset1">
|
14 |
+
<data element_type="u8" shape="499969" offset="0" size="499969" />
|
15 |
+
<output>
|
16 |
+
<port id="0" precision="U8">
|
17 |
+
<dim>499969</dim>
|
18 |
+
</port>
|
19 |
+
</output>
|
20 |
+
</layer>
|
21 |
+
<layer id="2" name="Convert_305156" type="Convert" version="opset1">
|
22 |
+
<data destination_type="i32" />
|
23 |
+
<input>
|
24 |
+
<port id="0" precision="I64">
|
25 |
+
<dim>-1</dim>
|
26 |
+
<dim>-1</dim>
|
27 |
+
</port>
|
28 |
+
</input>
|
29 |
+
<output>
|
30 |
+
<port id="1" precision="I32">
|
31 |
+
<dim>-1</dim>
|
32 |
+
<dim>-1</dim>
|
33 |
+
</port>
|
34 |
+
</output>
|
35 |
+
</layer>
|
36 |
+
<layer id="3" name="SentencepieceDetokenizer_305147" type="SentencepieceDetokenizer" version="extension">
|
37 |
+
<input>
|
38 |
+
<port id="0" precision="U8">
|
39 |
+
<dim>499969</dim>
|
40 |
+
</port>
|
41 |
+
<port id="1" precision="I32">
|
42 |
+
<dim>-1</dim>
|
43 |
+
<dim>-1</dim>
|
44 |
+
</port>
|
45 |
+
</input>
|
46 |
+
<output>
|
47 |
+
<port id="2" precision="I32">
|
48 |
+
<dim>-1</dim>
|
49 |
+
</port>
|
50 |
+
<port id="3" precision="I32">
|
51 |
+
<dim>-1</dim>
|
52 |
+
</port>
|
53 |
+
<port id="4" precision="U8">
|
54 |
+
<dim>-1</dim>
|
55 |
+
</port>
|
56 |
+
</output>
|
57 |
+
</layer>
|
58 |
+
<layer id="4" name="StringTensorPack_305148" type="StringTensorPack" version="extension">
|
59 |
+
<data mode="begins_ends" />
|
60 |
+
<input>
|
61 |
+
<port id="0" precision="I32">
|
62 |
+
<dim>-1</dim>
|
63 |
+
</port>
|
64 |
+
<port id="1" precision="I32">
|
65 |
+
<dim>-1</dim>
|
66 |
+
</port>
|
67 |
+
<port id="2" precision="U8">
|
68 |
+
<dim>-1</dim>
|
69 |
+
</port>
|
70 |
+
</input>
|
71 |
+
<output>
|
72 |
+
<port id="3" precision="STRING" names="string_output">
|
73 |
+
<dim>-1</dim>
|
74 |
+
</port>
|
75 |
+
</output>
|
76 |
+
</layer>
|
77 |
+
<layer id="5" name="Result_305149" type="Result" version="opset1">
|
78 |
+
<input>
|
79 |
+
<port id="0" precision="STRING">
|
80 |
+
<dim>-1</dim>
|
81 |
+
</port>
|
82 |
+
</input>
|
83 |
+
</layer>
|
84 |
+
</layers>
|
85 |
+
<edges>
|
86 |
+
<edge from-layer="0" from-port="0" to-layer="2" to-port="0" />
|
87 |
+
<edge from-layer="1" from-port="0" to-layer="3" to-port="0" />
|
88 |
+
<edge from-layer="2" from-port="1" to-layer="3" to-port="1" />
|
89 |
+
<edge from-layer="3" from-port="2" to-layer="4" to-port="0" />
|
90 |
+
<edge from-layer="3" from-port="3" to-layer="4" to-port="1" />
|
91 |
+
<edge from-layer="3" from-port="4" to-layer="4" to-port="2" />
|
92 |
+
<edge from-layer="4" from-port="3" to-layer="5" to-port="0" />
|
93 |
+
</edges>
|
94 |
+
<rt_info>
|
95 |
+
<eos_token_id value="32000" />
|
96 |
+
</rt_info>
|
97 |
+
</net>
|
openvino_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:75c7234ecd8d315982560596ff2b4db19d102b8185f4401a4ff2e961c8e67dc9
|
3 |
+
size 8729974868
|
openvino_model.xml
ADDED
The diff for this file is too large to render.
See raw diff
|
|
openvino_tokenizer.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:46097e0534935f1aec4cbac2c90e565ec51a8513fcd53b841231849403e5e122
|
3 |
+
size 499981
|
openvino_tokenizer.xml
ADDED
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<net name="tokenizer" version="11">
|
3 |
+
<layers>
|
4 |
+
<layer id="0" name="string_input" type="Parameter" version="opset1">
|
5 |
+
<data shape="?" element_type="string" />
|
6 |
+
<output>
|
7 |
+
<port id="0" precision="STRING" names="string_input">
|
8 |
+
<dim>-1</dim>
|
9 |
+
</port>
|
10 |
+
</output>
|
11 |
+
</layer>
|
12 |
+
<layer id="1" name="Constant_305132" type="Const" version="opset1">
|
13 |
+
<data element_type="i32" shape="" offset="0" size="4" />
|
14 |
+
<output>
|
15 |
+
<port id="0" precision="I32" />
|
16 |
+
</output>
|
17 |
+
</layer>
|
18 |
+
<layer id="2" name="Constant_305126" type="Const" version="opset1">
|
19 |
+
<data element_type="u8" shape="499969" offset="4" size="499969" />
|
20 |
+
<output>
|
21 |
+
<port id="0" precision="U8">
|
22 |
+
<dim>499969</dim>
|
23 |
+
</port>
|
24 |
+
</output>
|
25 |
+
</layer>
|
26 |
+
<layer id="3" name="SentencepieceTokenizer_305128" type="SentencepieceTokenizer" version="extension">
|
27 |
+
<data nbest_size="0" alpha="0" add_bos="false" add_eos="false" reverse="false" />
|
28 |
+
<input>
|
29 |
+
<port id="0" precision="U8">
|
30 |
+
<dim>499969</dim>
|
31 |
+
</port>
|
32 |
+
<port id="1" precision="STRING">
|
33 |
+
<dim>-1</dim>
|
34 |
+
</port>
|
35 |
+
</input>
|
36 |
+
<output>
|
37 |
+
<port id="2" precision="I64">
|
38 |
+
<dim>-1</dim>
|
39 |
+
<dim>2</dim>
|
40 |
+
</port>
|
41 |
+
<port id="3" precision="I32">
|
42 |
+
<dim>-1</dim>
|
43 |
+
</port>
|
44 |
+
<port id="4" precision="I64">
|
45 |
+
<dim>2</dim>
|
46 |
+
</port>
|
47 |
+
</output>
|
48 |
+
</layer>
|
49 |
+
<layer id="4" name="Broadcast_305133" type="Broadcast" version="opset3">
|
50 |
+
<data mode="numpy" />
|
51 |
+
<input>
|
52 |
+
<port id="0" precision="I32" />
|
53 |
+
<port id="1" precision="I64">
|
54 |
+
<dim>2</dim>
|
55 |
+
</port>
|
56 |
+
</input>
|
57 |
+
<output>
|
58 |
+
<port id="2" precision="I32">
|
59 |
+
<dim>-1</dim>
|
60 |
+
<dim>-1</dim>
|
61 |
+
</port>
|
62 |
+
</output>
|
63 |
+
</layer>
|
64 |
+
<layer id="5" name="Constant_305134" type="Const" version="opset1">
|
65 |
+
<data element_type="i32" shape="" offset="499973" size="4" />
|
66 |
+
<output>
|
67 |
+
<port id="0" precision="I32" />
|
68 |
+
</output>
|
69 |
+
</layer>
|
70 |
+
<layer id="6" name="ShapeOf_305135" type="ShapeOf" version="opset3">
|
71 |
+
<data output_type="i64" />
|
72 |
+
<input>
|
73 |
+
<port id="0" precision="I32">
|
74 |
+
<dim>-1</dim>
|
75 |
+
</port>
|
76 |
+
</input>
|
77 |
+
<output>
|
78 |
+
<port id="1" precision="I64">
|
79 |
+
<dim>1</dim>
|
80 |
+
</port>
|
81 |
+
</output>
|
82 |
+
</layer>
|
83 |
+
<layer id="7" name="Broadcast_305136" type="Broadcast" version="opset3">
|
84 |
+
<data mode="numpy" />
|
85 |
+
<input>
|
86 |
+
<port id="0" precision="I32" />
|
87 |
+
<port id="1" precision="I64">
|
88 |
+
<dim>1</dim>
|
89 |
+
</port>
|
90 |
+
</input>
|
91 |
+
<output>
|
92 |
+
<port id="2" precision="I32">
|
93 |
+
<dim>-1</dim>
|
94 |
+
</port>
|
95 |
+
</output>
|
96 |
+
</layer>
|
97 |
+
<layer id="8" name="ScatterNDUpdate_305140" type="ScatterNDUpdate" version="opset4">
|
98 |
+
<input>
|
99 |
+
<port id="0" precision="I32">
|
100 |
+
<dim>-1</dim>
|
101 |
+
<dim>-1</dim>
|
102 |
+
</port>
|
103 |
+
<port id="1" precision="I64">
|
104 |
+
<dim>-1</dim>
|
105 |
+
<dim>2</dim>
|
106 |
+
</port>
|
107 |
+
<port id="2" precision="I32">
|
108 |
+
<dim>-1</dim>
|
109 |
+
</port>
|
110 |
+
</input>
|
111 |
+
<output>
|
112 |
+
<port id="3" precision="I32">
|
113 |
+
<dim>-1</dim>
|
114 |
+
<dim>-1</dim>
|
115 |
+
</port>
|
116 |
+
</output>
|
117 |
+
</layer>
|
118 |
+
<layer id="9" name="ScatterNDUpdate_305140" type="Convert" version="opset1">
|
119 |
+
<data destination_type="i64" />
|
120 |
+
<input>
|
121 |
+
<port id="0" precision="I32">
|
122 |
+
<dim>-1</dim>
|
123 |
+
<dim>-1</dim>
|
124 |
+
</port>
|
125 |
+
</input>
|
126 |
+
<output>
|
127 |
+
<port id="1" precision="I64" names="attention_mask">
|
128 |
+
<dim>-1</dim>
|
129 |
+
<dim>-1</dim>
|
130 |
+
</port>
|
131 |
+
</output>
|
132 |
+
</layer>
|
133 |
+
<layer id="11" name="Constant_305129" type="Const" version="opset1">
|
134 |
+
<data element_type="i32" shape="" offset="499977" size="4" />
|
135 |
+
<output>
|
136 |
+
<port id="0" precision="I32" />
|
137 |
+
</output>
|
138 |
+
</layer>
|
139 |
+
<layer id="12" name="Broadcast_305130" type="Broadcast" version="opset3">
|
140 |
+
<data mode="numpy" />
|
141 |
+
<input>
|
142 |
+
<port id="0" precision="I32" />
|
143 |
+
<port id="1" precision="I64">
|
144 |
+
<dim>2</dim>
|
145 |
+
</port>
|
146 |
+
</input>
|
147 |
+
<output>
|
148 |
+
<port id="2" precision="I32">
|
149 |
+
<dim>-1</dim>
|
150 |
+
<dim>-1</dim>
|
151 |
+
</port>
|
152 |
+
</output>
|
153 |
+
</layer>
|
154 |
+
<layer id="13" name="ScatterNDUpdate_305131" type="ScatterNDUpdate" version="opset4">
|
155 |
+
<input>
|
156 |
+
<port id="0" precision="I32">
|
157 |
+
<dim>-1</dim>
|
158 |
+
<dim>-1</dim>
|
159 |
+
</port>
|
160 |
+
<port id="1" precision="I64">
|
161 |
+
<dim>-1</dim>
|
162 |
+
<dim>2</dim>
|
163 |
+
</port>
|
164 |
+
<port id="2" precision="I32">
|
165 |
+
<dim>-1</dim>
|
166 |
+
</port>
|
167 |
+
</input>
|
168 |
+
<output>
|
169 |
+
<port id="3" precision="I32">
|
170 |
+
<dim>-1</dim>
|
171 |
+
<dim>-1</dim>
|
172 |
+
</port>
|
173 |
+
</output>
|
174 |
+
</layer>
|
175 |
+
<layer id="14" name="ScatterNDUpdate_305131" type="Convert" version="opset1">
|
176 |
+
<data destination_type="i64" />
|
177 |
+
<input>
|
178 |
+
<port id="0" precision="I32">
|
179 |
+
<dim>-1</dim>
|
180 |
+
<dim>-1</dim>
|
181 |
+
</port>
|
182 |
+
</input>
|
183 |
+
<output>
|
184 |
+
<port id="1" precision="I64" names="input_ids">
|
185 |
+
<dim>-1</dim>
|
186 |
+
<dim>-1</dim>
|
187 |
+
</port>
|
188 |
+
</output>
|
189 |
+
</layer>
|
190 |
+
<layer id="15" name="Result_305141" type="Result" version="opset1">
|
191 |
+
<input>
|
192 |
+
<port id="0" precision="I64">
|
193 |
+
<dim>-1</dim>
|
194 |
+
<dim>-1</dim>
|
195 |
+
</port>
|
196 |
+
</input>
|
197 |
+
</layer>
|
198 |
+
<layer id="10" name="Result_305142" type="Result" version="opset1">
|
199 |
+
<input>
|
200 |
+
<port id="0" precision="I64">
|
201 |
+
<dim>-1</dim>
|
202 |
+
<dim>-1</dim>
|
203 |
+
</port>
|
204 |
+
</input>
|
205 |
+
</layer>
|
206 |
+
</layers>
|
207 |
+
<edges>
|
208 |
+
<edge from-layer="0" from-port="0" to-layer="3" to-port="1" />
|
209 |
+
<edge from-layer="1" from-port="0" to-layer="4" to-port="0" />
|
210 |
+
<edge from-layer="2" from-port="0" to-layer="3" to-port="0" />
|
211 |
+
<edge from-layer="3" from-port="4" to-layer="4" to-port="1" />
|
212 |
+
<edge from-layer="3" from-port="3" to-layer="6" to-port="0" />
|
213 |
+
<edge from-layer="3" from-port="2" to-layer="8" to-port="1" />
|
214 |
+
<edge from-layer="3" from-port="3" to-layer="13" to-port="2" />
|
215 |
+
<edge from-layer="3" from-port="2" to-layer="13" to-port="1" />
|
216 |
+
<edge from-layer="3" from-port="4" to-layer="12" to-port="1" />
|
217 |
+
<edge from-layer="4" from-port="2" to-layer="8" to-port="0" />
|
218 |
+
<edge from-layer="5" from-port="0" to-layer="7" to-port="0" />
|
219 |
+
<edge from-layer="6" from-port="1" to-layer="7" to-port="1" />
|
220 |
+
<edge from-layer="7" from-port="2" to-layer="8" to-port="2" />
|
221 |
+
<edge from-layer="8" from-port="3" to-layer="9" to-port="0" />
|
222 |
+
<edge from-layer="9" from-port="1" to-layer="10" to-port="0" />
|
223 |
+
<edge from-layer="11" from-port="0" to-layer="12" to-port="0" />
|
224 |
+
<edge from-layer="12" from-port="2" to-layer="13" to-port="0" />
|
225 |
+
<edge from-layer="13" from-port="3" to-layer="14" to-port="0" />
|
226 |
+
<edge from-layer="14" from-port="1" to-layer="15" to-port="0" />
|
227 |
+
</edges>
|
228 |
+
<rt_info>
|
229 |
+
<eos_token_id value="32000" />
|
230 |
+
</rt_info>
|
231 |
+
</net>
|
special_tokens_map.json
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": {
|
3 |
+
"content": "<s>",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": false,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"eos_token": {
|
10 |
+
"content": "<|endoftext|>",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": false,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"pad_token": {
|
17 |
+
"content": "<|endoftext|>",
|
18 |
+
"lstrip": false,
|
19 |
+
"normalized": false,
|
20 |
+
"rstrip": false,
|
21 |
+
"single_word": false
|
22 |
+
},
|
23 |
+
"unk_token": {
|
24 |
+
"content": "<unk>",
|
25 |
+
"lstrip": false,
|
26 |
+
"normalized": false,
|
27 |
+
"rstrip": false,
|
28 |
+
"single_word": false
|
29 |
+
}
|
30 |
+
}
|
tokenizer.json
ADDED
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:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347
|
3 |
+
size 499723
|
tokenizer_config.json
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": false,
|
3 |
+
"add_eos_token": false,
|
4 |
+
"added_tokens_decoder": {
|
5 |
+
"0": {
|
6 |
+
"content": "<unk>",
|
7 |
+
"lstrip": false,
|
8 |
+
"normalized": false,
|
9 |
+
"rstrip": false,
|
10 |
+
"single_word": false,
|
11 |
+
"special": true
|
12 |
+
},
|
13 |
+
"1": {
|
14 |
+
"content": "<s>",
|
15 |
+
"lstrip": false,
|
16 |
+
"normalized": false,
|
17 |
+
"rstrip": false,
|
18 |
+
"single_word": false,
|
19 |
+
"special": true
|
20 |
+
},
|
21 |
+
"2": {
|
22 |
+
"content": "</s>",
|
23 |
+
"lstrip": false,
|
24 |
+
"normalized": false,
|
25 |
+
"rstrip": true,
|
26 |
+
"single_word": false,
|
27 |
+
"special": false
|
28 |
+
},
|
29 |
+
"32000": {
|
30 |
+
"content": "<|endoftext|>",
|
31 |
+
"lstrip": false,
|
32 |
+
"normalized": false,
|
33 |
+
"rstrip": false,
|
34 |
+
"single_word": false,
|
35 |
+
"special": true
|
36 |
+
},
|
37 |
+
"32001": {
|
38 |
+
"content": "<|assistant|>",
|
39 |
+
"lstrip": false,
|
40 |
+
"normalized": false,
|
41 |
+
"rstrip": true,
|
42 |
+
"single_word": false,
|
43 |
+
"special": true
|
44 |
+
},
|
45 |
+
"32002": {
|
46 |
+
"content": "<|placeholder1|>",
|
47 |
+
"lstrip": false,
|
48 |
+
"normalized": false,
|
49 |
+
"rstrip": true,
|
50 |
+
"single_word": false,
|
51 |
+
"special": true
|
52 |
+
},
|
53 |
+
"32003": {
|
54 |
+
"content": "<|placeholder2|>",
|
55 |
+
"lstrip": false,
|
56 |
+
"normalized": false,
|
57 |
+
"rstrip": true,
|
58 |
+
"single_word": false,
|
59 |
+
"special": true
|
60 |
+
},
|
61 |
+
"32004": {
|
62 |
+
"content": "<|placeholder3|>",
|
63 |
+
"lstrip": false,
|
64 |
+
"normalized": false,
|
65 |
+
"rstrip": true,
|
66 |
+
"single_word": false,
|
67 |
+
"special": true
|
68 |
+
},
|
69 |
+
"32005": {
|
70 |
+
"content": "<|placeholder4|>",
|
71 |
+
"lstrip": false,
|
72 |
+
"normalized": false,
|
73 |
+
"rstrip": true,
|
74 |
+
"single_word": false,
|
75 |
+
"special": true
|
76 |
+
},
|
77 |
+
"32006": {
|
78 |
+
"content": "<|system|>",
|
79 |
+
"lstrip": false,
|
80 |
+
"normalized": false,
|
81 |
+
"rstrip": true,
|
82 |
+
"single_word": false,
|
83 |
+
"special": true
|
84 |
+
},
|
85 |
+
"32007": {
|
86 |
+
"content": "<|end|>",
|
87 |
+
"lstrip": false,
|
88 |
+
"normalized": false,
|
89 |
+
"rstrip": true,
|
90 |
+
"single_word": false,
|
91 |
+
"special": true
|
92 |
+
},
|
93 |
+
"32008": {
|
94 |
+
"content": "<|placeholder5|>",
|
95 |
+
"lstrip": false,
|
96 |
+
"normalized": false,
|
97 |
+
"rstrip": true,
|
98 |
+
"single_word": false,
|
99 |
+
"special": true
|
100 |
+
},
|
101 |
+
"32009": {
|
102 |
+
"content": "<|placeholder6|>",
|
103 |
+
"lstrip": false,
|
104 |
+
"normalized": false,
|
105 |
+
"rstrip": true,
|
106 |
+
"single_word": false,
|
107 |
+
"special": true
|
108 |
+
},
|
109 |
+
"32010": {
|
110 |
+
"content": "<|user|>",
|
111 |
+
"lstrip": false,
|
112 |
+
"normalized": false,
|
113 |
+
"rstrip": true,
|
114 |
+
"single_word": false,
|
115 |
+
"special": true
|
116 |
+
}
|
117 |
+
},
|
118 |
+
"bos_token": "<s>",
|
119 |
+
"chat_template": "{% for message in messages %}{% if (message['role'] == 'user') %}{{'<|user|>' + '\n' + message['content'] + '<|end|>' + '\n' + '<|assistant|>' + '\n'}}{% elif (message['role'] == 'assistant') %}{{message['content'] + '<|end|>' + '\n'}}{% endif %}{% endfor %}",
|
120 |
+
"clean_up_tokenization_spaces": false,
|
121 |
+
"eos_token": "<|endoftext|>",
|
122 |
+
"legacy": false,
|
123 |
+
"model_max_length": 4096,
|
124 |
+
"pad_token": "<|endoftext|>",
|
125 |
+
"padding_side": "left",
|
126 |
+
"sp_model_kwargs": {},
|
127 |
+
"tokenizer_class": "LlamaTokenizer",
|
128 |
+
"unk_token": "<unk>",
|
129 |
+
"use_default_system_prompt": false
|
130 |
+
}
|