Create README.md
#1
by
reach-vb
HF staff
- opened
README.md
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
inference: false
|
3 |
+
license: other
|
4 |
+
license_name: microsoft-research-license
|
5 |
+
license_link: https://huggingface.co/microsoft/phi-2/resolve/main/LICENSE
|
6 |
+
language:
|
7 |
+
- en
|
8 |
+
pipeline_tag: text-generation
|
9 |
+
tags:
|
10 |
+
- nlp
|
11 |
+
- code
|
12 |
+
---
|
13 |
+
|
14 |
+
## Model Summary
|
15 |
+
|
16 |
+
Phi-2 is a Transformer with **2.7 billion** parameters. It was trained using the same data sources as [Phi-1.5](https://huggingface.co/microsoft/phi-1.5), augmented with a new data source that consists of various NLP synthetic texts and filtered websites (for safety and educational value). When assessed against benchmarks testing common sense, language understanding, and logical reasoning, Phi-2 showcased a nearly state-of-the-art performance among models with less than 13 billion parameters.
|
17 |
+
|
18 |
+
Our model hasn't been fine-tuned 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.
|
19 |
+
|
20 |
+
## Intended Uses
|
21 |
+
|
22 |
+
Phi-2 is intended for research purposes only. Given the nature of the training data, the Phi-2 model is best suited for prompts using the QA format, the chat format, and the code format.
|
23 |
+
|
24 |
+
### QA Format:
|
25 |
+
|
26 |
+
You can provide the prompt as a standalone question as follows:
|
27 |
+
|
28 |
+
```markdown
|
29 |
+
Write a detailed analogy between mathematics and a lighthouse.
|
30 |
+
```
|
31 |
+
where the model generates the text after "." .
|
32 |
+
To encourage the model to write more concise answers, you can also try the following QA format using "Instruct: \<prompt\>\nOutput:"
|
33 |
+
```markdown
|
34 |
+
Instruct: Write a detailed analogy between mathematics and a lighthouse.
|
35 |
+
Output: Mathematics is like a lighthouse. Just as a lighthouse guides ships safely to shore, mathematics provides a guiding light in the world of numbers and logic. It helps us navigate through complex problems and find solutions. Just as a lighthouse emits a steady beam of light, mathematics provides a consistent framework for reasoning and problem-solving. It illuminates the path to understanding and helps us make sense of the world around us.
|
36 |
+
```
|
37 |
+
where the model generates the text after "Output:".
|
38 |
+
|
39 |
+
### Chat Format:
|
40 |
+
|
41 |
+
```markdown
|
42 |
+
Alice: I don't know why, I'm struggling to maintain focus while studying. Any suggestions?
|
43 |
+
Bob: Well, have you tried creating a study schedule and sticking to it?
|
44 |
+
Alice: Yes, I have, but it doesn't seem to help much.
|
45 |
+
Bob: Hmm, maybe you should try studying in a quiet environment, like the library.
|
46 |
+
Alice: ...
|
47 |
+
```
|
48 |
+
|
49 |
+
where the model generates the text after the first "Bob:".
|
50 |
+
|
51 |
+
### Code Format:
|
52 |
+
|
53 |
+
```python
|
54 |
+
def print_prime(n):
|
55 |
+
"""
|
56 |
+
Print all primes between 1 and n
|
57 |
+
"""
|
58 |
+
primes = []
|
59 |
+
for num in range(2, n+1):
|
60 |
+
is_prime = True
|
61 |
+
for i in range(2, int(math.sqrt(num))+1):
|
62 |
+
if num % i == 0:
|
63 |
+
is_prime = False
|
64 |
+
break
|
65 |
+
if is_prime:
|
66 |
+
primes.append(num)
|
67 |
+
print(primes)
|
68 |
+
```
|
69 |
+
where the model generates the text after the comments.
|
70 |
+
|
71 |
+
**Notes:**
|
72 |
+
* Phi-2 is intended for research purposes. The model-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.
|
73 |
+
* Direct adoption for production tasks is out of the scope of this research project. As a result, the Phi-2 model 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.
|
74 |
+
* If you are using `transformers>=4.36.0`, always load the model with `trust_remote_code=True` to prevent side-effects.
|