lamhieu commited on
Commit
3eee42b
β€’
1 Parent(s): cebac53

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +369 -13
README.md CHANGED
@@ -1,22 +1,378 @@
1
  ---
2
  language:
3
  - en
4
- license: apache-2.0
 
 
5
  tags:
6
- - text-generation-inference
7
- - transformers
8
- - unsloth
9
- - mistral
10
- - gguf
11
- base_model: lamhieu/ghost-7b-v0.9.1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  ---
13
 
14
- # Uploaded model
15
 
16
- - **Developed by:** lamhieu
17
- - **License:** apache-2.0
18
- - **Finetuned from model :** lamhieu/ghost-7b-v0.9.1
19
 
20
- This mistral model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
21
 
22
- [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  language:
3
  - en
4
+ - vi
5
+ license: mit
6
+ library_name: transformers
7
  tags:
8
+ - ghost
9
+ pipeline_tag: text-generation
10
+ model-index:
11
+ - name: ghost-7b-v0.9.1
12
+ results:
13
+ - task:
14
+ type: text-generation
15
+ name: Text Generation
16
+ dataset:
17
+ name: AI2 Reasoning Challenge (25-Shot)
18
+ type: ai2_arc
19
+ config: ARC-Challenge
20
+ split: test
21
+ args:
22
+ num_few_shot: 25
23
+ metrics:
24
+ - type: acc_norm
25
+ value: 55.38
26
+ name: normalized accuracy
27
+ source:
28
+ url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=lamhieu/ghost-7b-v0.9.1
29
+ name: Open LLM Leaderboard
30
+ - task:
31
+ type: text-generation
32
+ name: Text Generation
33
+ dataset:
34
+ name: HellaSwag (10-Shot)
35
+ type: hellaswag
36
+ split: validation
37
+ args:
38
+ num_few_shot: 10
39
+ metrics:
40
+ - type: acc_norm
41
+ value: 77.03
42
+ name: normalized accuracy
43
+ source:
44
+ url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=lamhieu/ghost-7b-v0.9.1
45
+ name: Open LLM Leaderboard
46
+ - task:
47
+ type: text-generation
48
+ name: Text Generation
49
+ dataset:
50
+ name: MMLU (5-Shot)
51
+ type: cais/mmlu
52
+ config: all
53
+ split: test
54
+ args:
55
+ num_few_shot: 5
56
+ metrics:
57
+ - type: acc
58
+ value: 54.78
59
+ name: accuracy
60
+ source:
61
+ url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=lamhieu/ghost-7b-v0.9.1
62
+ name: Open LLM Leaderboard
63
+ - task:
64
+ type: text-generation
65
+ name: Text Generation
66
+ dataset:
67
+ name: TruthfulQA (0-shot)
68
+ type: truthful_qa
69
+ config: multiple_choice
70
+ split: validation
71
+ args:
72
+ num_few_shot: 0
73
+ metrics:
74
+ - type: mc2
75
+ value: 43.96
76
+ source:
77
+ url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=lamhieu/ghost-7b-v0.9.1
78
+ name: Open LLM Leaderboard
79
+ - task:
80
+ type: text-generation
81
+ name: Text Generation
82
+ dataset:
83
+ name: Winogrande (5-shot)
84
+ type: winogrande
85
+ config: winogrande_xl
86
+ split: validation
87
+ args:
88
+ num_few_shot: 5
89
+ metrics:
90
+ - type: acc
91
+ value: 72.53
92
+ name: accuracy
93
+ source:
94
+ url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=lamhieu/ghost-7b-v0.9.1
95
+ name: Open LLM Leaderboard
96
+ - task:
97
+ type: text-generation
98
+ name: Text Generation
99
+ dataset:
100
+ name: GSM8k (5-shot)
101
+ type: gsm8k
102
+ config: main
103
+ split: test
104
+ args:
105
+ num_few_shot: 5
106
+ metrics:
107
+ - type: acc
108
+ value: 26.91
109
+ name: accuracy
110
+ source:
111
+ url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=lamhieu/ghost-7b-v0.9.1
112
+ name: Open LLM Leaderboard
113
+ widget:
114
+ - text: 'How many helicopters can a human eat in one sitting'
115
+ output:
116
+ text: "Ahoy, me matey! A human can eat approximately one helicopter in one sitting, but only if they're a giant sea monster with a stomach the size of a small country. 🀒🀒 So, it's not advisable to try this, pirate! πŸ°πŸ›’οΈ"
117
  ---
118
 
119
+ # Model Card for Model ID
120
 
121
+ **Ghost 7B Alpha, flying, v0.9.1**
 
 
122
 
123
+ [▢️ Experience it on Colab](https://tinyurl.com/ghost7b091)
124
 
125
+ ### Come on, create yourself an AI assistant, according to your wishes!
126
+
127
+ In your language, maybe Vietnamese.
128
+
129
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/_4EmivXdOYjQpBVpIO9WL.png" width="600" align="center" />
130
+
131
+ Or, English.
132
+
133
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/ctmTOz5V7pHm0FnX8c6BD.png" width="600" align="center" />
134
+
135
+ ### Let the assistant become an expert, and more.
136
+
137
+ The challenge of the model's ability to understand the language.
138
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/N0RJUFFf1t8QRg8AVyxNj.png" width="600" align="center" />
139
+
140
+ Challenge the model's reasoning ability, in Vietnamese language.
141
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/KUXjV2XJK5vNy7genVtfN.png" width="600" align="center" />
142
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/ngX6unqUNnnBGq4R1gYY2.png" width="600" align="center" />
143
+
144
+ In case of using Vietnamese language, it lacks accents, abbreviations or uses slang.
145
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/xSL8WErn5girbKxUbEOsh.png" width="600" align="center" />
146
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/-IXPjLL_QGb_5frOKftUW.png" width="600" align="center" />
147
+
148
+ ## πŸ“š Model Details
149
+
150
+ ### Model Description
151
+
152
+ A version to consider comprehension in generating languages other than the original language being initially trained, here is the Vietnamese language. A brief summary of the effectiveness of the **Mistral 7B** model for training with a new language is excellent and low cost.
153
+
154
+ I have started training the [Ghost 7B v0.9.0](https://huggingface.co/lamhieu/ghost-7b-v0.9.0) model again, with a smaller amount of data, it is estimated to be only about 150MB. In that data, about 70% is Vietnamese, the rest is almost English.
155
+ The approach here uses QLora for training then merges them. Also, I am very thankful to Unsloth for their features.
156
+
157
+ ### About GGUF
158
+
159
+ GGUF is a new format introduced by the llama.cpp team on August 21st 2023. It is a replacement for GGML, which is no longer supported by llama.cpp.
160
+
161
+ Here is an incomplete list of clients and libraries that are known to support GGUF:
162
+
163
+ * [llama.cpp](https://github.com/ggerganov/llama.cpp). The source project for GGUF. Offers a CLI and a server option.
164
+ * [text-generation-webui](https://github.com/oobabooga/text-generation-webui), the most widely used web UI, with many features and powerful extensions. Supports GPU acceleration.
165
+ * [KoboldCpp](https://github.com/LostRuins/koboldcpp), a fully featured web UI, with GPU accel across all platforms and GPU architectures. Especially good for story telling.
166
+ * [GPT4All](https://gpt4all.io/index.html), a free and open source local running GUI, supporting Windows, Linux and macOS with full GPU accel.
167
+ * [LM Studio](https://lmstudio.ai/), an easy-to-use and powerful local GUI for Windows and macOS (Silicon), with GPU acceleration. Linux available, in beta as of 27/11/2023.
168
+ * [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui), a great web UI with many interesting and unique features, including a full model library for easy model selection.
169
+ * [Faraday.dev](https://faraday.dev/), an attractive and easy to use character-based chat GUI for Windows and macOS (both Silicon and Intel), with GPU acceleration.
170
+ * [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), a Python library with GPU accel, LangChain support, and OpenAI-compatible API server.
171
+ * [candle](https://github.com/huggingface/candle), a Rust ML framework with a focus on performance, including GPU support, and ease of use.
172
+ * [ctransformers](https://github.com/marella/ctransformers), a Python library with GPU accel, LangChain support, and OpenAI-compatible AI server. Note, as of time of writing (November 27th 2023), ctransformers has not been updated in a long time and does not support many recent models.
173
+
174
+ ## ⛹️‍♂️ Uses
175
+
176
+ ### Online using Google Colab
177
+
178
+ To make it easier to play around with the model, I created a notebook in [Google Colab](https://tinyurl.com/ghost7b091) so you can start experimenting.
179
+
180
+ ### Directly
181
+
182
+ For direct use, you can easily get started with the following steps.
183
+
184
+ * Firstly, you need to install **transformers** via the command below with `pip`.
185
+ ```bash
186
+ pip install -U transformers
187
+ ```
188
+
189
+ * Right now, you can start using the model directly.
190
+ ```python
191
+ import torch
192
+ from transformers import (
193
+ AutoModelForCausalLM,
194
+ AutoTokenizer,
195
+ )
196
+
197
+ base_model = "lamhieu/ghost-7b-v0.9.1"
198
+ model = AutoModelForCausalLM.from_pretrained(
199
+ base_model,
200
+ torch_dtype=torch.bfloat16,
201
+ trust_remote_code=True,
202
+ device_map="auto",
203
+ )
204
+ tokenizer = AutoTokenizer.from_pretrained(base_model)
205
+
206
+ messages = [
207
+ {"role": "system", "content": "You are a friendly chatbot who always responds in the style of a pirate"},
208
+ {"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
209
+ ]
210
+ prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
211
+ tokenized = tokenizer(prompt, return_tensors="pt", add_special_tokens=False)
212
+ outputs = model.generate(**tokenized, max_new_tokens=512)
213
+ results = tokenizer.batch_decode(outputs)[0]
214
+ print(results)
215
+ ```
216
+
217
+ * Additionally, you can also use a model with **4bit quantization** to reduce the required resources at least. You can start with the code below.
218
+ ```python
219
+ import torch
220
+ from transformers import (
221
+ AutoModelForCausalLM,
222
+ AutoTokenizer,
223
+ BitsAndBytesConfig,
224
+ )
225
+
226
+ base_model = "lamhieu/ghost-7b-v0.9.1"
227
+ bnb_config = BitsAndBytesConfig(
228
+ load_in_4bit=True,
229
+ bnb_4bit_quant_type="nf4",
230
+ bnb_4bit_compute_dtype=torch.bfloat16,
231
+ bnb_4bit_use_double_quant=False,
232
+ )
233
+ model = AutoModelForCausalLM.from_pretrained(
234
+ base_model,
235
+ quantization_config=bnb_config,
236
+ trust_remote_code=True,
237
+ device_map="auto",
238
+ )
239
+ tokenizer = AutoTokenizer.from_pretrained(base_model)
240
+
241
+ messages = [
242
+ {"role": "system", "content": "You are a friendly chatbot who always responds in the style of a pirate"},
243
+ {"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
244
+ ]
245
+ prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
246
+ tokenized = tokenizer(prompt, return_tensors="pt", add_special_tokens=False)
247
+ outputs = model.generate(**tokenized, max_new_tokens=512)
248
+ results = tokenizer.batch_decode(outputs)[0]
249
+ print(results)
250
+ ```
251
+
252
+
253
+ ### Summary
254
+
255
+ Although the amount of training data is small, it is "great". You don't need to worry too much that it won't be able to meet some of your requirements. Instead, try experimenting with the model of what you want.
256
+ One more thing, use it like you would **ChatGPT**, I've purposely tweaked it to be able to replace my app (for some tasks, and it does a good job). It's okay with both Vietnamese and English languages. It would be great to hear feedback about the experience, feel free to leave information in the discussion section.
257
+
258
+ Setting up the system prompt will have a great impact on the performance and quality of the content generated by the model. Keep this in mind to always ensure the model is used for your intended purpose, the goal is to achieve good results but.
259
+ It's best to always set system, you can still leave it empty if you always want to set it.
260
+
261
+ ## πŸ₯‡ Evaluation
262
+
263
+ ### [Open LLM Leaderboard Evaluation Results](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)
264
+ Detailed results can be found [here](https://huggingface.co/datasets/open-llm-leaderboard/details_lamhieu__ghost-7b-v0.9.1)
265
+
266
+ | Metric |Value|
267
+ |---------------------------------|----:|
268
+ |Avg. |55.10|
269
+ |AI2 Reasoning Challenge (25-Shot)|55.38|
270
+ |HellaSwag (10-Shot) |77.03|
271
+ |MMLU (5-Shot) |54.78|
272
+ |TruthfulQA (0-shot) |43.96|
273
+ |Winogrande (5-shot) |72.53|
274
+ |GSM8k (5-shot) |26.91|
275
+
276
+ ### VMLU
277
+
278
+ A Vietnamese Multitask Language Understanding Benchmark Suite for Large Language Models.
279
+
280
+ With the score achieved, the model can rank **3rd** in VMLU's "Leaderboard of fine-tuned models" list, as of the date of evaluation.
281
+
282
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/yuDiym9y_o_tlRVr90pGX.png)
283
+
284
+ <details>
285
+ <summary>Details</summary>
286
+
287
+ ```json
288
+ {
289
+ "humanity": {
290
+ "administrative_law": 52.22,
291
+ "business_law": 40.22,
292
+ "civil_law": 46.11,
293
+ "criminal_law": 49.08,
294
+ "economic_law": 39.75,
295
+ "education_law": 42.17,
296
+ "elementary_history": 55.37,
297
+ "high_school_history": 36.67,
298
+ "high_school_literature": 37.78,
299
+ "history_of_world_civilization": 46.67,
300
+ "idealogical_and_moral_cultivation": 50,
301
+ "introduction_to_laws": 45.24,
302
+ "vietnamese_language_and_literature": 34.48,
303
+ "total": 43.3,
304
+ "revolutionary_policy_of_the_vietnamese_commununist_part": 51.11,
305
+ "introduction_to_vietnam_culture": 30.56,
306
+ "logic": 27.01,
307
+ "middle_school_history": 44.44,
308
+ "middle_school_literature": 50.57
309
+ },
310
+ "stem": {
311
+ "total": 34.73,
312
+ "applied_informatics": 50.56,
313
+ "computer_architecture": 33.89,
314
+ "computer_network": 43.02,
315
+ "discrete_mathematics": 31.52,
316
+ "electrical_engineering": 30.68,
317
+ "elementary_mathematics": 30,
318
+ "elementary_science": 58.89,
319
+ "high_school_biology": 38.33,
320
+ "high_school_chemistry": 28.89,
321
+ "high_school_mathematics": 26.35,
322
+ "high_school_physics": 29.44,
323
+ "introduction_to_chemistry": 27.37,
324
+ "introduction_to_physics": 31.79,
325
+ "introduction_to_programming": 36.31,
326
+ "metrology_engineer": 31.21,
327
+ "middle_school_biology": 46.47,
328
+ "middle_school_chemistry": 30.56,
329
+ "middle_school_mathematics": 30.56,
330
+ "middle_school_physics": 30,
331
+ "operating_system": 40.56,
332
+ "statistics_and_probability": 22.99
333
+ },
334
+ "total": 39.58,
335
+ "other": {
336
+ "accountant": 31.55,
337
+ "civil_servant": 42.11,
338
+ "clinical_pharmacology": 33.89,
339
+ "driving_license_certificate": 59.06,
340
+ "environmental_engineering": 28.07,
341
+ "internal_basic_medicine": 39.77,
342
+ "preschool_pedagogy": 46.08,
343
+ "tax_accountant": 22.41,
344
+ "tax_civil_servant": 47.95,
345
+ "total": 38.99
346
+ },
347
+ "social_science": {
348
+ "business_administration": 41.38,
349
+ "high_school_civil_education": 45,
350
+ "high_school_geography": 34.57,
351
+ "ho_chi_minh_ideology": 48.04,
352
+ "macroeconomics": 31.11,
353
+ "microeconomics": 37.22,
354
+ "middle_school_civil_education": 66.29,
355
+ "middle_school_geography": 48.3,
356
+ "principles_of_marxism_and_leninism": 30,
357
+ "sociology": 53.93,
358
+ "total": 43.58
359
+ }
360
+ }
361
+ ```
362
+
363
+ </details>
364
+
365
+
366
+ ## πŸ“œ More Information
367
+
368
+ Note, this is a personal research project with a limited budget, so the model only stops at the evaluation level with the developed approach. Apart from that, I think I can definitely build a model with better quality in terms of language and other performance using this approach.
369
+
370
+ ### Thanks for the support
371
+
372
+ Model trained with **Unsloth**, many thanks.
373
+
374
+ <img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/made with unsloth.png" width="200px" align="center" />
375
+
376
+ ## πŸ“¨ Model Card Contact
377
+
378
+ **Lam Hieu** (lamhieu.vk@gmail.com)