dreamerdeo commited on
Commit
029175b
·
verified ·
1 Parent(s): 6560a5b

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +148 -0
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
+ - my
11
+ - jv
12
+ - km
13
+ - su
14
+ - tl
15
+ tags:
16
+ - multilingual
17
+ - sea
18
+ - sailor
19
+ widget:
20
+ - text: 如何制作烤鱼?
21
+ example_title: Chinese
22
+ - text: How to bake fish?
23
+ example_title: English
24
+ - text: Bagaimana cara memanggang ikan?
25
+ example_title: Malay
26
+ - text: วิธีย่างปลา?
27
+ example_title: Thai
28
+ - text: Bagaimana membuat bakaran ikan?
29
+ example_title: Indonesian
30
+ - text: Làm thế nào để nướng cá?
31
+ example_title: Vietnamese
32
+ license: apache-2.0
33
+ base_model:
34
+ - sail/Sailor2-L-8B
35
+ ---
36
+
37
+ <div align="center">
38
+ <img src="sailor2_banner.jpg" width="700"/>
39
+ </div>
40
+
41
+ > The logo was generated by MidJourney
42
+
43
+
44
+ Sailor2 is a community-driven initiative that brings cutting-edge multilingual language models to South-East Asia (SEA).
45
+ Our research highlights a strong demand for models in the **8B and 20B parameter** range for production use, alongside **1B models** for specialized applications,
46
+ such as speculative decoding and research purposes.
47
+ These models, released under the **Apache 2.0 license**, provide enhanced accessibility to advanced language technologies across the region.
48
+
49
+ Sailor2 builds upon the foundation of the awesome multilingual model [Qwen 2.5](https://huggingface.co/collections/Qwen/qwen25-66e81a666513e518adb90d9e) and
50
+ is continuously pre-trained on **500B tokens** to support **15 languages** better with a unified model.
51
+ These languages include English, Chinese, Burmese, Cebuano, Ilocano, Indonesian, Javanese, Khmer, Lao, Malay, Sundanese, Tagalog, Thai, Vietnamese, and Waray.
52
+ By addressing the growing demand for diverse, robust, and accessible language models, Sailor2 seeks to serve the underserved in SEA areas with open, inclusive, and accessible multilingual LLMs.
53
+ The Sailor2 model comes in three sizes, 1B, 8B, and 20B, which are **expanded from the Qwen2.5 base models** of 0.5B, 7B, and 14B, respectively.
54
+
55
+ ## Model Summary
56
+ - **Model Collections:** [Base Model & Chat Model](https://huggingface.co/collections/sail/sailor2-language-models-674d7c9e6b4dbbd9a869906b)
57
+ - **Project Website:** [sea-sailor.github.io/blog/sailor2/](https://sea-sailor.github.io/blog/sailor2/)
58
+ - **Codebase:** [github.com/sail-sg/sailor2](https://github.com/sail-sg/sailor2)
59
+ - **Technical Report:** [Sailor2 Report](https://arxiv.org/pdf/2502.12982)
60
+
61
+
62
+ ## Training details
63
+
64
+ During development, we employ a range of advanced technologies to ensure top-tier performance and efficiency:
65
+
66
+ 1. model expansion
67
+ 2. optimized data mixing strategies
68
+ 3. multi-stage pre-training protocols
69
+ 4. advanced multilingual post-training
70
+
71
+ Please refer to [Sailor2 Blog](https://sea-sailor.github.io/blog/sailor2/) for more training details.
72
+
73
+
74
+ ## Requirements
75
+ The code of Sailor2 has been in the latest Hugging face transformers and we advise you to install `transformers==4.46.3`.
76
+
77
+ ## Quickstart
78
+
79
+ Here provides a code snippet to show you how to load the tokenizer and model and how to generate contents.
80
+
81
+ ```python
82
+ import torch
83
+ from transformers import AutoModelForCausalLM, AutoTokenizer
84
+ device = "cuda"
85
+
86
+ model = AutoModelForCausalLM.from_pretrained(
87
+ 'sail/Sailor2-20B-Chat',
88
+ torch_dtype=torch.bfloat16,
89
+ device_map="auto"
90
+ )
91
+
92
+ tokenizer = AutoTokenizer.from_pretrained('sail/Sailor2-20B-Chat')
93
+ system_prompt= \
94
+ 'You are an AI assistant named Sailor2, created by Sea AI Lab. \
95
+ As an AI assistant, you can answer questions in English, Chinese, and Southeast Asian languages \
96
+ such as Burmese, Cebuano, Ilocano, Indonesian, Javanese, Khmer, Lao, Malay, Sundanese, Tagalog, Thai, Vietnamese, and Waray. \
97
+ Your responses should be friendly, unbiased, informative, detailed, and faithful.'
98
+
99
+ prompt = "Beri saya pengenalan singkat tentang model bahasa besar."
100
+ # 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."
101
+ # prompt = "ให้ฉันแนะนำสั้น ๆ เกี่ยวกับโมเดลภาษาขนาดใหญ่"
102
+
103
+ messages = [
104
+ {"role": "system", "content": system_prompt},
105
+ {"role": "user", "content": prompt}
106
+ ]
107
+ text = tokenizer.apply_chat_template(
108
+ messages,
109
+ tokenize=False,
110
+ add_generation_prompt=True
111
+ )
112
+
113
+ model_inputs = tokenizer([text], return_tensors="pt").to(device)
114
+ input_ids = model_inputs.input_ids.to(device)
115
+
116
+ generated_ids = model.generate(
117
+ input_ids,
118
+ max_new_tokens=512,
119
+ )
120
+
121
+ generated_ids = [
122
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
123
+ ]
124
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
125
+ print(response)
126
+ ```
127
+
128
+ # License
129
+
130
+ Sailor2 is distributed under the terms of the Apache License 2.0.
131
+ No restrict on the research and the commercial use.
132
+
133
+ ## Citation
134
+
135
+ If you find Sailor2 useful, please cite our work as follows:
136
+
137
+ ```
138
+ @article{sailor2report,
139
+ title = {Sailor2: Sailing in South-East Asia with Inclusive Multilingual LLM},
140
+ author = {Longxu Dou and Qian Liu and Fan Zhou and Changyu Chen and Zili Wang and Ziqi Jin and Zichen Liu and Tongyao Zhu and Cunxiao Du and Penghui Yang and Haonan Wang and Jiaheng Liu and Yongchi Zhao and Xiachong Feng and Xin Mao and Man Tsung Yeung and Kunat Pipatanakul and Fajri Koto and Min Si Thu and Hynek Kydl{\'\i}{\v{c}}ek and Zeyi Liu and Qunshu Lin and Sittipong Sripaisarnmongkol and Kridtaphad Sae-Khow and Nirattisai Thongchim and Taechawat Konkaew and Narong Borijindargoon and Anh Dao and Matichon Maneegard and Phakphum Artkaew and Zheng-Xin Yong and Quan Nguyen and Wannaphong Phatthiyaphaibun and Hoang H. Tran and Mike Zhang and Shiqi Chen and Tianyu Pang and Chao Du and Xinyi Wan and Wei Lu and Min Lin},
141
+ journal={arXiv preprint arXiv:2502.12982},
142
+ year = {2025}
143
+ }
144
+ ```
145
+
146
+ # Contact Us
147
+
148
+ If you have any questions, please raise an issue or contact us at [[email protected]](mailto:[email protected]) or [[email protected]](mailto:[email protected]).