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