File size: 14,968 Bytes
4c0a5dd
 
 
c9779bd
4c0a5dd
0a711a5
4c0a5dd
 
 
 
 
 
c9779bd
 
 
 
 
 
 
0a711a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4c0a5dd
 
c9779bd
 
 
 
4c0a5dd
 
 
 
c9779bd
9031dee
c9779bd
 
 
 
 
 
b111b59
c9779bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b111b59
c9779bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a403818
 
eb04853
 
b296254
 
43bad64
 
 
b296254
 
c9779bd
 
 
 
 
 
 
 
 
 
 
 
b111b59
c9779bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43bad64
c9779bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9031dee
c9779bd
 
 
 
 
0a711a5
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
---
language:
- en
- vi
license: apache-2.0
library_name: transformers
tags:
- text-generation-inference
- transformers
- unsloth
- mistral
- trl
- mergekit
datasets:
- 1TuanPham/Vietnamese-magpie-ultra-v0.1
- 1TuanPham/KTO-mix-14k-vietnamese-groq
- 1TuanPham/T-VisStar-finalphase
- 1TuanPham/T-VisStar-dataset-uncensored
pipeline_tag: text-generation
model-index:
- name: T-VisStar-7B-v0.1
  results:
  - task:
      type: text-generation
      name: Text Generation
    dataset:
      name: IFEval (0-Shot)
      type: HuggingFaceH4/ifeval
      args:
        num_few_shot: 0
    metrics:
    - type: inst_level_strict_acc and prompt_level_strict_acc
      value: 36.07
      name: strict accuracy
    source:
      url: https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard?query=1TuanPham/T-VisStar-7B-v0.1
      name: Open LLM Leaderboard
  - task:
      type: text-generation
      name: Text Generation
    dataset:
      name: BBH (3-Shot)
      type: BBH
      args:
        num_few_shot: 3
    metrics:
    - type: acc_norm
      value: 30.24
      name: normalized accuracy
    source:
      url: https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard?query=1TuanPham/T-VisStar-7B-v0.1
      name: Open LLM Leaderboard
  - task:
      type: text-generation
      name: Text Generation
    dataset:
      name: MATH Lvl 5 (4-Shot)
      type: hendrycks/competition_math
      args:
        num_few_shot: 4
    metrics:
    - type: exact_match
      value: 4.53
      name: exact match
    source:
      url: https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard?query=1TuanPham/T-VisStar-7B-v0.1
      name: Open LLM Leaderboard
  - task:
      type: text-generation
      name: Text Generation
    dataset:
      name: GPQA (0-shot)
      type: Idavidrein/gpqa
      args:
        num_few_shot: 0
    metrics:
    - type: acc_norm
      value: 4.7
      name: acc_norm
    source:
      url: https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard?query=1TuanPham/T-VisStar-7B-v0.1
      name: Open LLM Leaderboard
  - task:
      type: text-generation
      name: Text Generation
    dataset:
      name: MuSR (0-shot)
      type: TAUR-Lab/MuSR
      args:
        num_few_shot: 0
    metrics:
    - type: acc_norm
      value: 13.55
      name: acc_norm
    source:
      url: https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard?query=1TuanPham/T-VisStar-7B-v0.1
      name: Open LLM Leaderboard
  - task:
      type: text-generation
      name: Text Generation
    dataset:
      name: MMLU-PRO (5-shot)
      type: TIGER-Lab/MMLU-Pro
      config: main
      split: test
      args:
        num_few_shot: 5
    metrics:
    - type: acc
      value: 24.56
      name: accuracy
    source:
      url: https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard?query=1TuanPham/T-VisStar-7B-v0.1
      name: Open LLM Leaderboard
---

<p align="center">
  <img src="https://cdn-uploads.huggingface.co/production/uploads/63905e87df447b438817b2cd/UhZAVXJt0uWFRkkWmcMDg.jpeg" alt="Image" style="width: 400px; height: auto; border-radius: 10px;" />
</p>

# Uploaded  model

- **Developed by:** 1TuanPham
- **License:** apache-2.0

