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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
---
language:
- en
- vi
license: mit
library_name: transformers
tags:
- ghost
pipeline_tag: text-generation
base_model: HuggingFaceH4/zephyr-7b-beta
widget:
- text: '<|system|>

    You are a helpful assistant.</s>

    <|user|>

    Thông tin về Peristernia despecta</s>

    <|assistant|>

    '
  output:
    text: Peristernia despecta  một loài ốc biển,  động vật thân mềm chân bụng
      sống  biển trong họ Fasciolariidae.
model-index:
- name: lamhieu/ghost-7b-v0.9.0
  results:
  - task:
      type: text-generation
    dataset:
      name: VMLU
      type: vmlu_v1.5
    metrics:
    - type: avg
      value: 36.06
      name: Average
      verified: true
    - type: stem
      value: 33.54
      name: STEM
      verified: true
    - type: ss
      value: 38.74
      name: Social science
      verified: true
    - type: hm
      value: 37.15
      name: Humanities
      verified: true
    - type: ot
      value: 36.78
      name: Other
      verified: true
  - task:
      type: text-generation
    dataset:
      name: Open LLM Leaderboard
      type: open_llm_leaderboard
    metrics:
    - type: avg
      value: 56.89
      name: Average
      verified: true
    - type: arc
      value: 53.07
      name: ARC
      verified: true
    - type: hs
      value: 77.93
      name: HellaSwag
      verified: true
    - type: hs
      value: 77.93
      name: HellaSwag
      verified: true
    - type: mmlu
      value: 55.09
      name: MMLU
      verified: true
    - type: wg
      value: 73.72
      name: Winogrande
      verified: true
    - type: gsm8k
      value: 33.74
      name: GSM8K
      verified: true
    source:
      url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=lamhieu/ghost-7b-v0.9.0
      name: Open LLM Leaderboard
  - task:
      type: text-generation
      name: Text Generation
    dataset:
      name: AI2 Reasoning Challenge (25-Shot)
      type: ai2_arc
      config: ARC-Challenge
      split: test
      args:
        num_few_shot: 25
    metrics:
    - type: acc_norm
      value: 53.07
      name: normalized accuracy
    source:
      url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=lamhieu/ghost-7b-v0.9.0
      name: Open LLM Leaderboard
  - task:
      type: text-generation
      name: Text Generation
    dataset:
      name: HellaSwag (10-Shot)
      type: hellaswag
      split: validation
      args:
        num_few_shot: 10
    metrics:
    - type: acc_norm
      value: 77.93
      name: normalized accuracy
    source:
      url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=lamhieu/ghost-7b-v0.9.0
      name: Open LLM Leaderboard
  - task:
      type: text-generation
      name: Text Generation
    dataset:
      name: MMLU (5-Shot)
      type: cais/mmlu
      config: all
      split: test
      args:
        num_few_shot: 5
    metrics:
    - type: acc
      value: 55.09
      name: accuracy
    source:
      url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=lamhieu/ghost-7b-v0.9.0
      name: Open LLM Leaderboard
  - task:
      type: text-generation
      name: Text Generation
    dataset:
      name: TruthfulQA (0-shot)
      type: truthful_qa
      config: multiple_choice
      split: validation
      args:
        num_few_shot: 0
    metrics:
    - type: mc2
      value: 47.79
    source:
      url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=lamhieu/ghost-7b-v0.9.0
      name: Open LLM Leaderboard
  - task:
      type: text-generation
      name: Text Generation
    dataset:
      name: Winogrande (5-shot)
      type: winogrande
      config: winogrande_xl
      split: validation
      args:
        num_few_shot: 5
    metrics:
    - type: acc
      value: 73.72
      name: accuracy
    source:
      url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=lamhieu/ghost-7b-v0.9.0
      name: Open LLM Leaderboard
  - task:
      type: text-generation
      name: Text Generation
    dataset:
      name: GSM8k (5-shot)
      type: gsm8k
      config: main
      split: test
      args:
        num_few_shot: 5
    metrics:
    - type: acc
      value: 33.74
      name: accuracy
    source:
      url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=lamhieu/ghost-7b-v0.9.0
      name: Open LLM Leaderboard
