RichardErkhov commited on
Commit
12788cf
1 Parent(s): 2dff1c3

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +210 -0
README.md ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ phi-1_5 - GGUF
11
+ - Model creator: https://huggingface.co/microsoft/
12
+ - Original model: https://huggingface.co/microsoft/phi-1_5/
13
+
14
+
15
+ | Name | Quant method | Size |
16
+ | ---- | ---- | ---- |
17
+ | [phi-1_5.Q2_K.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.Q2_K.gguf) | Q2_K | 0.54GB |
18
+ | [phi-1_5.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.IQ3_XS.gguf) | IQ3_XS | 0.59GB |
19
+ | [phi-1_5.IQ3_S.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.IQ3_S.gguf) | IQ3_S | 0.61GB |
20
+ | [phi-1_5.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.Q3_K_S.gguf) | Q3_K_S | 0.61GB |
21
+ | [phi-1_5.IQ3_M.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.IQ3_M.gguf) | IQ3_M | 0.64GB |
22
+ | [phi-1_5.Q3_K.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.Q3_K.gguf) | Q3_K | 0.69GB |
23
+ | [phi-1_5.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.Q3_K_M.gguf) | Q3_K_M | 0.69GB |
24
+ | [phi-1_5.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.Q3_K_L.gguf) | Q3_K_L | 0.75GB |
25
+ | [phi-1_5.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.IQ4_XS.gguf) | IQ4_XS | 0.74GB |
26
+ | [phi-1_5.Q4_0.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.Q4_0.gguf) | Q4_0 | 0.77GB |
27
+ | [phi-1_5.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.IQ4_NL.gguf) | IQ4_NL | 0.78GB |
28
+ | [phi-1_5.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.Q4_K_S.gguf) | Q4_K_S | 0.78GB |
29
+ | [phi-1_5.Q4_K.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.Q4_K.gguf) | Q4_K | 0.83GB |
30
+ | [phi-1_5.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.Q4_K_M.gguf) | Q4_K_M | 0.83GB |
31
+ | [phi-1_5.Q4_1.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.Q4_1.gguf) | Q4_1 | 0.85GB |
32
+ | [phi-1_5.Q5_0.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.Q5_0.gguf) | Q5_0 | 0.92GB |
33
+ | [phi-1_5.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.Q5_K_S.gguf) | Q5_K_S | 0.92GB |
34
+ | [phi-1_5.Q5_K.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.Q5_K.gguf) | Q5_K | 0.96GB |
35
+ | [phi-1_5.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.Q5_K_M.gguf) | Q5_K_M | 0.96GB |
36
+ | [phi-1_5.Q5_1.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.Q5_1.gguf) | Q5_1 | 1.0GB |
37
+ | [phi-1_5.Q6_K.gguf](https://huggingface.co/RichardErkhov/microsoft_-_phi-1_5-gguf/blob/main/phi-1_5.Q6_K.gguf) | Q6_K | 1.09GB |
38
+
39
+
40
+
41
+
42
+ Original model description:
43
+ ---
44
+ license: mit
45
+ license_link: https://huggingface.co/microsoft/phi-1_5/resolve/main/LICENSE
46
+ language:
47
+ - en
48
+ pipeline_tag: text-generation
49
+ tags:
50
+ - nlp
51
+ - code
52
+ ---
53
+ ## Model Summary
54
+
55
+ The language model Phi-1.5 is a Transformer with **1.3 billion** parameters. It was trained using the same data sources as [phi-1](https://huggingface.co/microsoft/phi-1), augmented with a new data source that consists of various NLP synthetic texts. When assessed against benchmarks testing common sense, language understanding, and logical reasoning, Phi-1.5 demonstrates a nearly state-of-the-art performance among models with less than 10 billion parameters.
56
+
57
+ We **did not** fine-tune Phi-1.5 either for **instruction following or through reinforcement learning from human feedback**. The intention behind crafting this open-source model is to provide the research community with a non-restricted small model to explore vital safety challenges, such as reducing toxicity, understanding societal biases, enhancing controllability, and more.
58
+
59
+ For a safer model release, we exclude generic web-crawl data sources such as common-crawl from the training. This strategy prevents direct exposure to potentially harmful online content, enhancing the model's safety without RLHF. However, the model is still vulnerable to generating harmful content. We hope the model can help the research community to further study the safety of language models.
60
+
61
+ Phi-1.5 can write poems, draft emails, create stories, summarize texts, write Python code (such as downloading a Hugging Face transformer model), etc.
62
+
63
+ ## How to Use
64
+
65
+ Phi-1.5 has been integrated in the `transformers` version 4.37.0. If you are using a lower version, ensure that you are doing the following:
66
+
67
+ * When loading the model, ensure that `trust_remote_code=True` is passed as an argument of the `from_pretrained()` function.
68
+
69
+ The current `transformers` version can be verified with: `pip list | grep transformers`.
70
+
71
+ ## Intended Uses
72
+
73
+ Given the nature of the training data, Phi-1.5 is best suited for prompts using the QA format, the chat format, and the code format. Note that Phi-1.5, being a base model, often produces irrelevant text following the main answer. In the following example, we've truncated the answer for illustrative purposes only.
74
+
75
+ ### QA Format:
76
+
77
+ ```markdown
78
+ Write a detailed analogy between mathematics and a lighthouse.
79
+
80
+ Answer: Mathematics is like a lighthouse, guiding us through the vast ocean of numbers and calculations. Just as a lighthouse illuminates the darkness, mathematics provides us with a clear path to navigate through complex problems. It helps us make sense of the world around us, just like a lighthouse helps ships find their way home.
81
+ ```
82
+
83
+ where the model generates the text after "Answer:".
84
+
85
+ ### Chat Format:
86
+
87
+ ```markdown
88
+ Alice: I don't know why, I'm struggling to maintain focus while studying. Any suggestions?
89
+
90
+ Bob: Have you tried using a timer? It can help you stay on track and avoid distractions.
91
+
92
+ Alice: That's a good idea. I'll give it a try.
93
+
94
+ Charlie: Another thing that can help is to break up your study sessions into smaller chunks. It's easier to concentrate on one thing at a time.
95
+
96
+ Alice: That makes sense. I'll try that too.
97
+
98
+ Bob: And don't forget to take breaks! It's important to give your brain a rest so you can come back to your studies with a fresh perspective.
99
+
100
+ Alice: Thanks for the advice, guys. I feel more motivated now.
101
+
102
+ Charlie: No problem, Alice. We're all in this together.
103
+
104
+ Bob: Yeah, and remember that it's okay to ask for help if you need it. We're here to support each other.
105
+ ```
106
+
107
+ where the model generates the text after the first "Bob:".
108
+
109
+ ### Code Format:
110
+
111
+ ```python
112
+ def print_prime(n):
113
+ """
114
+ Print all primes between 1 and n
115
+ """
116
+ primes = []
117
+ for num in range(2, n+1):
118
+ is_prime = True
119
+ for i in range(2, int(math.sqrt(num))+1):
120
+ if num % i == 0:
121
+ is_prime = False
122
+ break
123
+ if is_prime:
124
+ primes.append(num)
125
+ print(primes)
126
+ ```
127
+
128
+ where the model generates the text after the comments.
129
+
130
+ **Notes:**
131
+
132
+ * Phi-1.5-generated text/code should be treated as a starting point rather than a definitive solution for potential use cases. Users should be cautious when employing these models in their applications.
133
+
134
+ * Phi-1.5 has not been tested to ensure that it performs adequately for any production-level application. Please refer to the limitation sections of this document for more details.
135
+
136
+ * If you are using `transformers<4.37.0`, always load the model with `trust_remote_code=True` to prevent side-effects.
137
+
138
+ ## Sample Code
139
+
140
+ ```python
141
+ import torch
142
+ from transformers import AutoModelForCausalLM, AutoTokenizer
143
+
144
+ torch.set_default_device("cuda")
145
+
146
+ model = AutoModelForCausalLM.from_pretrained("microsoft/phi-1_5", torch_dtype="auto", trust_remote_code=True)
147
+ tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-1_5", trust_remote_code=True)
148
+
149
+ inputs = tokenizer('''def print_prime(n):
150
+ """
151
+ Print all primes between 1 and n
152
+ """''', return_tensors="pt", return_attention_mask=False)
153
+
154
+ outputs = model.generate(**inputs, max_length=200)
155
+ text = tokenizer.batch_decode(outputs)[0]
156
+ print(text)
157
+ ```
158
+
159
+ ## Limitations of Phi-1.5
160
+
161
+ * Generate Inaccurate Code and Facts: The model often produces incorrect code snippets and statements. Users should treat these outputs as suggestions or starting points, not as definitive or accurate solutions.
162
+
163
+ * Limited Scope for code: If the model generates Python scripts that utilize uncommon packages or scripts in other languages, we strongly recommend users manually verify all API uses.
164
+
165
+ * Unreliable Responses to Instruction: The model has not undergone instruction fine-tuning. As a result, it may struggle or fail to adhere to intricate or nuanced instructions provided by users.
166
+
167
+ * Language Limitations: The model is primarily designed to understand standard English. Informal English, slang, or any other language outside of English might pose challenges to its comprehension, leading to potential misinterpretations or errors in response.
168
+
169
+ * Potential Societal Biases: Regardless of the safe data used for its training, the model is not entirely free from societal biases. There's a possibility it may generate content that mirrors these societal biases, particularly if prompted or instructed to do so. We urge users to be aware of this and to exercise caution and critical thinking when interpreting model outputs.
170
+
171
+ * Toxicity: Despite that the model is trained with carefully selected data, the model can still produce harmful content if explicitly prompted or instructed to do so. We chose to release the model for research purposes only -- We hope to help the open-source community develop the most effective ways to reduce the toxicity of a model directly after pretraining.
172
+
173
+ ## Training
174
+
175
+ ### Model
176
+
177
+ * Architecture: a Transformer-based model with next-word prediction objective
178
+ * Dataset size: 30B tokens
179
+ * Training tokens: 150B tokens
180
+ * Precision: fp16
181
+ * GPUs: 32xA100-40G
182
+ * Training time: 8 days
183
+
184
+ ### Software
185
+
186
+ * [PyTorch](https://github.com/pytorch/pytorch)
187
+ * [DeepSpeed](https://github.com/microsoft/DeepSpeed)
188
+ * [Flash-Attention](https://github.com/HazyResearch/flash-attention)
189
+
190
+ ### License
191
+
192
+ The model is licensed under the [MIT license](https://huggingface.co/microsoft/phi-1_5/resolve/main/LICENSE).
193
+
194
+ ### Citation
195
+
196
+ You can find the paper at https://arxiv.org/abs/2309.05463. Please cite as:
197
+
198
+ ```bib
199
+ @article{textbooks2,
200
+ title={Textbooks Are All You Need II: \textbf{phi-1.5} technical report},
201
+ author={Li, Yuanzhi and Bubeck, S{\'e}bastien and Eldan, Ronen and Del Giorno, Allie and Gunasekar, Suriya and Lee, Yin Tat},
202
+ journal={arXiv preprint arXiv:2309.05463},
203
+ year={2023}
204
+ }
205
+ ```
206
+
207
+ ## Trademarks
208
+
209
+ 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.
210
+