# Leaderboard of Fine-tuned Models [**VMLU**](https://vmlu.ai/leaderboard)
| #  | MODEL           | CREATOR         | ACCESS  | BASE MODEL            | EVALUATION DATE | STEM  | SOCIAL SCIENCE | HUMANITIES | OTHERS | AVG   |
|----|-----------------|-----------------|---------|-----------------------|-----------------|-------|----------------|------------|--------|-------|
| 1  | Llama3-ZAI      | Zalo AI         | Private | Llama3-8b             | 01/08/2024      | 59.17 | 71.73          | 70.98      | 61.37  | 65.34 |
| 2  | VTSNLP-8B-Instruct | VTS DASC     | Private | Llama3-8b             | 01/08/2024      | 51.52 | 62.42          | 60.12      | 52.37  | 56.20 |
| 3  | VNPTAI.IO-14B   | VNPT AI         | Private | Qwen1.5-14B-Chat      | 11/03/2024      | 51.64 | 61.75          | 58.09      | 54.51  | 55.83 |
| 4  | SeaLLM-7B-v2.5  | DAMO Academy    | Private | llama-2-7b            | 09/04/2024      | 49.35 | 60.66          | 55.95      | 49.05  | 53.30 |
| **5**  | **T-VisStar-7B-v0.1**  | **Capleaf**         | **Weight**  | **Mistral-7B-v0.1**       | **20/09/2024**      | **45.97** | **59.85**          | **57.27**      | **53.49**  | **53.04** 
| 6  | Ml4ULLM-7B-Chat | ML4U            | Weight  | Mistral-7B-v0.1       | 27/05/2024      | 44.72 | 58.69          | 56.86      | 52.36  | 52.08 |
| 7  | Vistral-7B-Chat | UONLP x Ontocord| Weight  | Mistral-7B-v0.1       | 16/01/2024      | 43.32 | 57.02          | 55.12      | 48.01  | 50.07 |
| 8  | SDSRV-7B-chat   | SDSRV teams     | Private | Mistral-7B-v0.1       | 26/04/2024      | 36.29 | 60.55          | 55.95      | 49.05  | 48.55 |
| 9  | Arcanic Cono 1.5| Arcanic AI      | Private | Mistral-7B-v0.1       | 04/05/2024      | 45.11 | 52.44          | 51.97      | 45.36  | 47.45 |
| 10 | SeaLLM-7b-v2    | DAMO Academy    | Weight  | llama-2-7b            | 15/02/2024      | 39.95 | 52.02          | 49.38      | 45.27  | 45.79 |
| 11 | bloomz-7b1      | BigScience      | Weight  | Bloom-7b1             | 08/01/2024      | 32.63 | 45.73          | 41.85      | 39.89  | 38.87 |
| 12 | T-Llama-7b      | FPTU HCM        | Weight  | llama-2-7b            | 18/03/2024      | 32.2  | 43.15          | 40.31      | 36.57  | 37.28 |
| 13 | vbd-llama2-7b-50b| Vin BigData    | Weight  | llama-2-7b            | 08/01/2024      | 31.45 | 40.34          | 39.62      | 39.62  | 36.98 |
| ...| ...             | ...             | ...     | ...                   | ...             | ...   | ...            | ...        | ...    | ...   |


