LiyuanLucasLiu
commited on
Commit
•
4d29616
1
Parent(s):
8dbc2fc
initial commit
Browse files- CODE_OF_CONDUCT.md +9 -0
- LICENSE +22 -0
- NOTICE.md +2 -0
- README.md +139 -3
- SECURITY.md +41 -0
- added_tokens.json +13 -0
- config.json +39 -0
- configuration_grinmoe.py +181 -0
- generation_config.json +12 -0
- model-00001-of-00017.safetensors +3 -0
- model-00002-of-00017.safetensors +3 -0
- model-00003-of-00017.safetensors +3 -0
- model-00004-of-00017.safetensors +3 -0
- model-00005-of-00017.safetensors +3 -0
- model-00006-of-00017.safetensors +3 -0
- model-00007-of-00017.safetensors +3 -0
- model-00008-of-00017.safetensors +3 -0
- model-00009-of-00017.safetensors +3 -0
- model-00010-of-00017.safetensors +3 -0
- model-00011-of-00017.safetensors +3 -0
- model-00012-of-00017.safetensors +3 -0
- model-00013-of-00017.safetensors +3 -0
- model-00014-of-00017.safetensors +3 -0
- model-00015-of-00017.safetensors +3 -0
- model-00016-of-00017.safetensors +3 -0
- model-00017-of-00017.safetensors +3 -0
- model.safetensors.index.json +0 -0
- modeling_grinmoe.py +1703 -0
- special_tokens_map.json +30 -0
- tokenizer.json +0 -0
- tokenizer_config.json +130 -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 |
+
Microsoft.
|
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,2 @@
|
|
|
|
|
|
|
1 |
+
NOTICES AND INFORMATION
|
2 |
+
Do Not Translate or Localize
|
README.md
CHANGED
@@ -1,3 +1,139 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h1 align="center"> 😁 MoE</h1>
|
2 |
+
<h4 align="center">GRIN: <em>GR</em>adient-<em>IN</em>formed MoE</h4>
|
3 |
+
<p align="center">
|
4 |
+
<a href="https://huggingface.co/microsoft/GRIN-MoE">Hugging Face</a>  |   <a href="https://arxiv.org/abs/2304.08612"> Tech Report</a>  |   <a href="https://github.com/microsoft/GRIN-MoE/blob/main/LICENSE">License</a>  |   <a href="https://github.com/microsoft/GRIN-MoE">Github</a>   |   <a href="https://github.com/microsoft/GRIN-MoE/tree/main#usage">Get Started</a> 
|
5 |
+
<br>
|
6 |
+
|
7 |
+
GRIN MoE is a top2 16x3.8B MoE model.
|
8 |
+
It achieves exceptionally good performance across a diverse set of tasks, particularly in coding and mathematics tasks.
|
9 |
+
Comparing to conventional MoE training, GRIN MoE differs in mostly two ways:
|
10 |
+
|
11 |
+
- GRIN uses SparseMixer-v2 to estimate the gradient related to expert routing, while the conventional MoE training treats expert gating as a proxy for the gradient estimation.
|
12 |
+
|
13 |
+
- GRIN scales MoE training with neither expert parallelism nor token dropping, while the conventional MoE training employs expert parallelism and deploys token dropping.
|
14 |
+
|
15 |
+
## Intended Uses
|
16 |
+
|
17 |
+
### Primary Use Cases
|
18 |
+
|
19 |
+
The model is intended for commercial and research use in multiple languages. The model provides uses for general purpose AI systems and applications which require:
|
20 |
+
|
21 |
+
1) Memory/compute constrained environments
|
22 |
+
2) Latency bound scenarios
|
23 |
+
3) Strong reasoning (especially code, math and logic)
|
24 |
+
|
25 |
+
Our model is designed to accelerate research on language and multimodal models, for use as a building block for generative AI powered features.
|
26 |
+
|
27 |
+
### Use Case Considerations
|
28 |
+
|
29 |
+
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.
|
30 |
+
|
31 |
+
***Nothing contained in this Model Card should be interpreted as or deemed a restriction or modification to the license the model is released under.***
|
32 |
+
|
33 |
+
## Usage
|
34 |
+
|
35 |
+
### Command-line Demo
|
36 |
+
|
37 |
+
The simpliest way to inference with GRIN-MoE is to run the demo as below, which would setup environment, download model weight, and run inference for a math question.
|
38 |
+
|
39 |
+
```bash
|
40 |
+
# This script is available at `https://github.com/microsoft/GRIN-MoE/blob/main/demo/demo.sh` and requires docker to run.
|
41 |
+
curl -s https://raw.githubusercontent.com/microsoft/GRIN-MoE/main/demo/demo.sh | bash -s
|
42 |
+
```
|
43 |
+
|
44 |
+
### Interactive Demo
|
45 |
+
|
46 |
+
Run the following command to play with the model with more questions and customized inputs, which would launch a jupyter notebook at `localhost:8887`.
|
47 |
+
```bash
|
48 |
+
# This script requires docker to run.
|
49 |
+
docker run --gpus all -p 8887:8887 --rm -it nvcr.io/nvidia/pytorch:24.08-py3 /bin/bash -c 'git clone https://github.com/microsoft/GRIN-MoE.git && jupyter notebook --port 8887 --notebook-dir GRIN-MoE/demo'
|
50 |
+
```
|
51 |
+
|
52 |
+
## Benchmarks
|
53 |
+
|
54 |
+
To understand the capabilities, we compare GRIN MoE with a set of models over a variety of benchmarks using our internal benchmark platform. At the high-level overview of the model quality on representative benchmarks:
|
55 |
+
|
56 |
+
### Popular Benchmarks
|
57 |
+
|
58 |
+
| | GRIN MoE (16x3.8B) | Mixtral (8x7B) | Mixtral (8x22B) | Llama3 (8B) | Llama3 (70B) | GPT3.5 | GPT4o |
|
59 |
+
|---------------|-----------|---------|---------|--------|--------|--------|-------|
|
60 |
+
| MMLU | 79.4 | 70.5 | 76.2 | 66.5 | 80.2 | 71.4 | 86.9 |
|
61 |
+
| HellaSwag | 83.7 | 70.4 | 79.0 | 71.1 | 82.6 | 78.8 | 91.7 |
|
62 |
+
| ANLI | 60.6 | 55.2 | 65.2 | 57.3 | 68.3 | 58.1 | 75.7 |
|
63 |
+
| GSM-8K | 90.4 | 64.7 | 83.8 | 77.4 | 93.5 | 78.1 | 93.8 |
|
64 |
+
| Math | 58.9 | 11.1 | 41.8 | 28.2 | 51.2 | 45.3 | 67.8 |
|
65 |
+
| MedQA | 70.4 | 62.2 | 67.9 | 60.5 | 78.5 | 63.4 | 88.9 |
|
66 |
+
| AGIEval | 48.2 | 45.2 | 54.0 | 42.0 | 56.9 | 48.4 | 37.6 |
|
67 |
+
| TriviaQA | 73.9 | 78.5 | 82.2 | 67.7 | 84.5 | 85.8 | 66.0 |
|
68 |
+
| Arc-C | 92.0 | 87.3 | 91.3 | 82.8 | 93.0 | 87.4 | 97.0 |
|
69 |
+
| Arc-E | 98.0 | 95.6 | 96.9 | 93.4 | 98.2 | 96.3 | 99.0 |
|
70 |
+
| PIQA | 89.0 | 86.0 | 85.0 | 75.7 | 85.3 | 86.6 | 92.9 |
|
71 |
+
| SociQA | 79.5 | 75.9 | 78.2 | 73.9 | 81.1 | 68.3 | 81.4 |
|
72 |
+
| BigBench-Hard | 81.4 | 69.7 | 81.8 | 51.5 | 80.2 | 68.3 | 81.2 |
|
73 |
+
| WinoGrande | 81.4 | 62.0 | 75.3 | 65.0 | 83.3 | 68.8 | 89.3 |
|
74 |
+
| OpenBookQA | 89.8 | 85.8 | 88.6 | 82.6 | 91.8 | 86.0 | 95.2 |
|
75 |
+
| BoolQ | 83.4 | 77.6 | 82.7 | 80.9 | 89.1 | 79.1 | 90.6 |
|
76 |
+
| CommonSenseQA | 81.8 | 78.1 | 82.0 | 79.0 | 84.4 | 79.6 | 88.5 |
|
77 |
+
| TruthfulQA | 74.5 | 60.1 | 67.4 | 63.2 | 81.9 | 85.8 | 85.6 |
|
78 |
+
| HumanEval | 74.4 | 37.8 | 39.6 | 60.4 | 78.7 | 62.2 | 92.1 |
|
79 |
+
| MBPP | 80.3 | 60.2 | 70.7 | 67.7 | 81.3 | 77.8 | 90.4 |
|
80 |
+
| Average | 78.6 | 66.7 | 74.5 | 67.3 | 81.2 | 73.8 | 84.8 |
|
81 |
+
|
82 |
+
### Livebench
|
83 |
+
Performance on LiveBench-2024-07-25. Models are ranked by their average score (AVG). *Baseline results are referenced from the official benchmark.
|
84 |
+
|
85 |
+
| | Reasoning | Coding | Mathematics | Data Analysis | Language | IF | AVG |
|
86 |
+
|------------------------------|-----------|----------|--------------|---------------|----------|----------|----------|
|
87 |
+
| Claude-3-haiku* | 29.3 | 24.5 | 25.7 | 41.5 | 30.1 | 64.0 | 35.9 |
|
88 |
+
| Mixtral-8x22B-instruct-v0.1* | 29.3 | 32.0 | 28.3 | 31.7 | 26.5 | 63.1 | 35.2 |
|
89 |
+
| GPT-3.5-turbo-0125* | 26.7 | 27.7 | 26.9 | 41.2 | 24.2 | 60.5 | 34.5 |
|
90 |
+
| **GRIN MoE** | **35.3** | **23.7** | **29.8** | **32.0** | **16.9** | **57.6** | **32.5** |
|
91 |
+
| Mistral-small-2402* | 26.0 | 21.2 | 28.2 | 31.9 | 22.1 | 63.9 | 32.2 |
|
92 |
+
| Command-r-plus* | 28.7 | 19.5 | 24.9 | 24.6 | 23.9 | 71.5 | 32.2 |
|
93 |
+
| Gemma-2-9B-it* | 17.3 | 22.5 | 24.0 | 35.1 | 27.6 | 61.6 | 31.3 |
|
94 |
+
|
95 |
+
|
96 |
+
## Training
|
97 |
+
|
98 |
+
### Model
|
99 |
+
| | |
|
100 |
+
|---------------------|-----|
|
101 |
+
| Developer | Microsoft |
|
102 |
+
| Architecture | GRIN MoE has 16x3.8B parameters with **6.6B active parameters** when using 2 experts. The model is a mixture-of-expert decoder-only Transformer model using the tokenizer with vocabulary size of 32,064. |
|
103 |
+
| Inputs | Text. It is best suited for prompts using chat format. |
|
104 |
+
| Context length | 4K tokens |
|
105 |
+
| GPUs | 512 H100-80G |
|
106 |
+
| Training time | 18 days |
|
107 |
+
| Training data | 4.0T tokens |
|
108 |
+
| Outputs | Generated text in response to the input |
|
109 |
+
| Dates | Trained between April and June 2024 |
|
110 |
+
| Status | This is a static model trained on an offline dataset with cutoff date October 2023 for publicly available data. Future versions of the tuned models may be released as we improve models. |
|
111 |
+
| Supported languages | English |
|
112 |
+
| Release date | Sep 2024 |
|
113 |
+
| License | MIT |
|
114 |
+
|
115 |
+
### Training Datasets
|
116 |
+
Our training data includes a wide variety of sources, totaling 4 trillion tokens, and is a combination of 1) publicly available documents filtered rigorously for quality, selected high-quality educational data, and code; 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.); 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. More details about data can be found in the [Phi-3 Technical Report](https://arxiv.org/pdf/2404.14219).
|
117 |
+
|
118 |
+
## Responsible AI Considerations
|
119 |
+
Like other language models, Gradient Informed (GRIN) MoE model can potentially behave in ways that are unfair, unreliable, or offensive. Some of the limiting behaviors to be aware of include:
|
120 |
+
* Quality of Service: GRIN MoE is 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.
|
121 |
+
* Representation of Harms & Perpetuation of Stereotypes: This model 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.
|
122 |
+
* Inappropriate or Offensive Content: This model 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.
|
123 |
+
* Information Reliability: Language models can generate nonsensical content or fabricate content that might sound reasonable but is inaccurate or outdated.
|
124 |
+
* Limited Scope for Code: Majority of the 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.
|
125 |
+
|
126 |
+
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:
|
127 |
+
* Allocation: The model 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.
|
128 |
+
* 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.
|
129 |
+
* 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).
|
130 |
+
* Generation of Harmful Content: Developers should assess outputs for their context and use available safety classifiers or custom solutions appropriate for their use case.
|
131 |
+
* 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.
|
132 |
+
* Copyrighted content: The model might generate content that infringes on copyright protections. Developers should implement measures to detect and filter copyrighted material, and end-users should be informed about the potential for unintended copyright violations and the importance of verifying original sources to avoid legal complications.
|
133 |
+
* Election Misinformation: Developers should ensure robust verification mechanisms are in place to detect and correct false information regarding elections and should inform users of the need for critical evaluation of AI-generated election-related content to mitigate the spread of misinformation.
|
134 |
+
|
135 |
+
## License
|
136 |
+
The model is licensed under the [MIT license](./LICENSE).
|
137 |
+
|
138 |
+
## Trademarks
|
139 |
+
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 -->
|
added_tokens.json
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"<|endoftext|>": 32000,
|
3 |
+
"<|assistant|>": 32001,
|
4 |
+
"<|placeholder1|>": 32002,
|
5 |
+
"<|placeholder2|>": 32003,
|
6 |
+
"<|placeholder3|>": 32004,
|
7 |
+
"<|placeholder4|>": 32005,
|
8 |
+
"<|system|>": 32006,
|
9 |
+
"<|end|>": 32007,
|
10 |
+
"<|placeholder5|>": 32008,
|
11 |
+
"<|placeholder6|>": 32009,
|
12 |
+
"<|user|>": 32010
|
13 |
+
}
|
config.json
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "GRIN-MoE",
|
3 |
+
"architectures": [
|
4 |
+
"GRIN-MoE"
|
5 |
+
],
|
6 |
+
"attention_bias": true,
|
7 |
+
"attention_dropout": 0.0,
|
8 |
+
"auto_map": {
|
9 |
+
"AutoConfig": "configuration_grinmoe.GRINMoEConfig",
|
10 |
+
"AutoModelForCausalLM": "modeling_grinmoe.GRINMoEForCausalLM"
|
11 |
+
},
|
12 |
+
"bos_token_id": 1,
|
13 |
+
"eos_token_id": 32000,
|
14 |
+
"hidden_act": "silu",
|
15 |
+
"hidden_dropout": 0.0,
|
16 |
+
"hidden_size": 4096,
|
17 |
+
"initializer_range": 0.02,
|
18 |
+
"input_jitter_noise": 0.01,
|
19 |
+
"intermediate_size": 6400,
|
20 |
+
"lm_head_bias": true,
|
21 |
+
"max_position_embeddings": 4096,
|
22 |
+
"model_type": "grinmoe",
|
23 |
+
"num_attention_heads": 32,
|
24 |
+
"num_experts_per_tok": 2,
|
25 |
+
"num_hidden_layers": 32,
|
26 |
+
"num_key_value_heads": 8,
|
27 |
+
"num_local_experts": 16,
|
28 |
+
"output_router_logits": false,
|
29 |
+
"rms_norm_eps": 1e-05,
|
30 |
+
"rope_theta": 10000.0,
|
31 |
+
"router_aux_loss_coef": 0.0,
|
32 |
+
"router_jitter_noise": 0.01,
|
33 |
+
"sliding_window": 2047,
|
34 |
+
"tie_word_embeddings": false,
|
35 |
+
"torch_dtype": "bfloat16",
|
36 |
+
"transformers_version": "4.40.2",
|
37 |
+
"use_cache": true,
|
38 |
+
"vocab_size": 32064
|
39 |
+
}
|
configuration_grinmoe.py
ADDED
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
""" PyTorch GRINMoE model"""
|
16 |
+
|
17 |
+
from transformers.configuration_utils import PretrainedConfig
|
18 |
+
from transformers.utils import logging
|
19 |
+
|
20 |
+
|
21 |
+
logger = logging.get_logger(__name__)
|
22 |
+
|
23 |
+
#from transformers.models.deprecated._archive_maps import PHIMOE_PRETRAINED_CONFIG_ARCHIVE_MAP # noqa: F401, E402
|
24 |
+
PHIMOE_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
25 |
+
"microsoft/GRIN-MoE": "https://huggingface.co/microsoft/GRIN-MoE/resolve/main/config.json"
|
26 |
+
}
|
27 |
+
|
28 |
+
class GRINMoEConfig(PretrainedConfig):
|
29 |
+
r"""
|
30 |
+
This is the configuration class to store the configuration of a [`GRINMoE`]. It is used to instantiate an
|
31 |
+
PhiMoE model according to the specified arguments, defining the model architecture. Instantiating a configuration
|
32 |
+
with the defaults will yield a similar configuration to that of the
|
33 |
+
[microsoft/GRIN-MoE](https://huggingface.co/microsoft/GRIN-MoE).
|
34 |
+
|
35 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
36 |
+
documentation from [`PretrainedConfig`] for more information.
|
37 |
+
|
38 |
+
|
39 |
+
Args:
|
40 |
+
vocab_size (`int`, *optional*, defaults to 32000):
|
41 |
+
Vocabulary size of the PhiMoE model. Defines the number of different tokens that can be represented by the
|
42 |
+
`inputs_ids` passed when calling [`GRINMoE`]
|
43 |
+
hidden_size (`int`, *optional*, defaults to 4096):
|
44 |
+
Dimension of the hidden representations.
|
45 |
+
intermediate_size (`int`, *optional*, defaults to 14336):
|
46 |
+
Dimension of the MLP representations.
|
47 |
+
num_hidden_layers (`int`, *optional*, defaults to 32):
|
48 |
+
Number of hidden layers in the Transformer encoder.
|
49 |
+
num_attention_heads (`int`, *optional*, defaults to 32):
|
50 |
+
Number of attention heads for each attention layer in the Transformer encoder.
|
51 |
+
num_key_value_heads (`int`, *optional*, defaults to 8):
|
52 |
+
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
|
53 |
+
`num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
|
54 |
+
`num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
|
55 |
+
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
|
56 |
+
by meanpooling all the original heads within that group. For more details checkout [this
|
57 |
+
paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to `8`.
|
58 |
+
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
59 |
+
The non-linear activation function (function or string) in the decoder.
|
60 |
+
max_position_embeddings (`int`, *optional*, defaults to `4096*32`):
|
61 |
+
The maximum sequence length that this model might ever be used with. PhiMoE's sliding window attention
|
62 |
+
allows sequence of up to 4096*32 tokens.
|
63 |
+
initializer_range (`float`, *optional*, defaults to 0.02):
|
64 |
+
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
65 |
+
rms_norm_eps (`float`, *optional*, defaults to 1e-05):
|
66 |
+
The epsilon used by the rms normalization layers.
|
67 |
+
use_cache (`bool`, *optional*, defaults to `True`):
|
68 |
+
Whether or not the model should return the last key/values attentions (not used by all models). Only
|
69 |
+
relevant if `config.is_decoder=True`.
|
70 |
+
pad_token_id (`int`, *optional*):
|
71 |
+
The id of the padding token.
|
72 |
+
bos_token_id (`int`, *optional*, defaults to 1):
|
73 |
+
The id of the "beginning-of-sequence" token.
|
74 |
+
eos_token_id (`int`, *optional*, defaults to 2):
|
75 |
+
The id of the "end-of-sequence" token.
|
76 |
+
tie_word_embeddings (`bool`, *optional*, defaults to `False`):
|
77 |
+
Whether the model's input and output word embeddings should be tied.
|
78 |
+
rope_theta (`float`, *optional*, defaults to 1000000.0):
|
79 |
+
The base period of the RoPE embeddings.
|
80 |
+
sliding_window (`int`, *optional*):
|
81 |
+
Sliding window attention window size. If not specified, will default to `4096`.
|
82 |
+
attention_dropout (`float`, *optional*, defaults to 0.0):
|
83 |
+
The dropout ratio for the attention probabilities.
|
84 |
+
num_experts_per_tok (`int`, *optional*, defaults to 2):
|
85 |
+
The number of experts to root per-token, can be also interpreted as the `top-p` routing
|
86 |
+
parameter
|
87 |
+
num_local_experts (`int`, *optional*, defaults to 8):
|
88 |
+
Number of experts per Sparse MLP layer.
|
89 |
+
output_router_logits (`bool`, *optional*, defaults to `False`):
|
90 |
+
Whether or not the router logits should be returned by the model. Enabeling this will also
|
91 |
+
allow the model to output the auxiliary loss. See [here]() for more details
|
92 |
+
router_aux_loss_coef (`float`, *optional*, defaults to 0.001):
|
93 |
+
The aux loss factor for the total loss.
|
94 |
+
router_jitter_noise (`float`, *optional*, defaults to 0.0):
|
95 |
+
Amount of noise to add to the router.
|
96 |
+
|
97 |
+
```python
|
98 |
+
>>> from transformers import GRINMoE, GRINMoEConfig
|
99 |
+
|
100 |
+
>>> # Initializing a GRIN-MoE style configuration
|
101 |
+
>>> configuration = GRINMoEConfig()
|
102 |
+
|
103 |
+
>>> # Initializing a model from the GRIN-MoE style configuration
|
104 |
+
>>> model = GRINMoE(configuration)
|
105 |
+
|
106 |
+
>>> # Accessing the model configuration
|
107 |
+
>>> configuration = model.config
|
108 |
+
```"""
|
109 |
+
|
110 |
+
model_type = "grinmoe"
|
111 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
112 |
+
|
113 |
+
# _attn_implementation = 'eager'
|
114 |
+
_attn_implementation = 'sdpa'
|
115 |
+
# _attn_implementation = 'flash_attention_2'
|
116 |
+
|
117 |
+
def __init__(
|
118 |
+
self,
|
119 |
+
vocab_size=32000,
|
120 |
+
hidden_size=4096,
|
121 |
+
intermediate_size=6400,
|
122 |
+
num_hidden_layers=32,
|
123 |
+
num_attention_heads=32,
|
124 |
+
num_key_value_heads=8,
|
125 |
+
hidden_act="silu",
|
126 |
+
max_position_embeddings=4096 * 32,
|
127 |
+
initializer_range=0.02,
|
128 |
+
rms_norm_eps=1e-5,
|
129 |
+
use_cache=True,
|
130 |
+
pad_token_id=None,
|
131 |
+
bos_token_id=1,
|
132 |
+
eos_token_id=2,
|
133 |
+
tie_word_embeddings=False,
|
134 |
+
rope_theta=1e6,
|
135 |
+
sliding_window=None,
|
136 |
+
attention_dropout=0.0,
|
137 |
+
num_experts_per_tok=2,
|
138 |
+
num_local_experts=16,
|
139 |
+
output_router_logits=False,
|
140 |
+
router_aux_loss_coef=0.001,
|
141 |
+
router_jitter_noise=0.01,
|
142 |
+
input_jitter_noise=0.01,
|
143 |
+
attention_bias = False,
|
144 |
+
lm_head_bias = False,
|
145 |
+
**kwargs,
|
146 |
+
):
|
147 |
+
self.vocab_size = vocab_size
|
148 |
+
self.max_position_embeddings = max_position_embeddings
|
149 |
+
self.hidden_size = hidden_size
|
150 |
+
self.intermediate_size = intermediate_size
|
151 |
+
self.num_hidden_layers = num_hidden_layers
|
152 |
+
self.num_attention_heads = num_attention_heads
|
153 |
+
self.sliding_window = sliding_window
|
154 |
+
self.attention_bias = attention_bias
|
155 |
+
self.lm_head_bias = lm_head_bias
|
156 |
+
# for backward compatibility
|
157 |
+
if num_key_value_heads is None:
|
158 |
+
num_key_value_heads = num_attention_heads
|
159 |
+
|
160 |
+
self.num_key_value_heads = num_key_value_heads
|
161 |
+
self.hidden_act = hidden_act
|
162 |
+
self.initializer_range = initializer_range
|
163 |
+
self.rms_norm_eps = rms_norm_eps
|
164 |
+
self.use_cache = use_cache
|
165 |
+
self.rope_theta = rope_theta
|
166 |
+
self.attention_dropout = attention_dropout
|
167 |
+
|
168 |
+
self.num_experts_per_tok = num_experts_per_tok
|
169 |
+
self.num_local_experts = num_local_experts
|
170 |
+
self.output_router_logits = output_router_logits
|
171 |
+
self.router_aux_loss_coef = router_aux_loss_coef
|
172 |
+
self.router_jitter_noise = router_jitter_noise
|
173 |
+
self.input_jitter_noise = input_jitter_noise
|
174 |
+
|
175 |
+
super().__init__(
|
176 |
+
pad_token_id=pad_token_id,
|
177 |
+
bos_token_id=bos_token_id,
|
178 |
+
eos_token_id=eos_token_id,
|
179 |
+
tie_word_embeddings=tie_word_embeddings,
|
180 |
+
**kwargs,
|
181 |
+
)
|
generation_config.json
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"use_cache": true,
|
11 |
+
"transformers_version": "4.40.2"
|
12 |
+
}
|
model-00001-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bfae60bacab5226fcfa437a7105359b61f602820bdb302986106065e19066da5
|
3 |
+
size 4992095880
|
model-00002-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fd343bf6d9e5a3363a23f878fb244c7653f855ae8cc02680c797314ef8ea60ca
|
3 |
+
size 4991605352
|
model-00003-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5829c532b698d42a298648bb4f9c9285f59751915f4c22dcac19723888c0395f
|
3 |
+
size 4991605352
|
model-00004-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6c6a8c02b7aeade710689234e062a2971f3ebbf471fbfc16338cd4e469e25bae
|
3 |
+
size 4991605352
|
model-00005-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7fb7769b8e802b11aac4cfc80db8ac6f8b16b57317de156f0727405ed189ae1e
|
3 |
+
size 4991605360
|
model-00006-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d546af749fd73b516dbb392a82be0c143c632d45bb5bc5c89870f93708ec2908
|
3 |
+
size 4991605448
|
model-00007-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:23280638638fd63494845afc3d8d2ffc8c7b0a2adcb4f4663d31eb8dbe075e16
|
3 |
+
size 4991605480
|
model-00008-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0e956930902155b68659b4d704e8bd42d76f1fc2409a8c72d79e661be4ff71c8
|
3 |
+
size 4991605480
|
model-00009-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:802266e25572d7adeb7dbe71d6d7a44ecc0ec6c928d98a41c624d8638f511506
|
3 |
+
size 4991605480
|
model-00010-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:86e6d54d42980de66f7d8c5cc09892836e8c116adc70858c95dd280c279584d8
|
3 |
+
size 4991605480
|
model-00011-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bf76f6fafa486fa8334e235508a9435493624d09bf8be22003489a3b1743bdf2
|
3 |
+
size 4993558592
|
model-00012-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4e1f8481f808d703076e5279d837496434ea67da900849d5e6e79b6b4e4d4ac4
|
3 |
+
size 4958009392
|
model-00013-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:99e4fc8a07c2a00b0056483bb4ec27c48a4ce6b663851ab9e1667eeab8d250de
|
3 |
+
size 4991605472
|
model-00014-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f6cb890c5984b94ba8e683a65a5ef482a2f6c8e50e9161d46c708b2968545a88
|
3 |
+
size 4991605472
|
model-00015-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9f972476b3635f899e593e949b8566af3187c7d84ba855d991f5f0871058c37e
|
3 |
+
size 4991605472
|
model-00016-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:70ae58f517f9d1f750d33c46fa37fc1c2d2025c4dba2d229602a7bc387ea1f5f
|
3 |
+
size 4991605472
|
model-00017-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d56845fc7afcf1b98676f57123aed6bd701040ca85d23114243aeadcfd6b4691
|
3 |
+
size 3912021632
|
model.safetensors.index.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
modeling_grinmoe.py
ADDED
@@ -0,0 +1,1703 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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