Update README.md
Browse files
README.md
CHANGED
@@ -1,11 +1,171 @@
|
|
1 |
---
|
2 |
-
license: cc
|
|
|
|
|
|
|
|
|
3 |
language:
|
4 |
-
- th
|
5 |
- en
|
|
|
6 |
- ja
|
7 |
- vi
|
8 |
pipeline_tag: text-generation
|
9 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
-
# WangChanGLM 🐘 — The Thai-Turned-Multilingual Instruction-Following Model
|
|
|
1 |
---
|
2 |
+
license: cc
|
3 |
+
datasets:
|
4 |
+
- laion/OIG
|
5 |
+
- Hello-SimpleAI/HC3
|
6 |
+
- databricks/databricks-dolly-15k
|
7 |
language:
|
|
|
8 |
- en
|
9 |
+
- th
|
10 |
- ja
|
11 |
- vi
|
12 |
pipeline_tag: text-generation
|
13 |
---
|
14 |
+
# Model Card for WangChanGLM 🐘 - The Multilingual Instruction-Following Model
|
15 |
+
|
16 |
+
<!-- Provide a longer summary of what this model is. -->
|
17 |
+
|
18 |
+
WangChanGLM is a multilingual, instruction-finetuned Facebook XGLM-7.5B using open-source, commercially permissible datasets (LAION OIG chip2 and infill_dbpedia, DataBricks Dolly v2, OpenAI TL;DR, and Hello-SimpleAI HC3; about 400k examples), released under CC-BY SA 4.0. The models are trained to perform a subset of instruction-following tasks we found most relevant namely: reading comprehension, brainstorming, and creative writing. We provide the weights for a model finetuned on an English-only dataset ([wangchanglm-7.5B-sft-en](https://huggingface.co/pythainlp/wangchanglm-7.5B-sft-en)) and another checkpoint further finetuned on Google-Translated Thai dataset ([wangchanglm-7.5B-sft-enth](https://huggingface.co/pythainlp/wangchanglm-7.5B-sft-enth)). We perform Vicuna-style evaluation using both humans and ChatGPT (in our case, `gpt-3.5-turbo` since we are still on the waitlist for `gpt-4`) and observe some discrepancies between the two types of annoators. All training and evaluation codes are shared under the [Apache-2.0 license](https://github.com/pythainlp/wangchanglm/blob/main/LICENSE) in our Github, as well as datasets and model weights on [HuggingFace](https://huggingface.co/pythainlp). In a similar manner to [Dolly v2](https://www.databricks.com/blog/2023/04/12/dolly-first-open-commercially-viable-instruction-tuned-llm), we use only use open-source, commercially permissive pretrained models and datasets, our models are neither restricted by non-commercial clause like models that use LLaMA as base nor non-compete clause like models that use self-instruct datasets from ChatGPT. See our live demo [here]().
|
19 |
+
|
20 |
+
- **Developed by:** [PyThaiNLP](https://www.github.com/pythainlp) and [VISTEC-depa AI Research Institute of Thailand](https://huggingface.co/airesearch)
|
21 |
+
- **Model type:** Finetuned [XGLM-7.5B](https://huggingface.co/facebook/xglm-7.5B)
|
22 |
+
- **Language(s) (NLP)**: `en`, `th`, `ja`, `vi` capacibilities evaluated, theoretically all 30 languages of [XGLM-7.5B](https://huggingface.co/facebook/xglm-7.5B)
|
23 |
+
- **License:** [CC-BY SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)
|
24 |
+
|
25 |
+
### Model Sources
|
26 |
+
|
27 |
+
<!-- Provide the basic links for the model. -->
|
28 |
+
|
29 |
+
- **Repository:** [pythainlp/wangchanglm](https://www.github.com/pythainlp/wangchanglm)
|
30 |
+
- **Blog:** [Medium](https://link.medium.com/s2MWr3ZXnzb)
|
31 |
+
- **Demo:** [Colab notebook](https://colab.research.google.com/github/pythainlp/WangChanGLM/blob/main/demo/WangChanGLM_v0_1_demo.ipynb)
|
32 |
+
|
33 |
+
## Uses
|
34 |
+
|
35 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
36 |
+
|
37 |
+
### Direct Use
|
38 |
+
|
39 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
40 |
+
|
41 |
+
Intended to be use as an instruction-following model for reading comprehension, brainstorming and creative writing.
|
42 |
+
|
43 |
+
### Downstream Use
|
44 |
+
|
45 |
+
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
46 |
+
|
47 |
+
The model can be finetuned for any typical instruction-following use cases.
|
48 |
+
|
49 |
+
### Out-of-Scope Use
|
50 |
+
|
51 |
+
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
52 |
+
|
53 |
+
We do not expect the models to perform well in math problems, reasoning, and factfulness. We intentionally filter out training examples from these use cases.
|
54 |
+
|
55 |
+
## Bias, Risks, and Limitations
|
56 |
+
|
57 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
58 |
+
|
59 |
+
We noticed similar limitations to other finetuned instruction followers such as math problems, reasoning, and factfulness. Even though the models do not perform on the level that we expect them to be abused, they do contain undesirable biases and toxicity and should be further optimized for your particular use cases.
|
60 |
+
|
61 |
+
### Recommendations
|
62 |
+
|
63 |
+
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
64 |
+
|
65 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
66 |
+
|
67 |
+
## How to Get Started with the Model
|
68 |
+
|
69 |
+
Use the code below to get started with the model.
|
70 |
+
|
71 |
+
```
|
72 |
+
name_model = "pythainlp/wangchanglm-7.5B-sft-en"
|
73 |
+
model = AutoModelForCausalLM.from_pretrained(
|
74 |
+
model_name,
|
75 |
+
return_dict=True,
|
76 |
+
load_in_8bit=True ,
|
77 |
+
device_map="auto",
|
78 |
+
torch_dtype=torch.float16,
|
79 |
+
offload_folder="./",
|
80 |
+
low_cpu_mem_usage=True,
|
81 |
+
)
|
82 |
+
text = "เล่นหุ้นยังไงให้รวย"
|
83 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
84 |
+
batch = tokenizer(text, return_tensors="pt")
|
85 |
+
with torch.cuda.amp.autocast():
|
86 |
+
output_tokens = model.generate(
|
87 |
+
input_ids=batch["input_ids"],
|
88 |
+
max_new_tokens=max_gen_len, # 512
|
89 |
+
begin_suppress_tokens = exclude_ids,
|
90 |
+
no_repeat_ngram_size=2,
|
91 |
+
|
92 |
+
#oasst k50
|
93 |
+
top_k=50,
|
94 |
+
top_p=top_p, # 0.95
|
95 |
+
typical_p=1.,
|
96 |
+
temperature=temperature, # 0.9
|
97 |
+
|
98 |
+
# #oasst typical3
|
99 |
+
# typical_p = 0.3,
|
100 |
+
# temperature = 0.8,
|
101 |
+
# repetition_penalty = 1.2,
|
102 |
+
)
|
103 |
+
tokenizer.decode(output_tokens[0], skip_special_tokens=True)
|
104 |
+
```
|
105 |
+
|
106 |
+
## Training Details
|
107 |
+
|
108 |
+
### Training Data
|
109 |
+
|
110 |
+
<!-- This should link to a Data 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. -->
|
111 |
+
|
112 |
+
Finetuning datasets are sourced from [LAION OIG chip2 and infill_dbpedia](https://huggingface.co/datasets/laion/OIG) ([Apache-2.0](https://github.com/pythainlp/wangchanglm/blob/main/LICENSE)), [DataBricks Dolly v2](https://github.com/databrickslabs/dolly) ([Apache-2.0](https://github.com/pythainlp/wangchanglm/blob/main/LICENSE)), [OpenAI TL;DR](https://github.com/openai/summarize-from-feedback) ([MIT](https://opensource.org/license/mit/)), and [Hello-SimpleAI HC3](https://huggingface.co/datasets/Hello-SimpleAI/HC3) ([CC-BY SA](https://creativecommons.org/licenses/by-sa/4.0/)).
|
113 |
+
|
114 |
+
### Training Procedure
|
115 |
+
|
116 |
+
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
117 |
+
|
118 |
+
#### Preprocessing
|
119 |
+
|
120 |
+
See [pythainlp/wangchanglm](https://www.github.com/pythainlp/wangchanglm).
|
121 |
+
|
122 |
+
|
123 |
+
#### Training Hyperparameters
|
124 |
+
|
125 |
+
- **Training regime:** LoRA with 4 GPUs. See more details at [pythainlp/wangchanglm](https://www.github.com/pythainlp/wangchanglm).
|
126 |
+
|
127 |
+
## Evaluation
|
128 |
+
|
129 |
+
<!-- This section describes the evaluation protocols and provides the results. -->
|
130 |
+
|
131 |
+
We performed automatic evaluation in the style of [Vicuna](https://vicuna.lmsys.org/) and human evaluation. See more details from our [blog]().
|
132 |
+
|
133 |
+
## Environmental Impact
|
134 |
+
|
135 |
+
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
136 |
+
|
137 |
+
Experiments were conducted using a private infrastructure, which has a carbon efficiency of 0.432 kgCO2eq/kWh. A cumulative of 500 hours of computation was performed on hardware of type Tesla V100-SXM2-32GB (TDP of 300W). Total emissions are estimated to be 64.8 CO2eq of which 0 percents were directly offset. Estimations were conducted using the [MachineLearning Impact calculator](https://mlco2.github.io/impact#compute).
|
138 |
+
|
139 |
+
## Citation
|
140 |
+
|
141 |
+
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
142 |
+
|
143 |
+
**BibTeX:**
|
144 |
+
|
145 |
+
```
|
146 |
+
@software{charin_polpanumas_2023_7878101,
|
147 |
+
author = {Charin Polpanumas and
|
148 |
+
Wannaphong Phatthiyaphaibun and
|
149 |
+
Patomporn Payoungkhamdee and
|
150 |
+
Peerat Limkonchotiwat and
|
151 |
+
Lalita Lowphansirikul and
|
152 |
+
Can Udomcharoenchaikit and
|
153 |
+
Titipat Achakulwisut and
|
154 |
+
Ekapol Chuangsuwanich and
|
155 |
+
Sarana Nutanong},
|
156 |
+
title = {{WangChanGLM🐘 — The Multilingual Instruction-
|
157 |
+
Following Model}},
|
158 |
+
month = apr,
|
159 |
+
year = 2023,
|
160 |
+
publisher = {Zenodo},
|
161 |
+
version = {v0.1},
|
162 |
+
doi = {10.5281/zenodo.7878101},
|
163 |
+
url = {https://doi.org/10.5281/zenodo.7878101}
|
164 |
+
}
|
165 |
+
```
|
166 |
+
|
167 |
+
## Model Card Contact
|
168 |
+
|
169 |
+
[PyThaiNLP](https://github.com/pythainlp)
|
170 |
+
|
171 |
|
|