Taishi-N324
commited on
Commit
•
243e7fc
1
Parent(s):
d7e9800
Upload README.md
Browse files
README.md
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
- ja
|
5 |
+
library_name: transformers
|
6 |
+
pipeline_tag: text-generation
|
7 |
+
tag: moe
|
8 |
+
license: apache-2.0
|
9 |
+
---
|
10 |
+
|
11 |
+
# Swallow-MX
|
12 |
+
|
13 |
+
Our Swallow-MX model has undergone continuous pre-training from the Mixtral-8x7B-Instruct-v0.1, primarily with the addition of Japanese language data.
|
14 |
+
|
15 |
+
![logo](./logo.png)
|
16 |
+
|
17 |
+
## Model Details
|
18 |
+
|
19 |
+
* **Model type**: Please refer to Mixtral technical report for details on the model architecture.
|
20 |
+
* **Language(s)**: Japanese English
|
21 |
+
* **Tokenizer**: This model utilizes the same tokenizer as employed by Mixtral-8x7B-Instruct-v0.1.
|
22 |
+
* **Contact**: swallow[at]nlp.c.titech.ac.jp
|
23 |
+
|
24 |
+
## Base Model Performance
|
25 |
+
|
26 |
+
### Japanese version
|
27 |
+
|
28 |
+
|Model|Size|JCommonsenseQA|JEMHopQA|NIILC|JSQuAD|XL-Sum|MGSM|WMT20-en-ja|WMT20-ja-en|
|
29 |
+
|---|---|---|---|---|---|---|---|---|---|
|
30 |
+
| | |4-shot|4-shot|4-shot|4-shot|1-shot|4-shot|4-shot|4-shot|
|
31 |
+
| Llama 2 | 7B | 0.3852 | 0.4240 | 0.3410 | 0.7917 | 0.1905 | 0.0760 | 0.1783 | 0.1738 |
|
32 |
+
| Swallow | 7B | 0.4808 | 0.5078 | 0.5968 | 0.8573 | 0.1830 | 0.1240 | 0.2510 | 0.1511 |
|
33 |
+
| Swallow-Plus | 7B | 0.5478 | 0.5493 | 0.6030 | 0.8544 | 0.1806 | 0.1360 | 0.2568 | 0.1441 |
|
34 |
+
| Swallow-NVE | 7B | 0.5433 | 0.5425 | 0.5729 | 0.8684 | 0.2117 | 0.1200 | 0.2405 | 0.1512 |
|
35 |
+
| Llama 2 | 13B | 0.6997 | 0.4415 | 0.4170 | 0.8533 | 0.2139 | 0.1320 | 0.2146 | 0.1982 |
|
36 |
+
| Swallow | 13B | 0.7837 | 0.5063 | 0.6398 | 0.9005 | 0.2168 | 0.2040 | 0.2720 | 0.1771 |
|
37 |
+
| Swallow-NVE | 13B | 0.7712 | 0.5438 | 0.6351 | 0.9030 | 0.2294 | 0.2120 | 0.2735 | 0.1817 |
|
38 |
+
| Llama 2 | 70B | 0.8686 | 0.4656 | 0.5256 | 0.9080 | 0.2361 | 0.3560 | 0.2643 | **0.2398** |
|
39 |
+
| Swallow | 70B | 0.9348 | **0.6290** | 0.6960 | 0.9176 | 0.2266 | **0.4840** | **0.3043** | 0.2298 |
|
40 |
+
| Swallow-NVE | 70B | **0.9410** | 0.5759 | **0.7024** | **0.9254** | **0.2758** | 0.4720 | 0.3042 | 0.2322 |
|
41 |
+
|Mixtral-8x7B-v0.1|8x7B|0.8347|0.5335|0.3549|0.8847|0.2192|0.3120|0.1970|0.1987|
|
42 |
+
|Swallow-MX-NVE|8x7B|0.9258|0.5843|0.5687|0.9148|0.2589|0.4360|0.2705|0.2074|
|
43 |
+
|
44 |
+
Please note that Swallow-MX-NVE is not derived from Mixtral-8x7B-v0.1, but rather underwent continued pre-training from Mixtral-8x7B-Instruct-v0.1.
|
45 |
+
|
46 |
+
### English version
|
47 |
+
|
48 |
+
|Model|Size|OpenBookQA|TriviaQA|HellaSwag|SQuAD2.0|XWINO|GSM8K|
|
49 |
+
|---|---|---|---|---|---|---|---|
|
50 |
+
| | |8-shot|8-shot|8-shot|8-shot|8-shot|8-shot|
|
51 |
+
| Llama 2 | 7B | 0.3580 | 0.6265 | 0.5860 | 0.3207 | 0.9049 | 0.1410 |
|
52 |
+
| Swallow | 7B | 0.3180 | 0.4836 | 0.5308 | 0.3125 | 0.8817 | 0.1130 |
|
53 |
+
| Swallow-Plus | 7B | 0.3280 | 0.4558 | 0.5259 | 0.3134 | 0.8929 | 0.1061 |
|
54 |
+
| Swallow-NVE | 7B | 0.3180 | 0.5079 | 0.5329 | 0.2919 | 0.8817 | 0.0986 |
|
55 |
+
| Llama 2 | 13B | 0.3760 | 0.7255 | 0.6148 | 0.3681 | 0.9140 | 0.2403 |
|
56 |
+
| Swallow | 13B | 0.3500 | 0.5852 | 0.5660 | 0.3406 | 0.9075 | 0.2039 |
|
57 |
+
| Swallow-NVE | 13B | 0.3460 | 0.6025 | 0.5700 | 0.3478 | 0.9006 | 0.1751 |
|
58 |
+
| Llama 2 | 70B | **0.4280** | **0.8239** | **0.6742** | 0.3770 | **0.9290** | 0.5284 |
|
59 |
+
| Swallow | 70B | 0.4220 | 0.7756 | 0.6458 | 0.3745 | 0.9204 | 0.4867 |
|
60 |
+
| Swallow-NVE | 70B | 0.4240 | 0.7817 | 0.6439 | 0.3451 | 0.9256 | 0.4943 |
|
61 |
+
|Mixtral-8x7B-v0.1|8x7B|0.3960|0.7989|0.6678|**0.3842**|0.9204|**0.5747**|
|
62 |
+
|Swallow-MX-NVE|8x7B|0.3740|0.7847|0.6520|0.3801|0.9170|0.5694|
|
63 |
+
|
64 |
+
Please note that Swallow-MX-NVE is not derived from Mixtral-8x7B-v0.1, but rather underwent continued pre-training from Mixtral-8x7B-Instruct-v0.1.
|
65 |
+
|
66 |
+
## Usage
|
67 |
+
|
68 |
+
First install additional dependencies in [requirements.txt](./requirements.txt):
|
69 |
+
|
70 |
+
```sh
|
71 |
+
pip install -r requirements.txt
|
72 |
+
```
|
73 |
+
|
74 |
+
### Use the base model
|
75 |
+
|
76 |
+
```python
|
77 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
78 |
+
|
79 |
+
model_name = "tokyotech-llm/Swallow-MX-NVE-hf"
|
80 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, torch_dtype=torch.bfloat16, device_map="auto")
|
81 |
+
|
82 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
83 |
+
prompt = "東京工業大学の主なキャンパスは、"
|
84 |
+
input_ids = tokenizer.encode(
|
85 |
+
prompt,
|
86 |
+
add_special_tokens=False,
|
87 |
+
return_tensors="pt"
|
88 |
+
)
|
89 |
+
tokens = model.generate(
|
90 |
+
input_ids.to(device=model.device),
|
91 |
+
max_new_tokens=128,
|
92 |
+
temperature=0.99,
|
93 |
+
top_p=0.95,
|
94 |
+
do_sample=True,
|
95 |
+
)
|
96 |
+
|
97 |
+
out = tokenizer.decode(tokens[0], skip_special_tokens=True)
|
98 |
+
print(out)
|
99 |
+
```
|
100 |
+
|
101 |
+
## Training Datasets
|
102 |
+
|
103 |
+
### Continual Pre-Training
|
104 |
+
The following datasets were used for continual pre-training.
|
105 |
+
|
106 |
+
- [Algebraic Stack](https://huggingface.co/datasets/EleutherAI/proof-pile-2)
|
107 |
+
- [Japanese Wikipedia](https://dumps.wikimedia.org/other/cirrussearch)
|
108 |
+
- [RefinedWeb](https://huggingface.co/datasets/tiiuae/falcon-refinedweb)
|
109 |
+
- [Swallow Corpus](https://chokkan.org/temp/tokyotech-llm/swallow-corpus)
|
110 |
+
- [The Pile](https://huggingface.co/datasets/EleutherAI/pile)
|
111 |
+
- [The Vault](https://github.com/FSoft-AI4Code/TheVault)
|
112 |
+
|
113 |
+
## Risks and Limitations
|
114 |
+
|
115 |
+
The models released here are still in the early stages of our research and development and have not been tuned to ensure outputs align with human intent and safety considerations.
|
116 |
+
|
117 |
+
## Acknowledgements
|
118 |
+
|
119 |
+
We thank Mistral AI for releasing Mixtral-8x7B-Instruct-v0.1 under an open license for others to build on.
|
120 |
+
|
121 |
+
Our project is supported by the [ABCI Large-scale Language Model Building Support Program](https://abci.ai/en/link/llm_support_program.html) of the National Institute of Advanced Industrial Science and Technology.
|
122 |
+
|
123 |
+
## License
|
124 |
+
|
125 |
+
apache-2.0
|
126 |
+
|
127 |
+
## Authors
|
128 |
+
|
129 |
+
Here are the team members:
|
130 |
+
- From [Okazaki Laboratory](https://www.nlp.c.titech.ac.jp/index.en.html), the following members:
|
131 |
+
- [Naoaki Okazaki](https://www.chokkan.org/index.ja.html)
|
132 |
+
- [Sakae Mizuki](https://s-mizuki-nlp.github.io/)
|
133 |
+
- [Hiroki Iida](https://meshidenn.github.io/)
|
134 |
+
- [Mengsay Loem](https://loem-ms.github.io/)
|
135 |
+
- [Shota Hirai](https://huggingface.co/Kotemo428)
|
136 |
+
- [Kakeru Hattori](https://aya-se.vercel.app/)
|
137 |
+
- [Masanari Ohi](https://twitter.com/stjohn2007)
|
138 |
+
- From [YOKOTA Laboratory](https://www.rio.gsic.titech.ac.jp/en/index.html), the following members:
|
139 |
+
- [Rio Yokota](https://twitter.com/rioyokota)
|
140 |
+
- [Kazuki Fujii](https://twitter.com/okoge_kaz)
|
141 |
+
- [Taishi Nakamura](https://twitter.com/Setuna7777_2)
|