gugarosa commited on
Commit
341a17a
1 Parent(s): 1dc35eb

Upload 5 files

Browse files
Files changed (5) hide show
  1. CODE_OF_CONDUCT.md +9 -0
  2. LICENSE +22 -0
  3. NOTICE.md +38 -0
  4. README.md +25 -32
  5. SECURITY.md +41 -0
CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # Microsoft Open Source Code of Conduct
2
+
3
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
4
+
5
+ Resources:
6
+
7
+ - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
8
+ - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
9
+ - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
LICENSE ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PhyAGI.
2
+ Copyright (c) Microsoft Corporation.
3
+
4
+ MIT License
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
NOTICE.md ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ NOTICES AND INFORMATION
2
+ Do Not Translate or Localize
3
+
4
+ This software incorporates material from third parties.
5
+
6
+ **Component.** https://github.com/Dao-AILab/flash-attention
7
+
8
+ **Open Source License/Copyright Notice.**
9
+
10
+ BSD 3-Clause License
11
+
12
+ Copyright (c) 2022, the respective contributors, as shown by the AUTHORS file.
13
+ All rights reserved.
14
+
15
+ Redistribution and use in source and binary forms, with or without
16
+ modification, are permitted provided that the following conditions are met:
17
+
18
+ * Redistributions of source code must retain the above copyright notice, this
19
+ list of conditions and the following disclaimer.
20
+
21
+ * Redistributions in binary form must reproduce the above copyright notice,
22
+ this list of conditions and the following disclaimer in the documentation
23
+ and/or other materials provided with the distribution.
24
+
25
+ * Neither the name of the copyright holder nor the names of its
26
+ contributors may be used to endorse or promote products derived from
27
+ this software without specific prior written permission.
28
+
29
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
30
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
32
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
33
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
37
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
README.md CHANGED
@@ -1,8 +1,7 @@
1
  ---
2
  inference: false
3
- license: other
4
- license_name: mit
5
- license_link: https://huggingface.co/microsoft/phi-1_5/resolve/main/Research%20License.docx
6
  language:
7
  - en
8
  pipeline_tag: text-generation
@@ -21,6 +20,7 @@ For a safer model release, we exclude generic web-crawl data sources such as com
21
  Phi-1.5 can write poems, draft emails, create stories, summarize texts, write Python code (such as downloading a Hugging Face transformer model), etc.
22
 
23
  ## Intended Uses
 
24
  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.
25
 
26
  ### QA Format:
@@ -30,6 +30,7 @@ Write a detailed analogy between mathematics and a lighthouse.
30
 
31
  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.
32
  ```
 
33
  where the model generates the text after "Answer:".
34
 
35
  ### Chat Format:
@@ -53,6 +54,7 @@ Charlie: No problem, Alice. We're all in this together.
53
 
54
  Bob: Yeah, and remember that it's okay to ask for help if you need it. We're here to support each other.
55
  ```
 
56
  where the model generates the text after the first "Bob:".
57
 
58
  ### Code Format:
@@ -73,35 +75,18 @@ def print_prime(n):
73
  primes.append(num)
74
  print(primes)
75
  ```
 
76
  where the model generates the text after the comments.
77
 
78
  **Notes:**
 
79
  * 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.
 
80
  * 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.
81
- * If you are using `transformers>=4.36.0`, always load the model with `trust_remote_code=True` to prevent side-effects.
82
 
83
- ## Sample Code
84
 
85
- There are four types of execution mode:
86
-
87
- 1. FP16 / Flash-Attention / CUDA:
88
- ```python
89
- model = AutoModelForCausalLM.from_pretrained("microsoft/phi-1_5", torch_dtype="auto", flash_attn=True, flash_rotary=True, fused_dense=True, device_map="cuda", trust_remote_code=True)
90
- ```
91
- 2. FP16 / CUDA:
92
- ```python
93
- model = AutoModelForCausalLM.from_pretrained("microsoft/phi-1_5", torch_dtype="auto", device_map="cuda", trust_remote_code=True)
94
- ```
95
- 3. FP32 / CUDA:
96
- ```python
97
- model = AutoModelForCausalLM.from_pretrained("microsoft/phi-1_5", torch_dtype=torch.float32, device_map="cuda", trust_remote_code=True)
98
- ```
99
- 4. FP32 / CPU:
100
- ```python
101
- model = AutoModelForCausalLM.from_pretrained("microsoft/phi-1_5", torch_dtype=torch.float32, device_map="cpu", trust_remote_code=True)
102
- ```
103
-
104
- To ensure the maximum compatibility, we recommend using the second execution mode (FP16 / CUDA), as follows:
105
 
106
  ```python
107
  import torch
@@ -122,22 +107,24 @@ text = tokenizer.batch_decode(outputs)[0]
122
  print(text)
