RaymondAISG
commited on
Commit
•
f83519b
1
Parent(s):
c6f2274
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,154 @@
|
|
1 |
---
|
2 |
license: mit
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
---
|
4 |
+
# SEA-LION-7B-Instruct-GPTQ
|
5 |
+
|
6 |
+
SEA-LION is a collection of Large Language Models (LLMs) which has been pretrained and instruct-tuned for the Southeast Asia (SEA) region.
|
7 |
+
The sizes of the models range from 3 billion to 7 billion parameters.
|
8 |
+
|
9 |
+
SEA-LION-7B-Instruct is a multilingual model which has been fine-tuned with **thousands of English and Indonesian instruction-completion pairs** alongside a smaller pool of instruction-completion pairs from other ASEAN languages.
|
10 |
+
These instructions have been carefully curated and rewritten to ensure the model was trained on truly open, commercially permissive and high quality datasets.
|
11 |
+
|
12 |
+
SEA-LION-7B-Instruct-GPTQ is the quantized version of the SEA-LION-7B-Instruct model using a [modified version](https://github.com/caviato/AutoGPTQ) of the [AutoGPTQ](https://github.com/AutoGPTQ/AutoGPTQ) library with Wikipedia texts.
|
13 |
+
|
14 |
+
SEA-LION stands for _Southeast Asian Languages In One Network_.
|
15 |
+
|
16 |
+
- **Developed by:** Products Pillar, AI Singapore
|
17 |
+
- **Funded by:** Singapore NRF
|
18 |
+
- **Model type:** Decoder
|
19 |
+
- **Languages:** English, Chinese, Indonesian, Malay, Thai, Vietnamese, Filipino, Tamil, Burmese, Khmer, Lao
|
20 |
+
- **License:** MIT License
|
21 |
+
|
22 |
+
## Model Details
|
23 |
+
### Base model
|
24 |
+
SEA-LION-7B-Instruct-GPTQ is quantized from [SEA-LION-7B-Instruct](https://huggingface.co/aisingapore/sea-lion-7b-instruct).
|
25 |
+
|
26 |
+
### Benchmark Performance
|
27 |
+
|
28 |
+
|
29 |
+
| Model | ARC | HellaSwag | MMLU | TruthfulQA | Average |
|
30 |
+
|--------------------------------------------------|:-----:|:---------:|:-----:|:----------:|:-------:|
|
31 |
+
| SEA-LION 7B Instruct (FP16) | 40.78 | 68.20 | 27.12 | 36.29 | 43.10 |
|
32 |
+
| SEA-LION 7B Instruct GPTQ (4-Bit, 128 group size)| 39.93 | 67.32 | 27.11 | 36.32 | 42.67 |
|
33 |
+
|
34 |
+
### Usage
|
35 |
+
For the full installation, training and inference guide, please refer to the [Github](https://github.com/caviato/sealion-gptq).
|
36 |
+
|
37 |
+
In order for SEA-LION-7B-Instruct-GPTQ to work, please install the [modified version of the AutoGPTQ](https://github.com/caviato/AutoGPTQ) library. Installation information can be found [here](https://github.com/caviato/AutoGPTQ#install-from-source).
|
38 |
+
|
39 |
+
SEA-LION can be run using the 🤗 Transformers library
|
40 |
+
```python
|
41 |
+
# Please use transformers>=4.37.2
|
42 |
+
|
43 |
+
from transformers import AutoTokenizer
|
44 |
+
from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
|
45 |
+
import torch
|
46 |
+
|
47 |
+
tokenizer = AutoTokenizer.from_pretrained( # will be loaded to GPU
|
48 |
+
"aisingapore/sea-lion-7b-instruct-gptq",
|
49 |
+
trust_remote_code=True,
|
50 |
+
device_map = "cuda",
|
51 |
+
)
|
52 |
+
|
53 |
+
quantize_config = BaseQuantizeConfig(
|
54 |
+
bits=4,
|
55 |
+
group_size=128
|
56 |
+
)
|
57 |
+
|
58 |
+
model = AutoGPTQForCausalLM.from_quantized( # will be loaded to GPU
|
59 |
+
"aisingapore/sea-lion-7b-instruct-gptq",
|
60 |
+
device = "cuda:0",
|
61 |
+
quantize_config = quantize_config,
|
62 |
+
torch_dtype=torch.float16,
|
63 |
+
trust_remote_code = True
|
64 |
+
)
|
65 |
+
|
66 |
+
generation_kwargs = {
|
67 |
+
"do_sample": False, # set to true if temperature is not 0
|
68 |
+
"temperature": None,
|
69 |
+
"max_new_tokens": 256,
|
70 |
+
"top_k": 50,
|
71 |
+
"top_p": 0.7,
|
72 |
+
"repetition_penalty": 1.2,
|
73 |
+
"eos_token_id": tokenizer.eos_token_id
|
74 |
+
}
|
75 |
+
|
76 |
+
prompt_template = "### USER:\n{human_prompt}\n\n### RESPONSE:\n"
|
77 |
+
prompt_in = """Apa sentimen dari kalimat berikut ini?
|
78 |
+
Kalimat: Buku ini sangat membosankan.
|
79 |
+
Jawaban: """
|
80 |
+
|
81 |
+
full_prompt = prompt_template.format(human_prompt=prompt_in)
|
82 |
+
|
83 |
+
tokens = tokenizer(full_prompt, return_tensors="pt")
|
84 |
+
|
85 |
+
input_ids = tokens["input_ids"].to("cuda:0") # move tokenized input to GPU
|
86 |
+
|
87 |
+
# Remove unneeded kwargs
|
88 |
+
if generation_kwargs["do_sample"] == False:
|
89 |
+
generation_kwargs.pop("temperature")
|
90 |
+
generation_kwargs.pop("top_k")
|
91 |
+
generation_kwargs.pop("top_p")
|
92 |
+
|
93 |
+
output = model.generate(
|
94 |
+
input_ids = input_ids,
|
95 |
+
**generation_kwargs
|
96 |
+
)
|
97 |
+
|
98 |
+
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
99 |
+
```
|
100 |
+
### Prompting Guide
|
101 |
+
|
102 |
+
_Coming soon_
|
103 |
+
|
104 |
+
### Caveats
|
105 |
+
It is important for users to be aware that our model exhibits certain limitations that warrant consideration. Firstly, like many LLMs, the model can hallucinate and occasionally generates irrelevant content, introducing fictional elements that are not grounded in the provided context. Users should also exercise caution in interpreting and validating the model's responses due to the potential inconsistencies in its reasoning. Finally, it should be noted that the model has not been optimized for multi-turn dialogue interactions, which may result in reduced effectiveness in extended conversations.
|
106 |
+
|
107 |
+
## Limitations
|
108 |
+
### Safety
|
109 |
+
|
110 |
+
Current SEA-LION models, including this commercially permissive release, have not been aligned for safety. Developers and users should perform their own safety fine-tuning and related security measures. In no event shall the authors be held liable for any claim, damages, or other liability arising from the use of the released weights and codes.
|
111 |
+
|
112 |
+
### Commercially Non-Permissive and Commercially Permissive SEA-LION Releases
|
113 |
+
|
114 |
+
The previous release of the commercially non-permissive SEA-LION-Instruct-Research enabled us to explore the full research potential of SEA-LION when allowed to take full advantage of what is publicly available. In contrast, in building the commercially permissive SEA-LION-7B-Instruct, we had to leave out high-quality instruction data that was either proprietary, restricted by non-commercial licenses or in a legal gray area, leaving us with a much smaller proportion of commercially permissive data to work with — a problem that is even more pronounced for low-resource languages. We thus hope this will sound a call to action for more initiatives to create commercially viable data in the region, enabling practical benefits for all.
|
115 |
+
|
116 |
+
|
117 |
+
## Technical Specifications
|
118 |
+
### Fine-Tuning Details
|
119 |
+
The SEA-LION-7B-Instruct was fine-tuned using 8x A100-40GB using parameter efficient fine tuning in the form of LoRA.
|
120 |
+
|
121 |
+
## Data
|
122 |
+
SEA-LION-7B-Instruct was trained on a wide range of instructions that were manually and stringently verified by our team. A large portion of the effort was dedicated to ensuring that each instruction-completion pair that the model sees is of a high quality and any errors were corrected and rewritten by native speakers or else dropped from our mix.
|
123 |
+
|
124 |
+
In addition, special care was taken to ensure that the datasets used had commercially permissive licenses through verification with the original data source.
|
125 |
+
|
126 |
+
Link to dataset: _coming soon_
|
127 |
+
|
128 |
+
## Call for Contributions
|
129 |
+
We encourage researchers, developers, and language enthusiasts to actively contribute to the enhancement and expansion of SEA-LION. Contributions can involve identifying and reporting bugs, sharing pre-training, instruction, and preference data, improving documentation usability, proposing and implementing new model evaluation tasks and metrics, or training versions of the model in additional Southeast Asian languages. Join us in shaping the future of SEA-LION by sharing your expertise and insights to make these models more accessible, accurate, and versatile. Please check out our GitHub for further information on the call for contributions.
|
130 |
+
|
131 |
+
## The Team
|
132 |
+
|
133 |
+
Bui Quang Huy (NUS)<br>
|
134 |
+
Jasshan Kumeresh (NUS)<br>
|
135 |
+
Ng Boon Cheong Raymond<br>
|
136 |
+
Siow Bryan<br>
|
137 |
+
Teng Walter<br>
|
138 |
+
|
139 |
+
## Acknowledgements
|
140 |
+
|
141 |
+
[AI Singapore](https://aisingapore.org/) is a national programme supported by the National Research Foundation, Singapore and hosted by the National University of Singapore. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not reflect the views of the National Research Foundation or the National University of Singapore.
|
142 |
+
|
143 |
+
## Contact
|
144 |
+
|
145 |
+
For more info, please contact us using this [SEA-LION Inquiry Form](https://forms.gle/sLCUVb95wmGf43hi6)
|
146 |
+
|
147 |
+
[Link to SEA-LION's GitHub repository](https://github.com/aisingapore/sealion)
|
148 |
+
|
149 |
+
## Disclaimer
|
150 |
+
|
151 |
+
This is the repository for the commercial instruction-tuned model.
|
152 |
+
The model has _not_ been aligned for safety.
|
153 |
+
Developers and users should perform their own safety fine-tuning and related security measures.
|
154 |
+
In no event shall the authors be held liable for any claims, damages, or other liabilities arising from the use of the released weights and codes.
|