---

# Model Card for Model ID

**Ghost 7B Alpha, flying, v0.9.0**

## Model Details

### Model Description

This model is fine tuned from **HuggingFaceH4/zephyr-7b-beta** on a small synthetic datasets (about 200MB) for 50% English and 50% Vietnamese.

- **Developed by:** **Lam H**
- **Language(s) (NLP):** English, Vietnamese
- **License:** MIT
- **Finetuned from model:** [HuggingFaceH4/zephyr-7b-beta](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta)

## Uses

This model supports both conversation chat and tasks. Feel free to experiment and don't limit your creativity.

The simplest way to try it is to use the `pipeline` from `transformers`.

```python
import torch
from transformers import pipeline

pipe = pipeline(
    "text-generation",
    model="lamhieu/ghost-7b-v0.9.0",
    torch_dtype=torch.bfloat16,
)
```

You can then try any of the sample codes below, formatted using the chat template.

```python
messages = [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "nói tôi biết bệnh dịch hạch ở châu Âu do khuẩn nào gây ra"},
]
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
tokenized = pipe.tokenizer(prompt, return_tensors="pt", add_special_tokens=False)
outputs = pipe.model.generate(**tokenized, max_new_tokens=512)
results = tokenizer.batch_decode(outputs)[0]
print(results)
# Bệnh dịch hạch ở châu Âu do khuẩn gây ra là do khuẩn Yersinia pestis.
```

```python
messages = [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Thông tin về Peristernia despecta"},
]
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
tokenized = pipe.tokenizer(prompt, return_tensors="pt", add_special_tokens=False)
outputs = pipe.model.generate(**tokenized, max_new_tokens=512)
results = tokenizer.batch_decode(outputs)[0]
print(results)
# Peristernia despecta là một loài ốc biển, là động vật thân mềm chân bụng sống ở biển trong họ Fasciolariidae.
# ...
```

```python
messages = [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "do u know vietnam ?"},
]
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
tokenized = pipe.tokenizer(prompt, return_tensors="pt", add_special_tokens=False)
outputs = pipe.model.generate(**tokenized, max_new_tokens=512)
results = tokenizer.batch_decode(outputs)[0]
print(results)
# Yes, I have knowledge about Vietnam. Vietnam is a country in Southeast Asia, bordered by China to the north, Laos and Cambodia to the west, and the South China Sea to the east and south. Its capital city is Hanoi, and its largest city is Ho Chi Minh City (formerly known as Saigon). Vietnam has a population of approximately 100 million people and a diverse cultural heritage influenced by both Chinese and French colonialism. The country has a rich history, including periods of independence, colonization, and resistance, and has experienced significant economic growth in recent years.
```

```python
messages = [
    {"role": "system", "content": "You are a helpful assistant, who always provide explanation. Think like you are answering to a five year old."},
    {"role": "user", "content": "Tôi yêu em nhiều hơn em nghĩ.\n\nWhich language is this?"},
]
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
tokenized = pipe.tokenizer(prompt, return_tensors="pt", add_special_tokens=False)
outputs = pipe.model.generate(**tokenized, max_new_tokens=512)
results = tokenizer.batch_decode(outputs)[0]
print(results)
# This is Vietnamese language. Vietnamese is a language spoken mainly in Vietnam and by the Vietnamese diaspora in many other countries. The sentence you provided means "I love you more than you think." It's like you have more love for someone than they realize.
```

Another example of what you can use to chat multiple turns.

```python
messages = [
    # {"role": "system", "content": "You are a helpful and knowledgeable assistant. You like to help and always give honest information, in its original language. In communication, you are always respectful, equal and promote positive behavior."},
    {"role": "system", "content": "You are a helpful assistant."}, # Describe to your assistant, anything.
    {"role": "user", "content": "Bla bla bla"},
    {"role": "assistant", "content": "Bla bla bla"},
    {"role": "user", "content": "Bla bla bla"},
]
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
tokenized = pipe.tokenizer(prompt, return_tensors="pt", add_special_tokens=False)
outputs = pipe.model.generate(**tokenized, max_new_tokens=512)
results = tokenizer.batch_decode(outputs)[0]
print(results)
```

