|
--- |
|
license: cc-by-sa-4.0 |
|
datasets: |
|
- laion/OIG |
|
- Hello-SimpleAI/HC3 |
|
- databricks/databricks-dolly-15k |
|
language: |
|
- en |
|
- th |
|
- ja |
|
- vi |
|
pipeline_tag: text-generation |
|
--- |
|
# Model Card for WangChanGLM 🐘 - The Multilingual Instruction-Following Model |
|
|
|
<!-- Provide a longer summary of what this model is. --> |
|
|
|
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](). |
|
|
|
- **Developed by:** [PyThaiNLP](https://www.github.com/pythainlp) and [VISTEC-depa AI Research Institute of Thailand](https://huggingface.co/airesearch) |
|
- **Model type:** Finetuned [XGLM-7.5B](https://huggingface.co/facebook/xglm-7.5B) |
|
- **Language(s) (NLP)**: `en`, `th`, `ja`, `vi` capacibilities evaluated, theoretically all 30 languages of [XGLM-7.5B](https://huggingface.co/facebook/xglm-7.5B) |
|
- **License:** [CC-BY SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) |
|
|
|
### Model Sources |
|
|
|
<!-- Provide the basic links for the model. --> |
|
|
|
- **Repository:** [pythainlp/wangchanglm](https://www.github.com/pythainlp/wangchanglm) |
|
- **Blog:** [Medium](https://link.medium.com/s2MWr3ZXnzb) |
|
- **Demo:** [Colab notebook](https://colab.research.google.com/github/pythainlp/WangChanGLM/blob/main/demo/WangChanGLM_v0_1_demo.ipynb) |
|
|
|
## Uses |
|
|
|
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. --> |
|
|
|
### Direct Use |
|
|
|
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. --> |
|
|
|
Intended to be use as an instruction-following model for reading comprehension, brainstorming and creative writing. |
|
|
|
### Downstream Use |
|
|
|
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app --> |
|
|
|
The model can be finetuned for any typical instruction-following use cases. |
|
|
|
### Out-of-Scope Use |
|
|
|
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. --> |
|
|
|
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. |
|
|
|
## Bias, Risks, and Limitations |
|
|
|
<!-- This section is meant to convey both technical and sociotechnical limitations. --> |
|
|
|
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. |
|
|
|
### Recommendations |
|
|
|
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. --> |
|
|
|
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations. |
|
|
|
## How to Get Started with the Model |
|
|
|
Use the code below to get started with the model. |
|
|
|
``` |
|
model_name = "pythainlp/wangchanglm-7.5B-sft-en" |
|
model = AutoModelForCausalLM.from_pretrained( |
|
model_name, |
|
return_dict=True, |
|
load_in_8bit=True , |
|
device_map="auto", |
|
torch_dtype=torch.float16, |
|
offload_folder="./", |
|
low_cpu_mem_usage=True, |
|
) |
|
text = "เล่นหุ้นยังไงให้รวย" |
|
tokenizer = AutoTokenizer.from_pretrained(model_name) |
|
batch = tokenizer(text, return_tensors="pt") |
|
with torch.cuda.amp.autocast(): |
|
output_tokens = model.generate( |
|
input_ids=batch["input_ids"], |
|
max_new_tokens=max_gen_len, # 512 |
|
begin_suppress_tokens = exclude_ids, |
|
no_repeat_ngram_size=2, |
|
|
|
#oasst k50 |
|
top_k=50, |
|
top_p=top_p, # 0.95 |
|
typical_p=1., |
|
temperature=temperature, # 0.9 |
|
|
|
# #oasst typical3 |
|
# typical_p = 0.3, |
|
# temperature = 0.8, |
|
# repetition_penalty = 1.2, |
|
) |
|
tokenizer.decode(output_tokens[0], skip_special_tokens=True) |
|
``` |
|
|
|
## Training Details |
|
|
|
### Training Data |
|
|
|
<!-- 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. --> |
|
|
|
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/)). |
|
|
|
### Training Procedure |
|
|
|
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. --> |
|
|
|
#### Preprocessing |
|
|
|
See [pythainlp/wangchanglm](https://www.github.com/pythainlp/wangchanglm). |
|
|
|
|
|
#### Training Hyperparameters |
|
|
|
- **Training regime:** LoRA with 4 GPUs. See more details at [pythainlp/wangchanglm](https://www.github.com/pythainlp/wangchanglm). |
|
|
|
## Evaluation |
|
|
|
<!-- This section describes the evaluation protocols and provides the results. --> |
|
|
|
We performed automatic evaluation in the style of [Vicuna](https://vicuna.lmsys.org/) and human evaluation. See more details from our [blog](). |
|
|
|
## Environmental Impact |
|
|
|
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly --> |
|
|
|
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). |
|
|
|
## Citation |
|
|
|
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. --> |
|
|
|
**BibTeX:** |
|
|
|
``` |
|
@software{charin_polpanumas_2023_7878101, |
|
author = {Charin Polpanumas and |
|
Wannaphong Phatthiyaphaibun and |
|
Patomporn Payoungkhamdee and |
|
Peerat Limkonchotiwat and |
|
Lalita Lowphansirikul and |
|
Can Udomcharoenchaikit and |
|
Titipat Achakulwisut and |
|
Ekapol Chuangsuwanich and |
|
Sarana Nutanong}, |
|
title = {{WangChanGLM🐘 — The Multilingual Instruction- |
|
Following Model}}, |
|
month = apr, |
|
year = 2023, |
|
publisher = {Zenodo}, |
|
version = {v0.1}, |
|
doi = {10.5281/zenodo.7878101}, |
|
url = {https://doi.org/10.5281/zenodo.7878101} |
|
} |
|
``` |
|
|
|
## Model Card Contact |
|
|
|
[PyThaiNLP](https://github.com/pythainlp) |