dreamerdeo commited on
Commit
602735d
·
verified ·
1 Parent(s): 7b2b31b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +38 -17
README.md CHANGED
@@ -16,9 +16,6 @@ tags:
16
  - multilingual
17
  - sea
18
  - sailor
19
- - sft
20
- - chat
21
- - instruction
22
  widget:
23
  - text: 如何制作烤鱼?
24
  example_title: Chinese
@@ -43,12 +40,12 @@ base_model:
43
 
44
  > The logo was generated by MidJourney
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
-
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.
@@ -59,7 +56,7 @@ The Sailor2 model comes in three sizes, 1B, 8B, and 20B, which are **expanded fr
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:** Coming Soon
63
 
64
 
65
  ## Training details
@@ -73,34 +70,57 @@ During development, we employ a range of advanced technologies to ensure top-tie
73
 
74
  Please refer to [Sailor2 Blog](https://sea-sailor.github.io/blog/sailor2/) for more training details.
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
  from transformers import AutoModelForCausalLM, AutoTokenizer
85
- device = "cuda" # the device to load the model
86
 
87
- model = AutoModelForCausalLM.from_pretrained("sail/Sailor2-20B", device_map="auto")
88
- tokenizer = AutoTokenizer.from_pretrained("sail/Sailor2-20B")
 
 
 
89
 
90
- input_message = "Model bahasa adalah model probabilistik"
91
- ### The given Indonesian input translates to 'A language model is a probabilistic model of.'
 
 
 
 
92
 
93
- model_inputs = tokenizer([input_message], return_tensors="pt").to(device)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
 
95
  generated_ids = model.generate(
96
- model_inputs.input_ids,
97
- max_new_tokens=64
98
  )
99
 
100
  generated_ids = [
101
  output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
102
  ]
103
-
104
  response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
105
  print(response)
106
  ```
@@ -115,10 +135,11 @@ No restrict on the research and the commercial use.
115
  If you find Sailor2 useful, please cite our work as follows:
116
 
117
  ```
118
- @misc{sailor2report,
119
  title = {Sailor2: Sailing in South-East Asia with Inclusive Multilingual LLM},
120
  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},
121
- year = {2024}
 
122
  }
123
  ```
124
 
 
16
  - multilingual
17
  - sea
18
  - sailor
 
 
 
19
  widget:
20
  - text: 如何制作烤鱼?
21
  example_title: Chinese
 
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.
 
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
 
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
  ```
 
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