123
  ```
124
 
125
- **Remark:** In the generation function, our model currently does not support beam search (`num_beams > 1`).
126
- Furthermore, in the forward pass of the model, we currently do not support outputting hidden states or attention values, or using custom input embeddings.
127
-
128
-
129
  ## Limitations of Phi-1.5
130
 
131
  * 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.
 
132
  * 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.
 
133
  * 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.
 
134
  * 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.
 
135
  * 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.
 
136
  * 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.
137
 
138
  ## Training
139
 
140
  ### Model
 
141
  * Architecture: a Transformer-based model with next-word prediction objective
142
  * Dataset size: 30B tokens
143
  * Training tokens: 150B tokens
@@ -146,16 +133,18 @@ Furthermore, in the forward pass of the model, we currently do not support outpu
146
  * Training time: 8 days
147
 
148
  ### Software
 
149
  * [PyTorch](https://github.com/pytorch/pytorch)
150
  * [DeepSpeed](https://github.com/microsoft/DeepSpeed)
151
  * [Flash-Attention](https://github.com/HazyResearch/flash-attention)
152
 
153
  ### License
154
- The model is licensed under the [MIT License](https://huggingface.co/microsoft/phi-1_5/resolve/main/Research%20License.docx).
 
155
 
156
  ### Citation
157
 
158
- You can find the paper at https://arxiv.org/abs/2309.05463
159
 
160
  ```bib
161
  @article{textbooks2,
@@ -164,4 +153,8 @@ You can find the paper at https://arxiv.org/abs/2309.05463
164
  journal={arXiv preprint arXiv:2309.05463},
165
  year={2023}
166
  }
167
- ```
 
 
 
 
 
1
  ---
2
  inference: false
3
+ license: mit
4
+ license_link: https://huggingface.co/microsoft/phi-1_5/resolve/main/LICENSE
 
5
  language:
6
  - en
7
  pipeline_tag: text-generation
 
20
  Phi-1.5 can write poems, draft emails, create stories, summarize texts, write Python code (such as downloading a Hugging Face transformer model), etc.
21
 
22
  ## Intended Uses
23
+
24
  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.
25
 
26
  ### QA Format:
 
30
 
31
  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.
32
  ```
33
+
34
  where the model generates the text after "Answer:".
35
 
36
  ### Chat Format:
 
54
 
55
  Bob: Yeah, and remember that it's okay to ask for help if you need it. We're here to support each other.
56
  ```
57
+
58
  where the model generates the text after the first "Bob:".
59
 
60
  ### Code Format:
 
75
  primes.append(num)
76
  print(primes)
77
  ```
78
+
79
  where the model generates the text after the comments.
80
 
81
  **Notes:**
82
+
83
  * 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.
84
+
85
  * 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.
 
86
 
87
+ * If you are using `transformers<4.37.0`, always load the model with `trust_remote_code=True` to prevent side-effects.
88
 
89
+ ## Sample Code
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
  ```python
92
  import torch
 
107
  print(text)
108
  ```
109
 
 
 
 
 
110
  ## Limitations of Phi-1.5
111
 
112
  * 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.
113
+
114
  * 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.
115
+
116
  * 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.
117
+
118
  * 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.
119
+
120
  * 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.
121
+
122
  * 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.
123
 
124
  ## Training
125
 
126
  ### Model
127
+
128
  * Architecture: a Transformer-based model with next-word prediction objective
129
  * Dataset size: 30B tokens
130
  * Training tokens: 150B tokens
 
133
  * Training time: 8 days
134
 
135
  ### Software
136
+
137
  * [PyTorch](https://github.com/pytorch/pytorch)
138
  * [DeepSpeed](https://github.com/microsoft/DeepSpeed)
139
  * [Flash-Attention](https://github.com/HazyResearch/flash-attention)
140
 
141
  ### License
142
+
143
+ The model is licensed under the [MIT license](https://huggingface.co/microsoft/phi-1_5/resolve/main/LICENSE).
144
 
145
  ### Citation
146
 
147
+ You can find the paper at https://arxiv.org/abs/2309.05463. Please cite as:
148
 
149
  ```bib
150
  @article{textbooks2,
 
153
  journal={arXiv preprint arXiv:2309.05463},
154
  year={2023}
155
  }
156
+ ```
157
+
158
+ ## Trademarks
159
+
160
+ 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.
SECURITY.md ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- BEGIN MICROSOFT SECURITY.MD V0.0.9 BLOCK -->
2
+
3
+ ## Security
4
+
5
+ Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet) and [Xamarin](https://github.com/xamarin).
6
+
7
+ If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below.
8
+
9
+ ## Reporting Security Issues
10
+
11
+ **Please do not report security vulnerabilities through public GitHub issues.**
12
+
13
+ Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report).
14
+
15
+ If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).
16
+
17
+ You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
18
+
19
+ Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
20
+
21
+ * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22
+ * Full paths of source file(s) related to the manifestation of the issue
23
+ * The location of the affected source code (tag/branch/commit or direct URL)
24
+ * Any special configuration required to reproduce the issue
25
+ * Step-by-step instructions to reproduce the issue
26
+ * Proof-of-concept or exploit code (if possible)
27
+ * Impact of the issue, including how an attacker might exploit the issue
28
+
29
+ This information will help us triage your report more quickly.
30
+
31
+ If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs.
32
+
33
+ ## Preferred Languages
34
+
35
+ We prefer all communications to be in English.
36
+
37
+ ## Policy
38
+
39
+ Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd).
40
+
41
+ <!-- END MICROSOFT SECURITY.MD BLOCK -->