dreamerdeo
commited on
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
<div align="center">
|
41 |
+
<img src="banner_sailor.jpg" width="700"/>
|
42 |
+
</div>
|
43 |
+
|
44 |
+
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.
|
45 |
+
Developed with careful data curation, Sailor models are designed to understand and generate text across diverse linguistic landscapes of SEA region.
|
46 |
+
Built from [Qwen 1.5](https://huggingface.co/collections/Qwen/qwen15-65c0a2f577b1ecb76d786524) , Sailor encompasses models of varying sizes, spanning from 0.5B to 14B versions for different requirements.
|
47 |
+
We further fine-tune the base model with open-source datasets to get instruction-tuned models, namedly Sailor-Chat.
|
48 |
+
Benchmarking results demonstrate Sailor's proficiency in tasks such as question answering, commonsense reasoning, and other tasks in SEA languages.
|
49 |
+
|
50 |
+
> The logo was generated by MidJourney
|
51 |
+
|
52 |
+
## Model Summary
|
53 |
+
- **Model Collections:** [Base Model & Chat Model](https://huggingface.co/collections/sail/sailor-65e19a749f978976f1959825)
|
54 |
+
- **Project Website:** [sailorllm.github.io](https://sailorllm.github.io/)
|
55 |
+
- **Codebase:** [github.com/sail-sg/sailor-llm](https://github.com/sail-sg/sailor-llm)
|
56 |
+
- **Technical Report:** [arxiv.org/pdf/2404.03608.pdf](https://arxiv.org/pdf/2404.03608.pdf)
|
57 |
+
|
58 |
+
|
59 |
+
## Training details
|
60 |
+
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.
|
61 |
+
The pre-training corpus heavily leverages the publicly available corpus, including
|
62 |
+
[SlimPajama](https://huggingface.co/datasets/cerebras/SlimPajama-627B),
|
63 |
+
[SkyPile](https://huggingface.co/datasets/Skywork/SkyPile-150B),
|
64 |
+
[CC100](https://huggingface.co/datasets/cc100) and [MADLAD-400](https://huggingface.co/datasets/allenai/MADLAD-400).
|
65 |
+
The instruction tuning corpus are all publicly available including
|
66 |
+
[aya_collection](https://huggingface.co/datasets/CohereForAI/aya_collection),
|
67 |
+
[aya_dataset](https://huggingface.co/datasets/CohereForAI/aya_dataset),
|
68 |
+
[OpenOrca](https://huggingface.co/datasets/Open-Orca/OpenOrca),
|
69 |
+
[UltraChat](https://huggingface.co/datasets/HuggingFaceH4/ultrachat_200k),
|
70 |
+
[UltraFeedback](https://huggingface.co/datasets/openbmb/UltraFeedback).
|
71 |
+
|
72 |
+
By employing aggressive data deduplication and careful data cleaning on the collected corpus, we have attained a high-quality dataset spanning various languages.
|
73 |
+
Through systematic experiments to determine the weights of different languages, Sailor models undergo training from 200B to 400B tokens, tailored to different model sizes.
|
74 |
+
The approach boosts their performance on SEA languages while maintaining proficiency in English and Chinese without significant compromise.
|
75 |
+
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.
|
76 |
+
|
77 |
+
## Requirements
|
78 |
+
The code of Sailor has been in the latest Hugging face transformers and we advise you to install `transformers>=4.37.0`.
|
79 |
+
|
80 |
+
## Quickstart
|
81 |
+
|
82 |
+
Here provides a code snippet to show you how to load the tokenizer and model and how to generate contents.
|
83 |
+
|
84 |
+
```python
|
85 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
86 |
+
device = "cuda"
|
87 |
+
|
88 |
+
model = AutoModelForCausalLM.from_pretrained(
|
89 |
+
'sail/Sailor-7B-Chat',
|
90 |
+
torch_dtype="auto",
|
91 |
+
device_map="auto"
|
92 |
+
)
|
93 |
+
|
94 |
+
tokenizer = AutoTokenizer.from_pretrained('sail/Sailor-14B-Chat')
|
95 |
+
system_prompt= 'You are an AI assistant named Sailor created by Sea AI Lab. As an AI assistant, you need to answer a series of questions next, which may include languages such as English, Chinese, Thai, Vietnamese, Indonesian, Malay, and so on. Your answer should be friendly, unbiased, faithful, informative and detailed.'
|
96 |
+
|
97 |
+
prompt = "Beri saya pengenalan singkat tentang model bahasa besar."
|
98 |
+
# prompt = "Hãy cho tôi một giới thiệu ngắn gọn về mô hình ngôn ngữ lớn."
|
99 |
+
# prompt = "ให้ฉันแนะนำสั้น ๆ เกี่ยวกับโมเดลภาษาขนาดใหญ่"
|
100 |
+
|
101 |
+
messages = [
|
102 |
+
{"role": "system", "content": system_prompt},
|
103 |
+
{"role": "assistant", "content": prompt}
|
104 |
+
]
|
105 |
+
text = tokenizer.apply_chat_template(
|
106 |
+
messages,
|
107 |
+
tokenize=False,
|
108 |
+
add_generation_prompt=True
|
109 |
+
)
|
110 |
+
|
111 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(device)
|
112 |
+
input_ids = model_inputs.input_ids.to(device)
|
113 |
+
|
114 |
+
generated_ids = model.generate(
|
115 |
+
input_ids,
|
116 |
+
max_new_tokens=512,
|
117 |
+
)
|
118 |
+
|
119 |
+
generated_ids = [
|
120 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
121 |
+
]
|
122 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
123 |
+
print(response)
|
124 |
+
```
|
125 |
+
|
126 |
+
# License
|
127 |
+
|
128 |
+
Sailor is distributed under the terms of the Apache License 2.0.
|
129 |
+
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).
|
130 |
+
|
131 |
+
## Citation
|
132 |
+
|
133 |
+
If you find sailor useful, please cite our work as follows:
|
134 |
+
|
135 |
+
```
|
136 |
+
@misc{dou2024sailor,
|
137 |
+
title={Sailor: Open Language Models for South-East Asia},
|
138 |
+
author={Longxu Dou and Qian Liu and Guangtao Zeng and Jia Guo and Jiahui Zhou and Wei Lu and Min Lin},
|
139 |
+
year={2024},
|
140 |
+
eprint={2404.03608},
|
141 |
+
archivePrefix={arXiv},
|
142 |
+
primaryClass={cs.CL}
|
143 |
+
}
|
144 |
+
```
|
145 |
+
|
146 |
+
# Contact Us
|
147 |
+
|
148 |
+
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).
|