khang119966 commited on
Commit
01b5257
1 Parent(s): 4a63f18

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +181 -195
README.md CHANGED
@@ -1,199 +1,185 @@
1
  ---
2
  library_name: transformers
3
- tags: []
 
 
 
 
 
 
 
 
 
 
4
  ---
5
 
6
- # Model Card for Model ID
7
-
8
- <!-- Provide a quick summary of what the model is/does. -->
9
-
10
-
11
-
12
- ## Model Details
13
-
14
- ### Model Description
15
-
16
- <!-- Provide a longer summary of what this model is. -->
17
-
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
-
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
-
28
- ### Model Sources [optional]
29
-
30
- <!-- Provide the basic links for the model. -->
31
-
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
-
36
- ## Uses
37
-
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
-
40
- ### Direct Use
41
-
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
-
44
- [More Information Needed]
45
-
46
- ### Downstream Use [optional]
47
-
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
-
50
- [More Information Needed]
51
-
52
- ### Out-of-Scope Use
53
-
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
-
56
- [More Information Needed]
57
-
58
- ## Bias, Risks, and Limitations
59
-
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
-
62
- [More Information Needed]
63
-
64
- ### Recommendations
65
-
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
-
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
-
70
- ## How to Get Started with the Model
71
-
72
- Use the code below to get started with the model.
73
-
74
- [More Information Needed]
75
-
76
- ## Training Details
77
-
78
- ### Training Data
79
-
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
-
82
- [More Information Needed]
83
-
84
- ### Training Procedure
85
-
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
-
88
- #### Preprocessing [optional]
89
-
90
- [More Information Needed]
91
-
92
-
93
- #### Training Hyperparameters
94
-
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
-
97
- #### Speeds, Sizes, Times [optional]
98
-
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
-
101
- [More Information Needed]
102
-
103
- ## Evaluation
104
-
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
-
107
- ### Testing Data, Factors & Metrics
108
-
109
- #### Testing Data
110
-
111
- <!-- This should link to a Dataset Card if possible. -->
112
-
113
- [More Information Needed]
114
-
115
- #### Factors
116
-
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
-
119
- [More Information Needed]
120
-
121
- #### Metrics
122
-
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
-
125
- [More Information Needed]
126
-
127
- ### Results
128
-
129
- [More Information Needed]
130
-
131
- #### Summary
132
-
133
-
134
-
135
- ## Model Examination [optional]
136
-
137
- <!-- Relevant interpretability work for the model goes here -->
138
-
139
- [More Information Needed]
140
-
141
- ## Environmental Impact
142
-
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
-
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
-
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
-
153
- ## Technical Specifications [optional]
154
-
155
- ### Model Architecture and Objective
156
-
157
- [More Information Needed]
158
-
159
- ### Compute Infrastructure
160
-
161
- [More Information Needed]
162
-
163
- #### Hardware
164
-
165
- [More Information Needed]
166
-
167
- #### Software
168
-
169
- [More Information Needed]
170
-
171
- ## Citation [optional]
172
-
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
-
175
- **BibTeX:**
176
-
177
- [More Information Needed]
178
-
179
- **APA:**
180
-
181
- [More Information Needed]
182
-
183
- ## Glossary [optional]
184
-
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
-
187
- [More Information Needed]
188
-
189
- ## More Information [optional]
190
-
191
- [More Information Needed]
192
-
193
- ## Model Card Authors [optional]
194
-
195
- [More Information Needed]
196
-
197
- ## Model Card Contact
198
-
199
- [More Information Needed]
 
1
  ---
2
  library_name: transformers
3
+ datasets:
4
+ - vilm/OpenOrca-Viet
5
+ - bkai-foundation-models/vi-alpaca
6
+ - 5CD-AI/Vietnamese-395k-meta-math-MetaMathQA-gg-translated
7
+ - 5CD-AI/Vietnamese-Locutusque-function-calling-chatml-gg-translated
8
+ - 5CD-AI/Vietnamese-1m5-kaist-CoT-gg-translated-unrefined
9
+ - 5CD-AI/Vietnamese-mabryCodes-tiny-cot-alpaca-gg-translated
10
+ - 5CD-AI/Vietnamese-nampdn-ai-tiny-webtext-gg-translated
11
+ - 5CD-AI/Vietnamese-Openorca-Multiplechoice-gg-translated
12
+ - 5CD-AI/Vietnamese-Multi-turn-Chat-Alpaca
13
+ - 5CD-AI/Visocial-Instructions
14
  ---
