chaoscodes
commited on
Commit
•
4f30d2d
1
Parent(s):
102429f
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,172 @@
|
|
1 |
-
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
- zh
|
5 |
+
- id
|
6 |
+
- th
|
7 |
+
- vi
|
8 |
+
- ms
|
9 |
+
- lo
|
10 |
+
datasets:
|
11 |
+
- CohereForAI/aya_dataset
|
12 |
+
- CohereForAI/aya_collection
|
13 |
+
- Open-Orca/OpenOrca
|
14 |
+
- HuggingFaceH4/ultrachat_200k
|
15 |
+
- openbmb/UltraFeedback
|
16 |
+
tags:
|
17 |
+
- multilingual
|
18 |
+
- sea
|
19 |
+
- sailor
|
20 |
+
- sft
|
21 |
+
- chat
|
22 |
+
- instruction
|
23 |
+
widget:
|
24 |
+
- text: "如何制作烤鱼?"
|
25 |
+
example_title: "Chinese"
|
26 |
+
- text: "How to bake fish?"
|
27 |
+
example_title: "English"
|
28 |
+
- text: "Bagaimana cara memanggang ikan?"
|
29 |
+
example_title: "Malay"
|
30 |
+
- text: "วิธีย่างปลา?"
|
31 |
+
example_title: "Thai"
|
32 |
+
- text: "Bagaimana membuat bakaran ikan?"
|
33 |
+
example_title: "Indonesian"
|
34 |
+
- text: "Làm thế nào để nướng cá?"
|
35 |
+
example_title: "Vietnamese"
|
36 |
+
license: apache-2.0
|
37 |
+
base_model: sail/Sailor-14B
|
38 |
+
---
|
39 |
+
|
40 |
+
|
41 |
+
<div align="center">
|
42 |
+
<img src="banner_sailor.jpg" width="700"/>
|
43 |
+
</div>
|
44 |
+
|
45 |
+
Sailor is a suite of Open Language Models tailored for South-East Asia (SEA), focusing on languages such as 🇮🇩Indonesian, 🇹🇭Thai, 🇻🇳Vietnamese, 🇲🇾Malay, and 🇱🇦Lao.
|
46 |
+
Developed with careful data curation, Sailor models are designed to understand and generate text across diverse linguistic landscapes of SEA region.
|
47 |
+
Built from [Qwen 1.5](https://huggingface.co/collections/Qwen/qwen15-65c0a2f577b1ecb76d786524) , Sailor encompasses models of varying sizes, spanning from 0.5B to 7B versions for different requirements.
|
48 |
+
We further fine-tune the base model with open-source datasets to get instruction-tuned models, namedly Sailor-Chat.
|
49 |
+
Benchmarking results demonstrate Sailor's proficiency in tasks such as question answering, commonsense reasoning, and other tasks in SEA languages.
|
50 |
+
|
51 |
+
> The logo was generated by MidJourney
|
52 |
+
|
53 |
+
## Model Summary
|
54 |
+
- **Model Collections:** [Base Model & Chat Model](https://huggingface.co/collections/sail/sailor-65e19a749f978976f1959825)
|
55 |
+
- **Project Website:** [sailorllm.github.io](https://sailorllm.github.io/)
|
56 |
+
- **Codebase:** [github.com/sail-sg/sailor-llm](https://github.com/sail-sg/sailor-llm)
|
57 |
+
- **Technical Report:** [arxiv.org/pdf/2404.03608.pdf](https://arxiv.org/pdf/2404.03608.pdf)
|
58 |
+
|
59 |
+
|
60 |
+
## Training details
|
61 |
+
Sailor is crafted by continually pre-training from language models like the remarkable Qwen 1.5 models, which already has a great performance on SEA languages.
|
62 |
+
The pre-training corpus heavily leverages the publicly available corpus, including
|
63 |
+
[SlimPajama](https://huggingface.co/datasets/cerebras/SlimPajama-627B),
|
64 |
+
[SkyPile](https://huggingface.co/datasets/Skywork/SkyPile-150B),
|
65 |
+
[CC100](https://huggingface.co/datasets/cc100) and [MADLAD-400](https://huggingface.co/datasets/allenai/MADLAD-400).
|
66 |
+
The instruction tuning corpus are all publicly available including
|
67 |
+
[aya_collection](https://huggingface.co/datasets/CohereForAI/aya_collection),
|
68 |
+
[aya_dataset](https://huggingface.co/datasets/CohereForAI/aya_dataset),
|
69 |
+
[OpenOrca](https://huggingface.co/datasets/Open-Orca/OpenOrca).
|
70 |
+
|
71 |
+
By employing aggressive data deduplication and careful data cleaning on the collected corpus, we have attained a high-quality dataset spanning various languages.
|
72 |
+
Through systematic experiments to determine the weights of different languages, Sailor models undergo training from 200B to 400B tokens, tailored to different model sizes.
|
73 |
+
The approach boosts their performance on SEA languages while maintaining proficiency in English and Chinese without significant compromise.
|
74 |
+
Finally, we continually pre-train the Qwen1.5-0.5B model with 400 Billion tokens, and other models with 200 Billion tokens to obtain the Sailor models.
|
75 |
+
|
76 |
+
### GGUF model list
|
77 |
+
| Name | Quant method | Bits | Size | Use case |
|
78 |
+
| ------------------------------------------------------------ | ------------ | ---- | -------- | -------------------------------------- |
|
79 |
+
| [ggml-model-Q2_K.gguf](https://huggingface.co/sail/Sailor-14B-Chat-gguf/blob/main/ggml-model-Q2_K.gguf) | Q2_K | 2 | 5.91 GB | medium, significant quality loss |
|
80 |
+
| [ggml-model-Q3_K_M.gguf](https://huggingface.co/sail/Sailor-14B-Chat-gguf/blob/main/ggml-model-Q3_K_M.gguf) | Q3_K_M | 3 | 7.42 GB | medium, balanced quality |
|
81 |
+
| [ggml-model-Q3_K_S.gguf](https://huggingface.co/sail/Sailor-14B-Chat-gguf/blob/main/ggml-model-Q3_K_S.gguf) | Q3_K_S | 3 | 6.77 GB | medium, high quality loss |
|
82 |
+
| [ggml-model-Q4_K_M.gguf](https://huggingface.co/sail/Sailor-14B-Chat-gguf/blob/main/ggml-model-Q4_K_M.gguf) | Q4_K_M | 4 | 9.19 GB | large, balanced quality |
|
83 |
+
| [ggml-model-Q4_K_S.gguf](https://huggingface.co/sail/Sailor-14B-Chat-gguf/blob/main/ggml-model-Q4_K_S.gguf) | Q4_K_S | 4 | 8.56 GB | large, greater quality loss |
|
84 |
+
| [ggml-model-Q5_K_M.gguf](https://huggingface.co/sail/Sailor-14B-Chat-gguf/blob/main/ggml-model-Q5_K_M.gguf) | Q5_K_M | 5 | 10.5 GB | large, balanced quality |
|
85 |
+
| [ggml-model-Q5_K_S.gguf](https://huggingface.co/sail/Sailor-14B-Chat-gguf/blob/main/ggml-model-Q5_K_S.gguf) | Q5_K_S | 5 | 10.0 GB | large, very low quality loss |
|
86 |
+
| [ggml-model-Q6_K.gguf](https://huggingface.co/sail/Sailor-14B-Chat-gguf/blob/main/ggml-model-Q6_K.gguf) | Q6_K | 6 | 12.3 GB | large, extremely low quality loss |
|
87 |
+
| [ggml-model-Q8_0.gguf](https://huggingface.co/sail/Sailor-14B-Chat-gguf/blob/main/ggml-model-Q8_0.gguf) | Q8_0 | 8 | 15.1 GB | very large, extremely low quality loss |
|
88 |
+
| [ggml-model-f16.gguf](https://huggingface.co/sail/Sailor-14B-Chat-gguf/blob/main/ggml-model-f16.gguf) | f16 | 16 | 28.3 GB | very large, no quality loss |
|
89 |
+
|
90 |
+
### How to run with `llama.cpp`
|
91 |
+
|
92 |
+
```shell
|
93 |
+
# install llama.cpp
|
94 |
+
git clone https://github.com/ggerganov/llama.cpp.git
|
95 |
+
cd llama.cpp
|
96 |
+
make
|
97 |
+
pip install -r requirements.txt
|
98 |
+
|
99 |
+
# generate with llama.cpp
|
100 |
+
./main -ngl 40 -m ggml-model-Q4_K_M.gguf -p "<|im_start|>question\nCara memanggang ikan?\n<|im_start|>answer\n" --temp 0.7 --repeat_penalty 1.1 -n 400 -e
|
101 |
+
```
|
102 |
+
|
103 |
+
> Change `-ngl 40` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
|
104 |
+
|
105 |
+
### How to run with `llama-cpp-python`
|
106 |
+
|
107 |
+
```shell
|
108 |
+
pip install llama-cpp-python
|
109 |
+
```
|
110 |
+
|
111 |
+
```python
|
112 |
+
import llama_cpp
|
113 |
+
import llama_cpp.llama_tokenizer
|
114 |
+
|
115 |
+
# load model
|
116 |
+
llama = llama_cpp.Llama.from_pretrained(
|
117 |
+
repo_id="sail/Sailor-14B-Chat-gguf",
|
118 |
+
filename="ggml-model-Q4_K_M.gguf",
|
119 |
+
tokenizer=llama_cpp.llama_tokenizer.LlamaHFTokenizer.from_pretrained("sail/Sailor-4B-Chat"),
|
120 |
+
n_gpu_layers=40,
|
121 |
+
n_threads=8,
|
122 |
+
verbose=False,
|
123 |
+
)
|
124 |
+
|
125 |
+
system_role= 'system'
|
126 |
+
user_role = 'question'
|
127 |
+
assistant_role = "answer"
|
128 |
+
|
129 |
+
system_prompt= \
|
130 |
+
'You are an AI assistant named Sailor created by Sea AI Lab. \
|
131 |
+
Your answer should be friendly, unbiased, faithful, informative and detailed.'
|
132 |
+
system_prompt = f"<|im_start|>{system_role}\n{system_prompt}<|im_end|>"
|
133 |
+
|
134 |
+
# inference example
|
135 |
+
output = llama(
|
136 |
+
system_prompt + '\n' + f"<|im_start|>{user_role}\nCara memanggang ikan?\n<|im_start|>{assistant_role}\n",
|
137 |
+
max_tokens=256,
|
138 |
+
temperature=0.7,
|
139 |
+
top_p=0.75,
|
140 |
+
top_k=60,
|
141 |
+
stop=["<|im_end|>", "<|endoftext|>"]
|
142 |
+
)
|
143 |
+
|
144 |
+
print(output['choices'][0]['text'])
|
145 |
+
```
|
146 |
+
### How to build demo
|
147 |
+
|
148 |
+
Install `llama-cpp-python` and `gradio`, then run [script](https://github.com/sail-sg/sailor-llm/blob/main/demo/llamacpp_demo.py).
|
149 |
+
|
150 |
+
# License
|
151 |
+
|
152 |
+
Sailor is distributed under the terms of the Apache License 2.0.
|
153 |
+
No restrict on the research and the commercial use, but should comply with the [Qwen License](https://huggingface.co/Qwen/Qwen1.5-1.8B/blob/main/LICENSE).
|
154 |
+
|
155 |
+
## Citation
|
156 |
+
|
157 |
+
If you find sailor useful, please cite our work as follows:
|
158 |
+
|
159 |
+
```
|
160 |
+
@misc{dou2024sailor,
|
161 |
+
title={Sailor: Open Language Models for South-East Asia},
|
162 |
+
author={Longxu Dou and Qian Liu and Guangtao Zeng and Jia Guo and Jiahui Zhou and Wei Lu and Min Lin},
|
163 |
+
year={2024},
|
164 |
+
eprint={2404.03608},
|
165 |
+
archivePrefix={arXiv},
|
166 |
+
primaryClass={cs.CL}
|
167 |
+
}
|
168 |
+
```
|
169 |
+
|
170 |
+
# Contact Us
|
171 |
+
|
172 |
+
If you have any questions, please raise an issue or contact us at [doulx@sea.com](mailto:doulx@sea.com) or [liuqian@sea.com](mailto:liuqian@sea.com).
|