winninghealth commited on
Commit
ca3c13b
ยท
verified ยท
1 Parent(s): ecd27fc

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +165 -162
README.md CHANGED
@@ -1,163 +1,166 @@
1
- ---
2
- license: apache-2.0
3
- language:
4
- - en
5
- - zh
6
- base_model:
7
- - ModelSpace/GemmaX2-28-2B-Pretrain
8
- tags:
9
- - GGUF
10
- ---
11
-
12
- # WiNGPT-Babel-2: A Multilingual Translation Language Model
13
-
14
- [![Hugging Face](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-WiNGPT--Babel-blue)](https://huggingface.co/collections/winninghealth/wingpt-babel-68463d4b2a28d0d675ff3be9)
15
- [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-yellow.svg)](https://opensource.org/licenses/Apache-2.0)
16
-
17
- > This is the quantization version (llama.cpp) of [WiNGPT-Babel-2](https://huggingface.co/winninghealth/WiNGPT-Babel-2).
18
- >
19
- > Example
20
- >
21
- > ```shell
22
- > ./llama-server -m WiNGPT-Babel-2-GGUF/WiNGPT-Babel-2-IQ4_XS.gguf --jinja --chat-template-file WiNGPT-Babel-2-GGUF/WiNGPT-Babel-2.jinja
23
- > ```
24
- >
25
- > - **--jinja**: This flag activates the Jinja2 chat template processor.
26
- > - **--chat-template-file**: This flag points the server to the required template file that defines the WiNGPT-Babel-2's custom prompt format.
27
-
28
- WiNGPT-Babel-2 is a language model optimized for multilingual translation tasks. As an iteration of WiNGPT-Babel, it features significant improvements in language coverage, data format handling, and translation accuracy for complex content.
29
-
30
- The model continues the "Human-in-the-loop" training strategy, iteratively optimizing through the analysis of log data from real-world application scenarios to ensure its effectiveness and reliability in practical use.
31
-
32
- ## Core Improvements in Version 2.0
33
-
34
- WiNGPT-Babel-2 introduces the following key technical upgrades over its predecessor:
35
-
36
- 1. **Expanded Language Support:** Through training with the `wmt24pp` dataset, language support has been extended to **55 languages**, primarily enhancing translation capabilities from English (en) to other target languages (xx).
37
-
38
- 2. **Enhanced Chinese Translation:** The translation pipeline from other source languages to Chinese (xx โ†’ zh) has been specifically optimized, improving the accuracy and fluency of the results.
39
-
40
- 3. **Structured Data Translation:** The model can now identify and translate text fields embedded within **structured data (e.g., JSON)** while preserving the original data structure. This feature is suitable for scenarios such as API internationalization and multilingual dataset preprocessing.
41
-
42
- 4. **Mixed-Content Handling:** Its ability to handle mixed-content text has been improved, enabling more accurate translation of paragraphs containing **mathematical expressions (LaTeX), code snippets, and web markup (HTML/Markdown)**, while preserving the format and integrity of these non-translatable elements.
43
-
44
- ## Training Methodology
45
-
46
- The performance improvements in WiNGPT-Babel-2 are attributed to a continuous, data-driven, iterative training process:
47
-
48
- 1. **Data Collection:** Collecting anonymous, real-world translation task logs from integrated applications (e.g., Immersive Translate, Videolingo).
49
- 2. **Data Refinement:** Using a reward model for rejection sampling on the collected data, supplemented by manual review, to filter high-quality, high-value samples for constructing new training datasets.
50
- 3. **Iterative Retraining:** Using the refined data for the model's incremental training, continuously improving its performance in specific domains and scenarios through a cyclical iterative process.
51
-
52
- ## Technical Specifications
53
-
54
- * **Base Model:** [GemmaX2-28-2B-Pretrain](https://huggingface.co/ModelSpace/GemmaX2-28-2B-Pretrain)
55
- * **Primary Training Data:** "Human-in-the-loop" in-house dataset, [WMT24++](https://huggingface.co/datasets/google/wmt24pp) dataset
56
- * **Maximum Context Length:** 4096 tokens
57
- * **Chat Capability:** Supports multi-turn dialogue, allowing for contextual follow-up and translation refinement.
58
-
59
- ## Language Support
60
-
61
- | Direction | Description | Supported Languages (Partial List) |
62
- | :---------------------- | :--------------------------------------------------- | :----------------------------------------------------------- |
63
- | **Core Support** | Highest quality, extensively optimized. | `en โ†” zh` |
64
- | **Expanded Support** | Supported via `wmt24pp` dataset training. | `en โ†’ 55+ languages`, including: `fr`, `de`, `es`, `ru`, `ar`, `pt`, `ko`, `it`, `nl`, `tr`, `pl`, `sv`... |
65
- | **Enhanced to Chinese** | Specifically optimized for translation into Chinese. | `xx โ†’ zh` |
66
-
67
- ## Performance
68
- <table>
69
- <thead>
70
- <tr>
71
- <th rowspan="2" align="center">Model</th>
72
- <th colspan="2" align="center">FLORES-200</th>
73
- </tr>
74
- <tr>
75
- <th align="center">xx โ†’ en</th>
76
- <th align="center">xx โ†’ zh</th>
77
- </tr>
78
- </thead>
79
- <tbody>
80
- <tr>
81
- <td align="center">WiNGPT-Babel-AWQ</td>
82
- <td align="center">33.91</td>
83
- <td align="center">17.29</td>
84
- </tr>
85
- <tr>
86
- <td align="center">WiNGPT-Babel-2-AWQ</td>
87
- <td align="center">36.43</td>
88
- <td align="center">30.74</td>
89
- </tr>
90
- </tbody>
91
- </table>
92
-
93
- **Note**:
94
- 1. The evaluation metric is spBLEU, using the FLORES-200 tokenizer.
95
-
96
- 3. 'xx' represents the 52 source languages from the wmt24pp dataset.
97
-
98
- ## Usage Guide
99
-
100
- For optimal inference performance, it is recommended to use frameworks such as `vllm`. The following provides a basic usage example using the Hugging Face `transformers` library.
101
-
102
- **System Prompt:** For optimal automatic language inference, it is recommended to use the unified system prompt: `Translate this to {{to}} Language`. Replace `{{to}}` with the name of the target language. For instance, use `Translate this to Simplified Chinese Language` to translate into Chinese, or `Translate this to English Language` to translate into English. This method provides precise control over the translation direction and yields the most reliable results.
103
-
104
- ### Example
105
-
106
- ```python
107
- from transformers import AutoModelForCausalLM, AutoTokenizer
108
-
109
- model_name = "winninghealth/WiNGPT-Babel-2-AWQ"
110
-
111
- model = AutoModelForCausalLM.from_pretrained(
112
- model_name,
113
- torch_dtype="auto",
114
- device_map="auto"
115
- )
116
- tokenizer = AutoTokenizer.from_pretrained(model_name)
117
-
118
- # Example: Translation of text within a JSON object to Chinese
119
- prompt_json = """{
120
- "product_name": "High-Performance Laptop",
121
- "features": ["Fast Processor", "Long Battery Life", "Lightweight Design"]
122
- }"""
123
-
124
- messages = [
125
- {"role": "system", "content": "Translate this to Simplified Chinese Language"},
126
- {"role": "user", "content": prompt_json} # Replace with the desired prompt
127
- ]
128
-
129
- text = tokenizer.apply_chat_template(
130
- messages,
131
- tokenize=False,
132
- add_generation_prompt=True
133
- )
134
- model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
135
-
136
- generated_ids = model.generate(
137
- **model_inputs,
138
- max_new_tokens=4096,
139
- temperature=0
140
- )
141
-
142
- generated_ids = [
143
- output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
144
- ]
145
-
146
- response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
147
- ```
148
-
149
- For additional usage demos, you can refer to the original [WiNGPT-Babel](https://huggingface.co/winninghealth/WiNGPT-Babel#%F0%9F%8E%AC-%E7%A4%BA%E4%BE%8B).
150
-
151
- ## LICENSE
152
-
153
- 1. This project's license agreement is the Apache License 2.0
154
-
155
- 2. Please cite this project when using its model weights: https://huggingface.co/winninghealth/WiNGPT-Babel-2
156
-
157
- 3. Comply with [gemma-2-2b](https://huggingface.co/google/gemma-2-2b), [GemmaX2-28-2B-v0.1](https://huggingface.co/ModelSpace/GemmaX2-28-2B-v0.1), [immersive-translate](https://github.com/immersive-translate/immersive-translate), [VideoLingo](https://github.com/immersive-translate/immersive-translate) protocols and licenses, details on their website.
158
-
159
-
160
- ## Contact Us
161
-
162
- - Apply for a token through the WiNGPT platform
 
 
 
163
  - Or contact us at [email protected] to request a free trial API_KEY
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ - zh
6
+ base_model:
7
+ - winninghealth/WiNGPT-Babel-2
8
+ tags:
9
+ - GGUF
10
+ - translation
11
+ - llm
12
+ - multilingual
13
+ ---
14
+
15
+ # WiNGPT-Babel-2: A Multilingual Translation Language Model
16
+
17
+ [![Hugging Face](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-WiNGPT--Babel-blue)](https://huggingface.co/collections/winninghealth/wingpt-babel-68463d4b2a28d0d675ff3be9)
18
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-yellow.svg)](https://opensource.org/licenses/Apache-2.0)
19
+
20
+ > This is the quantization version (llama.cpp) of [WiNGPT-Babel-2](https://huggingface.co/winninghealth/WiNGPT-Babel-2).
21
+ >
22
+ > Example
23
+ >
24
+ > ```shell
25
+ > ./llama-server -m WiNGPT-Babel-2-GGUF/WiNGPT-Babel-2-IQ4_XS.gguf --jinja --chat-template-file WiNGPT-Babel-2-GGUF/WiNGPT-Babel-2.jinja
26
+ > ```
27
+ >
28
+ > - **--jinja**: This flag activates the Jinja2 chat template processor.
29
+ > - **--chat-template-file**: This flag points the server to the required template file that defines the WiNGPT-Babel-2's custom prompt format.
30
+
31
+ WiNGPT-Babel-2 is a language model optimized for multilingual translation tasks. As an iteration of WiNGPT-Babel, it features significant improvements in language coverage, data format handling, and translation accuracy for complex content.
32
+
33
+ The model continues the "Human-in-the-loop" training strategy, iteratively optimizing through the analysis of log data from real-world application scenarios to ensure its effectiveness and reliability in practical use.
34
+
35
+ ## Core Improvements in Version 2.0
36
+
37
+ WiNGPT-Babel-2 introduces the following key technical upgrades over its predecessor:
38
+
39
+ 1. **Expanded Language Support:** Through training with the `wmt24pp` dataset, language support has been extended to **55 languages**, primarily enhancing translation capabilities from English (en) to other target languages (xx).
40
+
41
+ 2. **Enhanced Chinese Translation:** The translation pipeline from other source languages to Chinese (xx โ†’ zh) has been specifically optimized, improving the accuracy and fluency of the results.
42
+
43
+ 3. **Structured Data Translation:** The model can now identify and translate text fields embedded within **structured data (e.g., JSON)** while preserving the original data structure. This feature is suitable for scenarios such as API internationalization and multilingual dataset preprocessing.
44
+
45
+ 4. **Mixed-Content Handling:** Its ability to handle mixed-content text has been improved, enabling more accurate translation of paragraphs containing **mathematical expressions (LaTeX), code snippets, and web markup (HTML/Markdown)**, while preserving the format and integrity of these non-translatable elements.
46
+
47
+ ## Training Methodology
48
+
49
+ The performance improvements in WiNGPT-Babel-2 are attributed to a continuous, data-driven, iterative training process:
50
+
51
+ 1. **Data Collection:** Collecting anonymous, real-world translation task logs from integrated applications (e.g., Immersive Translate, Videolingo).
52
+ 2. **Data Refinement:** Using a reward model for rejection sampling on the collected data, supplemented by manual review, to filter high-quality, high-value samples for constructing new training datasets.
53
+ 3. **Iterative Retraining:** Using the refined data for the model's incremental training, continuously improving its performance in specific domains and scenarios through a cyclical iterative process.
54
+
55
+ ## Technical Specifications
56
+
57
+ * **Base Model:** [GemmaX2-28-2B-Pretrain](https://huggingface.co/ModelSpace/GemmaX2-28-2B-Pretrain)
58
+ * **Primary Training Data:** "Human-in-the-loop" in-house dataset, [WMT24++](https://huggingface.co/datasets/google/wmt24pp) dataset
59
+ * **Maximum Context Length:** 4096 tokens
60
+ * **Chat Capability:** Supports multi-turn dialogue, allowing for contextual follow-up and translation refinement.
61
+
62
+ ## Language Support
63
+
64
+ | Direction | Description | Supported Languages (Partial List) |
65
+ | :---------------------- | :--------------------------------------------------- | :----------------------------------------------------------- |
66
+ | **Core Support** | Highest quality, extensively optimized. | `en โ†” zh` |
67
+ | **Expanded Support** | Supported via `wmt24pp` dataset training. | `en โ†’ 55+ languages`, including: `fr`, `de`, `es`, `ru`, `ar`, `pt`, `ko`, `it`, `nl`, `tr`, `pl`, `sv`... |
68
+ | **Enhanced to Chinese** | Specifically optimized for translation into Chinese. | `xx โ†’ zh` |
69
+
70
+ ## Performance
71
+ <table>
72
+ <thead>
73
+ <tr>
74
+ <th rowspan="2" align="center">Model</th>
75
+ <th colspan="2" align="center">FLORES-200</th>
76
+ </tr>
77
+ <tr>
78
+ <th align="center">xx โ†’ en</th>
79
+ <th align="center">xx โ†’ zh</th>
80
+ </tr>
81
+ </thead>
82
+ <tbody>
83
+ <tr>
84
+ <td align="center">WiNGPT-Babel-AWQ</td>
85
+ <td align="center">33.91</td>
86
+ <td align="center">17.29</td>
87
+ </tr>
88
+ <tr>
89
+ <td align="center">WiNGPT-Babel-2-AWQ</td>
90
+ <td align="center">36.43</td>
91
+ <td align="center">30.74</td>
92
+ </tr>
93
+ </tbody>
94
+ </table>
95
+
96
+ **Note**:
97
+ 1. The evaluation metric is spBLEU, using the FLORES-200 tokenizer.
98
+
99
+ 3. 'xx' represents the 52 source languages from the wmt24pp dataset.
100
+
101
+ ## Usage Guide
102
+
103
+ For optimal inference performance, it is recommended to use frameworks such as `vllm`. The following provides a basic usage example using the Hugging Face `transformers` library.
104
+
105
+ **System Prompt:** For optimal automatic language inference, it is recommended to use the unified system prompt: `Translate this to {{to}} Language`. Replace `{{to}}` with the name of the target language. For instance, use `Translate this to Simplified Chinese Language` to translate into Chinese, or `Translate this to English Language` to translate into English. This method provides precise control over the translation direction and yields the most reliable results.
106
+
107
+ ### Example
108
+
109
+ ```python
110
+ from transformers import AutoModelForCausalLM, AutoTokenizer
111
+
112
+ model_name = "winninghealth/WiNGPT-Babel-2-AWQ"
113
+
114
+ model = AutoModelForCausalLM.from_pretrained(
115
+ model_name,
116
+ torch_dtype="auto",
117
+ device_map="auto"
118
+ )
119
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
120
+
121
+ # Example: Translation of text within a JSON object to Chinese
122
+ prompt_json = """{
123
+ "product_name": "High-Performance Laptop",
124
+ "features": ["Fast Processor", "Long Battery Life", "Lightweight Design"]
125
+ }"""
126
+
127
+ messages = [
128
+ {"role": "system", "content": "Translate this to Simplified Chinese Language"},
129
+ {"role": "user", "content": prompt_json} # Replace with the desired prompt
130
+ ]
131
+
132
+ text = tokenizer.apply_chat_template(
133
+ messages,
134
+ tokenize=False,
135
+ add_generation_prompt=True
136
+ )
137
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
138
+
139
+ generated_ids = model.generate(
140
+ **model_inputs,
141
+ max_new_tokens=4096,
142
+ temperature=0
143
+ )
144
+
145
+ generated_ids = [
146
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
147
+ ]
148
+
149
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
150
+ ```
151
+
152
+ For additional usage demos, you can refer to the original [WiNGPT-Babel](https://huggingface.co/winninghealth/WiNGPT-Babel#%F0%9F%8E%AC-%E7%A4%BA%E4%BE%8B).
153
+
154
+ ## LICENSE
155
+
156
+ 1. This project's license agreement is the Apache License 2.0
157
+
158
+ 2. Please cite this project when using its model weights: https://huggingface.co/winninghealth/WiNGPT-Babel-2
159
+
160
+ 3. Comply with [gemma-2-2b](https://huggingface.co/google/gemma-2-2b), [GemmaX2-28-2B-v0.1](https://huggingface.co/ModelSpace/GemmaX2-28-2B-v0.1), [immersive-translate](https://github.com/immersive-translate/immersive-translate), [VideoLingo](https://github.com/immersive-translate/immersive-translate) protocols and licenses, details on their website.
161
+
162
+
163
+ ## Contact Us
164
+
165
+ - Apply for a token through the WiNGPT platform
166
  - Or contact us at [email protected] to request a free trial API_KEY