## Evaluation

### Results

#### [Open LLM Leaderboard Evaluation Results](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)
Detailed results can be found [here](https://huggingface.co/datasets/open-llm-leaderboard/details_lamhieu__ghost-7b-v0.9.0)

|             Metric              |Value|
|---------------------------------|----:|
|Avg.                             |56.89|
|AI2 Reasoning Challenge (25-Shot)|53.07|
|HellaSwag (10-Shot)              |77.93|
|MMLU (5-Shot)                    |55.09|
|TruthfulQA (0-shot)              |47.79|
|Winogrande (5-shot)              |73.72|
|GSM8k (5-shot)                   |33.74|


#### VMLU

Below are the results evaluated with the VMLU evaluation suite, which is often used to evaluate models that work with Vietnamese.

Note: the results are run with the model in 4bit quantization, I'm not sure if it has any loss in results or not, if someone can help me run it with full it would be great.

![VMLU - lamhieu/ghost-7b-v0.9.0](https://cdn-uploads.huggingface.co/production/uploads/600ae38cc92b79f54efd4556/GdMgr0-YnAGRqD_RJr_ux.png)

<details>
  <summary>Details</summary>

```python
{
  "stem": {
    "elementary_mathematics": 32.22,
    "elementary_science": 56.11,
    "high_school_biology": 32.78,
    "high_school_chemistry": 27.78,
    "high_school_mathematics": 33.78,
    "high_school_physics": 26.11,
    "introduction_to_chemistry": 26.82,
    "introduction_to_physics": 33.53,
    "introduction_to_programming": 39.66,
    "metrology_engineer": 36.17,
    "middle_school_biology": 40,
    "middle_school_chemistry": 26.67,
    "middle_school_mathematics": 27.78,
    "middle_school_physics": 27.22,
    "operating_system": 38.33,
    "statistics_and_probability": 18.39,
    "total": 33.54,
    "applied_informatics": 47.78,
    "computer_architecture": 36.11,
    "computer_network": 41.34,
    "discrete_mathematics": 29.7,
    "electrical_engineering": 26.14
  },
  "other": {
    "total": 36.78,
    "accountant": 29.17,
    "civil_servant": 29.82,
    "clinical_pharmacology": 35.56,
    "driving_license_certificate": 56.73,
    "environmental_engineering": 32.16,
    "internal_basic_medicine": 36.84,
    "preschool_pedagogy": 45.1,
    "tax_accountant": 24.71,
    "tax_civil_servant": 40.94
  },
  "total": 36.06,
  "humanity": {
    "introduction_to_vietnam_culture": 31.11,
    "logic": 28.16,
    "middle_school_history": 38.33,
    "administrative_law": 32.22,
    "revolutionary_policy_of_the_vietnamese_commununist_part": 40.56,
    "vietnamese_language_and_literature": 35.06,
    "total": 37.15,
    "middle_school_literature": 36.21,
    "business_law": 38.55,
    "civil_law": 48.33,
    "criminal_law": 37.42,
    "economic_law": 38.51,
    "education_law": 36.75,
    "elementary_history": 35.03,
    "high_school_history": 27.78,
    "high_school_literature": 32.78,
    "history_of_world_civilization": 43.33,
    "idealogical_and_moral_cultivation": 39.44,
    "introduction_to_laws": 49.21
  },
  "social_science": {
    "business_administration": 37.36,
    "high_school_civil_education": 42.78,
    "high_school_geography": 38.27,
    "ho_chi_minh_ideology": 40.22,
    "macroeconomics": 27.78,
    "microeconomics": 36.67,
    "middle_school_civil_education": 51.69,
    "middle_school_geography": 32.65,
    "principles_of_marxism_and_leninism": 35.56,
    "sociology": 44.38,
    "total": 38.74
  }
}
```
  
</details>

## More Information

Many thanks for
- Datasets: [5CD-AI](https://huggingface.co/5CD-AI), [vilm](https://huggingface.co/vilm).
- Library: [unsloth](https://github.com/unslothai/unsloth)

## Model Card Contact

**Lam H** (lamhieu.vk@gmail.com)