LumenscopeAI
commited on
Commit
•
c285096
1
Parent(s):
2a540ed
Update README.md
Browse files
README.md
CHANGED
@@ -14,10 +14,39 @@ Based on BrainTransformers, BrainGPTForCausalLM is a Large Language Model (LLM)
|
|
14 |
|
15 |
The github link is: [LumenScopeAI/BrainTransformers-SNN-LLM](https://github.com/LumenScopeAI/BrainTransformers-SNN-LLM)
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
## Usage
|
18 |
|
19 |
### Generate Text
|
20 |
-
```
|
21 |
import torch
|
22 |
from transformers import AutoTokenizer, BrainGPTForCausalLM
|
23 |
|
@@ -29,25 +58,83 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
29 |
model.to(device)
|
30 |
|
31 |
def generate_text(messages, max_new_tokens=50):
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
|
41 |
# Example usage
|
42 |
messages = [
|
43 |
-
|
44 |
-
|
45 |
]
|
46 |
response = generate_text(messages)
|
47 |
print(response)
|
48 |
```
|
49 |
|
50 |
-
|
51 |
---
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
---
|
|
|
14 |
|
15 |
The github link is: [LumenScopeAI/BrainTransformers-SNN-LLM](https://github.com/LumenScopeAI/BrainTransformers-SNN-LLM)
|
16 |
|
17 |
+
## Model Performance
|
18 |
+
|
19 |
+
Below are the performance metrics of our 3B model on various benchmarks:
|
20 |
+
|
21 |
+
| Task Category | Dataset | Performance |
|
22 |
+
|---------------|---------|-------------|
|
23 |
+
| General Tasks | MMLU | 65.6 |
|
24 |
+
| | MMLU-pro | 34.6 |
|
25 |
+
| | MMLU-redux | 63.7 |
|
26 |
+
| | BBH | 56.3 |
|
27 |
+
| | ARC-C | 56.5 |
|
28 |
+
| | Trurhfulqa | 48.9 |
|
29 |
+
| | Winogrande | 71.1 |
|
30 |
+
| | Hellaswag | 74.6 |
|
31 |
+
| Math and Science Tasks | GPQA | 26.3 |
|
32 |
+
| | Theoremqa | 27.4 |
|
33 |
+
| | MATH | 42.6 |
|
34 |
+
| | MMLU-stem | 62.5 |
|
35 |
+
| | GSM8K | 79.1 |
|
36 |
+
| Coding Tasks | HumanEval | 42.1 |
|
37 |
+
| | HumanEval+ | 36.0 |
|
38 |
+
| | MBPP | 57.1 |
|
39 |
+
| | MBPP+ | 49.4 |
|
40 |
+
| | MultiPL-E | 41.2 |
|
41 |
+
| Multilingual Tasks | Multi-Exam | 54.6 |
|
42 |
+
| | Multi-Understanding | 76.6 |
|
43 |
+
| | Multi-Mathematics | 48.9 |
|
44 |
+
| | Multi-Translation | 29.3 |
|
45 |
+
|
46 |
## Usage
|
47 |
|
48 |
### Generate Text
|
49 |
+
```python
|
50 |
import torch
|
51 |
from transformers import AutoTokenizer, BrainGPTForCausalLM
|
52 |
|
|
|
58 |
model.to(device)
|
59 |
|
60 |
def generate_text(messages, max_new_tokens=50):
|
61 |
+
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
62 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(device)
|
63 |
+
|
64 |
+
with torch.no_grad():
|
65 |
+
generated_ids = model.generate(**model_inputs, max_new_tokens=max_new_tokens)
|
66 |
+
|
67 |
+
generated_ids = [output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)]
|
68 |
+
return tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
69 |
|
70 |
# Example usage
|
71 |
messages = [
|
72 |
+
{"role": "system", "content": "You are a knowledgeable assistant."},
|
73 |
+
{"role": "user", "content": "Explain the Pythagorean theorem."}
|
74 |
]
|
75 |
response = generate_text(messages)
|
76 |
print(response)
|
77 |
```
|
78 |
|
|
|
79 |
---
|
80 |
+
model-index:
|
81 |
+
- name: BrainTransformers-3B-Chat
|
82 |
+
results:
|
83 |
+
- task:
|
84 |
+
type: text-generation
|
85 |
+
dataset:
|
86 |
+
name: mmlu
|
87 |
+
type: mmlu
|
88 |
+
metrics:
|
89 |
+
- name: MMLU
|
90 |
+
type: MMLU
|
91 |
+
value: 65.6
|
92 |
+
- task:
|
93 |
+
type: text-generation
|
94 |
+
dataset:
|
95 |
+
name: bbh
|
96 |
+
type: bbh
|
97 |
+
metrics:
|
98 |
+
- name: BBH
|
99 |
+
type: BBH
|
100 |
+
value: 56.3
|
101 |
+
- task:
|
102 |
+
type: text-generation
|
103 |
+
dataset:
|
104 |
+
name: arc-challenge
|
105 |
+
type: arc-challenge
|
106 |
+
metrics:
|
107 |
+
- name: ARC-C
|
108 |
+
type: ARC-C
|
109 |
+
value: 56.5
|
110 |
+
- task:
|
111 |
+
type: text-generation
|
112 |
+
dataset:
|
113 |
+
name: hellaswag
|
114 |
+
type: hellaswag
|
115 |
+
metrics:
|
116 |
+
- name: HellaSwag
|
117 |
+
type: HellaSwag
|
118 |
+
value: 74.6
|
119 |
+
- task:
|
120 |
+
type: text-generation
|
121 |
+
dataset:
|
122 |
+
name: gsm8k
|
123 |
+
type: gsm8k
|
124 |
+
metrics:
|
125 |
+
- name: GSM8K
|
126 |
+
type: GSM8K
|
127 |
+
value: 79.1
|
128 |
+
- task:
|
129 |
+
type: code-generation
|
130 |
+
dataset:
|
131 |
+
name: humaneval
|
132 |
+
type: humaneval
|
133 |
+
metrics:
|
134 |
+
- name: HumanEval
|
135 |
+
type: HumanEval
|
136 |
+
value: 42.1
|
137 |
+
source:
|
138 |
+
name: LumenScopeAI
|
139 |
+
url: https://github.com/LumenScopeAI/BrainTransformers-SNN-LLM
|
140 |
---
|