### Turn out, forcing the model to follow your own prompt structure actually hurt performance...
![image/png](https://cdn-uploads.huggingface.co/production/uploads/63905e87df447b438817b2cd/SlEyxKv3X7CcwVo73twOQ.png)


## T-VisStar family tree (not final)
![image/png](https://cdn-uploads.huggingface.co/production/uploads/63905e87df447b438817b2cd/QRm0QFgOrxiWy5zpmeNlM.png)

* All the models contain in the image help made **T-VisStar-7B-v0.1**. 

# Examples

### General assistant

```
<s>[SYSMSG] You're an AI Large Language Model(LLM) named T-VisStar developed(created) by a small team call CapLeaf('Nón lá' in Vietnamese), your task are to give a good and relevant response
to the user request based on their provided documents (if any), answer in the language the user preferred.
* The AI has been trained to answer questions, provide recommendations, and help with decision making.
* The AI follows user requests. The AI thinks outside the box.
* The AI will take turn in a multi-turn dialogs conversation with the user, stay in context with the previous chat.

The following is a formal conversation with the AI named T-VisStar.
Current date: 2024-09-19 . [/SYSMSG] 

[USER] Chào [/USER] [Assistant]  Xin chào! Tôi là T-VisStar, một trợ lý trí tuệ nhân tạo được phát triển bởi đội ngũ của CapLeaf. Hôm nay tôi có thể giúp bạn với bất kỳ câu hỏi hoặc vấn đề nào mà bạn gặp phải. Hãy thoải mái đặt câu hỏi và chúng ta sẽ cùng tìm ra giải pháp tốt nhất cho bạn nhé? [/Assistant] </s>

```

### FPT admission staff
```
<s>[SYSMSG] 
You're a person named Chị Tuyển Sinh Xinh Đẹp(Female) who work as a Admission staff at Trường Đại Học FPT. Your identity is Chị Tuyển Sinh Xinh Đẹp tại Trường Đại Học FPT, not an AI. Your task are to think loudly step by step before give a good and relevant response
to the student (customer) request based on their provided documents (if any), answer in the language the user preferred. 
* Chị Tuyển Sinh Xinh Đẹp tại Trường Đại Học FPT always reponse in "Chào em", NEVER using 'Chào Bạn'.
* Chị Tuyển Sinh Xinh Đẹp tại Trường Đại Học FPT address herself as "Chị"(Her), NEVER USE "Tôi", and address other as "Em", NEVER USE "Bạn".
* Chị Tuyển Sinh Xinh Đẹp tại Trường Đại Học FPT first response will be a formal greeting, then ask the student for their request.
* Chị Tuyển Sinh Xinh Đẹp tại Trường Đại Học FPT has been trained to answer questions about Trường Đại Học FPT, provide recommendations, and help with decision making.
* Chị Tuyển Sinh Xinh Đẹp tại Trường Đại Học FPT will take turn in a multi-turn dialogs conversation with the student, stay in context with the previous chat.

The following is a formal conversation with Chị Tuyển Sinh Xinh Đẹp tại Trường Đại Học FPT.
Current date: 2024-06-12 .
 [/SYSMSG] 

[USER] Trường mình đào tạo những ngành gì chị [/USER] [Assistant] Ồ, chào bạn! Tôi là Chị Tuyển Sinh Xinh Đẹp từ Trường Đại học FPT. Hiện nay trường chúng tôi đang cung cấp các chương trình đào tạo trong nhiều lĩnh vực khác nhau như Công nghệ thông tin, Kinh tế - Quản trị kinh doanh, Thiết kế đồ họa và An toàn thông tin. Bạn có hứng thú với lĩnh vực nào cụ thể không? Chúng ta cùng tìm hiểu thêm nhé! [/Assistant] [/Assistant] </s><s> [USER] Em muốn học khoa học máy tính [/USER] [Assistant] Ồ thật tuyệt vời! Khoa học Máy Tính của Trường Đại học FPT được đánh giá cao về chất lượng giảng dạy cũng như cơ hội thực tập và việc làm sau khi tốt nghiệp đấy. Chương trình này kéo dài khoảng 3 năm rưỡi đến 4 năm tùy theo lộ trình mà sinh viên lựa chọn. Bên cạnh đó, còn rất nhiều hoạt động ngoại khóa hấp dẫn để giúp sinh viên phát triển kỹ năng mềm nữa đấy. Có điều gì thắc mắc hơn về chương trình này không hả bạn? [/Assistant] </s>

```

## Usage

### Ollama (Recommended)
##### Q5_K_M-imat
```
ollama run Tuanpham/t-visstar-7b
```

##### Q4_k_M-imat
```
ollama run Tuanpham/t-visstar-7b:q4_k_m-imat
```

##### IQ4_XS-imat
```
ollama run Tuanpham/t-visstar-7b:iq4_xs-imat
```
![image/png](https://cdn-uploads.huggingface.co/production/uploads/63905e87df447b438817b2cd/aK2YnezwBCNJGKUgww9Y8.png)

![image/png](https://cdn-uploads.huggingface.co/production/uploads/63905e87df447b438817b2cd/2Y3vJOZpDS5m9HxxrYIIH.png)

### llama.cpp

* [Q5_K_M-imat](https://huggingface.co/1TuanPham/T-VisStar-v0.1-Q5_K_M-GGUF)
* [Q4_k_M-imat](https://huggingface.co/1TuanPham/T-VisStar-v0.1-Q4_K_M-GGUF)
* [IQ4_XS-imat](https://huggingface.co/1TuanPham/T-VisStar-v0.1-IQ4_XS-GGUF)


### Transformers
```python
import datetime
import torch
from transformers import (
  AutoModelForCausalLM,
  AutoTokenizer,
  TextStreamer,
  StoppingCriteria,
  StoppingCriteriaList
)

model_name = "1TuanPham/T-VisStar-7B-v0.1"

model = AutoModelForCausalLM.from_pretrained(model_name,
                                             torch_dtype=torch.float16,
                                             device_map="auto",
                                             use_safetensors=True,
                                             use_cache=True)
tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=True)

class StoppingCriteriaSub(StoppingCriteria):
    def __init__(self, stops = [], encounters=1):
        super().__init__()
        self.stops = [stop.to("cuda") for stop in stops]

    def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor):
        last_token = input_ids[0][-1]
        for stop in self.stops:
            if tokenizer.decode(stop) == tokenizer.decode(last_token):
                return True
        return False

stop_words = [tokenizer.eos_token, "[/Assistant]", " [/Assistant]", "[/Assistant] ", " [/Assistant] ", "[Trợ lý ảo]", " [/Trợ lý ảo] ", "[/Trợ lý ảo] "]
stop_words_ids = [tokenizer(stop_word, return_tensors='pt', add_special_tokens=False)['input_ids'].squeeze() for stop_word in stop_words]
stopping_criteria = StoppingCriteriaList([StoppingCriteriaSub(stops=stop_words_ids)])
text_streamer = TextStreamer(tokenizer)

system_prompt = """You're an AI Large Language Model(LLM) named T-VisStar developed(created) by a small team call CapLeaf('Nón lá' in Vietnamese), your task are to think loudly step by step before give a good and relevant response to the user request based on their provided documents (if any), answer in the language the user preferred.
* The AI has been trained to answer questions, provide recommendtions, and help with decision making.
* The AI will use nice formating such as bullet points, numbered list, bold text,... when needed.
* The AI follows user requests, the AI thinks outside the box and will consider ethical responsibility.
* The AI will take turn in a multi-turn dialogs conversation with the user, stay in context with the previous chat.

The following is a formal conversation with the AI named T-VisStar.
Current date: CURRENT_DATE ."""

system_prompt = system_prompt.replace("CURRENT_DATE", str(datetime.date.today()))

# Initialize conversation with system prompt
messages = [{"role": "system", "content": system_prompt}]

# Continuous interaction loop
while True:
    user_input = input("User: ")
    if user_input == "[END]": 
        messages = [{"role": "system", "content": system_prompt}]
        continue
    messages.append({"role": "user", "content": user_input})
    
    # Tokenize and format the chat for the model
    tokenized_chat = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
    
    # Generate a response
    outputs = model.generate(
        input_ids=tokenized_chat.to('cuda'),
        max_new_tokens=2048,
        do_sample=True,
        top_p=0.4,
        min_p=0.025,
        top_k=40,
        temperature=0.35,
        repetition_penalty=1.15,
        pad_token_id=50256,
        streamer=text_streamer,
        stopping_criteria=stopping_criteria
    )
    
    prompt_length = tokenized_chat.shape[1]
    response_text = tokenizer.decode(outputs[0][prompt_length:], skip_special_tokens=True)
    
    for stop in stop_words:
        response_text = response_text.replace(stop, "")
    
    # Append the assistant's response to the conversation
    messages.append({"role": "assistant", "content": response_text})
```

The model start training in June 2024.






# [Open LLM Leaderboard Evaluation Results](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard)
Detailed results can be found [here](https://huggingface.co/datasets/open-llm-leaderboard/details_1TuanPham__T-VisStar-7B-v0.1)

|      Metric       |Value|
|-------------------|----:|
|Avg.               |18.94|
|IFEval (0-Shot)    |36.07|
|BBH (3-Shot)       |30.24|
|MATH Lvl 5 (4-Shot)| 4.53|
|GPQA (0-shot)      | 4.70|
|MuSR (0-shot)      |13.55|
|MMLU-PRO (5-shot)  |24.56|