15
 
16
+ <div align="center">
17
+ <img src="viet-sailor-4b-logo.png" width="700"/>
18
+ </div>
19
+
20
+ [Sailor-4B](https://huggingface.co/sail/Sailor-4B) 🌊 is a model that has undergone additional pre-training on datasets from Southeast Asian countries 🌏, resulting in impressive performance 🚀. Building on this foundation, we have fine-tuned the model with a specific focus on Vietnamese language capabilities 🇻🇳.
21
+
22
+ This is a good choice for models under 7B parameters on the VMLU leaderboard 📊.
23
+
24
+ ## Training details 📚
25
+
26
+ The **1,000,000 samples** fine-tuning training dataset was meticulously sampled in part from the following datasets:
27
+ - [OpenOrca-Viet 🐋](https://huggingface.co/datasets/vilm/OpenOrca-Viet)
28
+ - [vi-alpaca 🦙](https://huggingface.co/datasets/bkai-foundation-models/vi-alpaca)
29
+ - [Vietnamese-395k-meta-math-MetaMathQA-gg-translated 📐](https://huggingface.co/datasets/5CD-AI/Vietnamese-395k-meta-math-MetaMathQA-gg-translated)
30
+ - [Vietnamese-Locutusque-function-calling-chatml-gg-translated 🧠](https://huggingface.co/datasets/5CD-AI/Vietnamese-Locutusque-function-calling-chatml-gg-translated)
31
+ - [Vietnamese-1m5-kaist-CoT-gg-translated-unrefined 🧵](https://huggingface.co/datasets/5CD-AI/Vietnamese-1m5-kaist-CoT-gg-translated-unrefined)
32
+ - [Vietnamese-mabryCodes-tiny-cot-alpaca-gg-translated 🧠](https://huggingface.co/datasets/5CD-AI/Vietnamese-mabryCodes-tiny-cot-alpaca-gg-translated)
33
+ - [Vietnamese-nampdn-ai-tiny-webtext-gg-translated 🧠](https://huggingface.co/datasets/5CD-AI/Vietnamese-nampdn-ai-tiny-webtext-gg-translated)
34
+ - [Vietnamese-Openorca-Multiplechoice-gg-translated 🐋](https://huggingface.co/datasets/5CD-AI/Vietnamese-Openorca-Multiplechoice-gg-translated)
35
+ - [Vietnamese-Multi-turn-Chat-Alpaca 💬](https://huggingface.co/datasets/5CD-AI/Vietnamese-Multi-turn-Chat-Alpaca)
36
+ - [Visocial-Instructions 💬](https://huggingface.co/datasets/5CD-AI/Visocial-Instructions)
37
+
38
+ ## Benchmarks 📈
39
+
40
+ We evaluated our model using the VMLU leaderboard:
41
+
42
+ <div align="center">
43
+ <img src="vmlu.png" width="1000"/>
44
+ </div>
45
+
46
+ | # | MODEL | CREATOR | BASE MODEL | STEM | SOCIAL SCIENCE | HUMANITIES | OTHERS | AVG |
47
+ |----|----------------------|------------------|---------------------|-------|----------------|------------|--------|-------|
48
+ | 1 | VNPTAI.IO-14B | VNPT AI | Qwen1.5-14B-Chat | 51.64 | 61.75 | 58.09 | 54.51 | 55.83 |
49
+ | 2 | SeaLLM-7B-v2.5 | DAMO Academy | llama-2-7b | 49.35 | 60.66 | 55.95 | 49.05 | 53.30 |
50
+ | 3 | MI4uLLM-7B-Chat | ML4U | Mistral-7B-v0.1 | 44.72 | 58.69 | 56.86 | 52.36 | 52.08 |
51
+ | 4 | Vistral-7B-Chat | UONLP x Ontocord | Mistral-7B-v0.1 | 43.32 | 57.02 | 55.12 | 48.01 | 50.07 |
52
+ | 5 | SDSRV-7B-chat | SDSRV teams | Mistral-7B-v0.1 | 36.29 | 60.55 | 55.95 | 49.05 | 48.55 |
53
+ | 6 | Arcanic Cono 1.5 | Arcanic AI | Mistral-7B-v0.1 | 45.11 | 52.44 | 51.97 | 45.36 | 47.45 |
54
+ | 7 | SeaLLM-7b-v2 | DAMO Academy | llama-2-7b | 39.95 | 52.02 | 49.38 | 45.27 | 45.79 |
55
+ | <b>8 | <b>Viet-Sailor-4B-Instruct | <b>5CD-AI | <b>Sailor-4B | <b>36.83 | <b>49.13 | <b>48.18 | <b>41.76 | <b>43.24</b> |
56
+ | 9 | bloomz-7b1 | BigScience | Bloom-7b1 | 32.63 | 45.73 | 41.85 | 39.89 | 38.87 |
57
+ | 10 | T-llama-7b | FPTU HCM | llama-2-7b | 32.2 | 43.15 | 40.31 | 36.57 | 37.28 |
58
+ | 11 | vbd-llama2-7b-50b... | Vin BigData | llama-2-7b | 31.45 | 40.34 | 40.24 | 39.62 | 36.98 |
59
+ | .. | ...... | ..... | .... | ... | ... | ... | ... | ... |
60
+
61
+
62
+ ## Examples
63
+ Function-calling
64
+ ```
65
+ <|im_start|>system
66
+ Bạn một trợ lý hữu ích với quyền truy cập vào các chức năng sau. Sử dụng chúng nếu cần thiết -{
67
+ "name": "search_movies",
68
+ "description": "Search for movies based on title or genre",
69
+ "parameters": {
70
+ "type": "object",
71
+ "properties": {
72
+ "title": {
73
+ "type": "string",
74
+ "description": "The title of the movie"
75
+ },
76
+ "genre": {
77
+ "type": "string",
78
+ "description": "The genre of the movie"
79
+ }
80
+ }
81
+ }
82
+ }<|im_end|>
83
+ <|im_start|>question
84
+ Bạn thể tìm cho tôi một bộ phim có tựa đề "Inception" được không?<|im_end|>
85
+ <|im_start|>answer
86
+ <function-call> {"name": "search_movies", "arguments": {"title": "Inception"}}<|im_end|>
87
+ <|im_start|>question
88
+ <function-response> {"movies": [{"title": "Inception", "genre": "Science Fiction", "director": "Christopher Nolan", "release_year": 2010}]}<|im_end|>
89
+ <|im_start|>answer
90
+ Tôi đã tìm thấy một bộ phim tựa đề "Inception". Đó một bộ phim Khoa học viễn tưởng của đạo diễn Christopher Nolan được phát hành vào năm 2010.<|im_end|>
91
+ ```
92
+ Sentiment analysis
93
+ ```
94
+ <|im_start|>system
95
+ Bạn là trợ lý AI hữu ích<|im_end|>
96
+ <|im_start|>question
97
+ Bạn là trợ lý AI. Hãy phân loại cảm xúc của bình luận sau theo từng khía cạnh của chủ thể.
98
+ Bình luận: về cách ăn mặc của cô thì quá 😡 😡 . nhưng về cách nói chuyện thì rất 😍.<|im_end|>
99
+ <|im_start|>answer
100
+ Cảm xúc của bình luận này có thể được phân loại như sau:
101
+ - Cảm xúc tiêu cực đối với cách ăn mặc của cô ấy: 😡
102
+ - Cảm xúc tích cực đối với cách nói chuyện của cô ấy: 😍<|im_end|>
103
+ ```
104
+ Simple math
105
+ ```
106
+ <|im_start|>system
107
+ Bạn một trợ lý AI hữu ích. Một nhà toán học.<|im_end|>
108
+ <|im_start|>question
109
+ Trên sân 2 con vịt 9 con hỏi tổng cộng mấy cái chân ?<|im_end|>
110
+ <|im_start|>answer
111
+ Tổng số chân trên sân là 11. Mỗi con vịt có 2 chân và mỗi con bò có 4 chân, vì vậy 2 con vịt có tổng cộng 2*2 = 4 chân và 9 con bò có tổng cộng 9*4 = 36 chân. Do đó, tổng số chân trên sân là 4+36 = 40.<|im_end|>
112
+ ```
113
+ Writing
114
+ ```
115
+ <|im_start|>system
116
+ Bạn là một trợ lý AI hữu ích, trung thực, trung lập. Hãy trả lời một cách đầy đủ <|im_end|>
117
+ <|im_start|>question
118
+ Người dùng sẽ cung cấp cho bạn một nhiệm vụ. Hãy thực hiện lần lượt 2 nhiệm vụ sau:
119
+ Bưới 1: Hãy mô tả ý nghĩa hình ảnh của chuỗi emoji 😡 👫 👨‍👩‍👦.
120
+ Bước 2: Hãy tạo 1 câu chuyện ngắn kết hợp đầy đủ ý nghĩa giữa chúng với nhau.<|im_end|>
121
+ <|im_start|>answer
122
+ Bước 1: Mô tả ý nghĩa hình ảnh của chuỗi emoji 😡 👫 👨‍👩‍👦.
123
+ Ý nghĩa hình ảnh của chuỗi emoji có thể được giải thích như sau:
124
+ - 😡: Biểu tượng cảm xúc này thường được sử dụng để thể hiện sự buồn bã, đau khổ hoặc thất vọng. Trong trường hợp này, nó có thể biểu thị rằng ai đó đang trải qua một số cảm xúc tiêu cực.
125
+ - 👫: Biểu tượng cảm xúc này thường được sử dụng để thể hiện tình yêu và sự quan tâm. Trong trường hợp này, nó có thể biểu thị rằng ai đó đang thể hiện tình yêu và sự quan tâm của họ đối với ai đó.
126
+ - 👨‍👩‍👦: Biểu tượng cảm xúc này thường được sử dụng để thể hiện tình yêu gia đình. Trong trường hợp này, nó có thể biểu thị rằng ai đó đang thể hiện tình yêu và sự quan tâm của họ đối với một thành viên trong gia đình.
127
+ Bước 2: Tạo một câu chuyện ngắn kết hợp các biểu tượng cảm xúc với nhau.
128
+ Câu chuyện: Trong một thị trấn nhỏ, nơi mọi người đều biết nhau, có một gia đình hạnh phúc sống trong một ngôi nhà nhỏ xinh xắn. Cha mẹ yêu thương và chăm sóc con cái của mình rất nhiều. Một ngày nọ, họ nhận được tin dữ rằng đứa con út của họ đã qua đời vì một căn bệnh hiếm gặp. Cả gia đình đều đau buồn, đặc biệt là cha mẹ của đứa trẻ. Họ cố gắng vượt qua nỗi đau bằng cách dành thời gian bên nhau, ôm nhau và chia sẻ những ký ức đẹp đẽ về đứa con yêu dấu của họ.<|im_end|>
129
+ ```
130
+ ## Requirements
131
+ The code of Sailor has been in the latest Hugging face transformers and we advise you to install `transformers>=4.37.0`.
132
+
133
+ ## Quickstart
134
+
135
+ Here provides a code snippet to show you how to load the tokenizer and model and how to generate contents.
136
+
137
+ ```python
138
+ from transformers import AutoModelForCausalLM, AutoTokenizer
139
+ import torch
140
+ device = "cuda"
141
+
142
+ model = AutoModelForCausalLM.from_pretrained(
143
+ '5CD-AI/Viet-Sailor-4B-Instruct',
144
+ torch_dtype=torch.bfloat16,
145
+ device_map="auto"
146
+ )
147
+
148
+ tokenizer = AutoTokenizer.from_pretrained('5CD-AI/Viet-Sailor-4B-Instruct')
149
+ system_prompt= 'Bạn là một trợ lý AI hữu ích, rất thực tế, trung lập. Hãy trả lời một cách đầy đủ ý'
150
+
151
+ prompt = """Hãy phân loại cảm xúc của bình luận sau theo từng khía cạnh của chủ thể.
152
+ Bình luận: về cách ăn mặc của cô thì quá 😡 😡 . nhưng về cách nói chuyện thì rất 😍."""
153
+
154
+
155
+ messages = [
156
+ {"role": "system", "content": system_prompt},
157
+ {"role": "question", "content": prompt}
158
+ ]
159
+ text = tokenizer.apply_chat_template(
160
+ messages,
161
+ tokenize=False,
162
+ add_generation_prompt=True
163
+ )
164
+
165
+ model_inputs = tokenizer([text], return_tensors="pt").to(device)
166
+ input_ids = model_inputs.input_ids.to(device)
167
+
168
+ generated_ids = model.generate(
169
+ input_ids,
170
+ max_new_tokens=256,
171
+ num_beams=3,
172
+ top_k=20,
173
+ top_p= 0.5,
174
+ temperature=0.9,
175
+ repetition_penalty = 1.5,
176
+ length_penalty = 1.0,
177
+ do_sample=True
178
+ )
179
+
180
+ generated_ids = [
181
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
182
+ ]
183
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
184
+ print(response)
185
+ ```