RichardErkhov commited on
Commit
af743e6
·
verified ·
1 Parent(s): c93fb35

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +200 -0
README.md ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ stable-code-instruct-3b - bnb 8bits
11
+ - Model creator: https://huggingface.co/stabilityai/
12
+ - Original model: https://huggingface.co/stabilityai/stable-code-instruct-3b/
13
+
14
+
15
+
16
+
17
+ Original model description:
18
+ ---
19
+ license: other
20
+ language:
21
+ - en
22
+ tags:
23
+ - causal-lm
24
+ - code
25
+ metrics:
26
+ - code_eval
27
+ library_name: transformers
28
+ model-index:
29
+ - name: stabilityai/stable-code-instruct-3b
30
+ results:
31
+ - task:
32
+ type: text-generation
33
+ dataset:
34
+ type: nuprl/MultiPL-E
35
+ name: MultiPL-HumanEval (Python)
36
+ metrics:
37
+ - name: pass@1
38
+ type: pass@1
39
+ value: 32.4
40
+ verified: false
41
+ - task:
42
+ type: text-generation
43
+ dataset:
44
+ type: nuprl/MultiPL-E
45
+ name: MultiPL-HumanEval (C++)
46
+ metrics:
47
+ - name: pass@1
48
+ type: pass@1
49
+ value: 30.9
50
+ verified: false
51
+ - task:
52
+ type: text-generation
53
+ dataset:
54
+ type: nuprl/MultiPL-E
55
+ name: MultiPL-HumanEval (Java)
56
+ metrics:
57
+ - name: pass@1
58
+ type: pass@1
59
+ value: 32.1
60
+ verified: false
61
+ - task:
62
+ type: text-generation
63
+ dataset:
64
+ type: nuprl/MultiPL-E
65
+ name: MultiPL-HumanEval (JavaScript)
66
+ metrics:
67
+ - name: pass@1
68
+ type: pass@1
69
+ value: 32.1
70
+ verified: false
71
+ - task:
72
+ type: text-generation
73
+ dataset:
74
+ type: nuprl/MultiPL-E
75
+ name: MultiPL-HumanEval (PHP)
76
+ metrics:
77
+ - name: pass@1
78
+ type: pass@1
79
+ value: 24.2
80
+ verified: false
81
+ - task:
82
+ type: text-generation
83
+ dataset:
84
+ type: nuprl/MultiPL-E
85
+ name: MultiPL-HumanEval (Rust)
86
+ metrics:
87
+ - name: pass@1
88
+ type: pass@1
89
+ value: 23.0
90
+ verified: false
91
+ ---
92
+ # **Stable Code Instruct 3B**
93
+
94
+ [Try it out here: https://huggingface.co/spaces/stabilityai/stable-code-instruct-3b](https://huggingface.co/spaces/stabilityai/stable-code-instruct-3b)
95
+
96
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/63466107f7bd6326925fc770/O7ZkLgqoJprQEWAttX7Hj.png)
97
+
98
+ ## Model Description
99
+
100
+ `stable-code-instruct-3b` is a 2.7B billion parameter decoder-only language model tuned from [`stable-code-3b`](https://huggingface.co/stabilityai/stable-code-3b/). This model was trained on a mix of publicly available datasets, synthetic datasets using [Direct Preference Optimization (DPO)](https://arxiv.org/abs/2305.18290).
101
+
102
+ This instruct tune demonstrates state-of-the-art performance (compared to models of similar size) on the MultiPL-E metrics across multiple programming languages tested using [BigCode's Evaluation Harness](https://github.com/bigcode-project/bigcode-evaluation-harness/tree/main), and on the code portions of
103
+ [MT Bench](https://klu.ai/glossary/mt-bench-eval).
104
+ The model is finetuned to make it useable in tasks like,
105
+ - General purpose Code/Software Engineering like conversations.
106
+ - SQL related generation and conversation.
107
+
108
+ Please note: For commercial use, please refer to https://stability.ai/license.
109
+
110
+ ## Usage
111
+ Here's how you can run the model use the model:
112
+
113
+ ```python
114
+
115
+ import torch
116
+ from transformers import AutoModelForCausalLM, AutoTokenizer
117
+ tokenizer = AutoTokenizer.from_pretrained("stabilityai/stable-code-instruct-3b", trust_remote_code=True)
118
+ model = AutoModelForCausalLM.from_pretrained("stabilityai/stable-code-instruct-3b", torch_dtype=torch.bfloat16, trust_remote_code=True)
119
+ model.eval()
120
+ model = model.cuda()
121
+
122
+ messages = [
123
+ {
124
+ "role": "system",
125
+ "content": "You are a helpful and polite assistant",
126
+ },
127
+ {
128
+ "role": "user",
129
+ "content": "Write a simple website in HTML. When a user clicks the button, it shows a random joke from a list of 4 jokes."
130
+ },
131
+ ]
132
+
133
+ prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
134
+
135
+ inputs = tokenizer([prompt], return_tensors="pt").to(model.device)
136
+
137
+ tokens = model.generate(
138
+ **inputs,
139
+ max_new_tokens=1024,
140
+ temperature=0.5,
141
+ top_p=0.95,
142
+ top_k=100,
143
+ do_sample=True,
144
+ use_cache=True
145
+ )
146
+
147
+ output = tokenizer.batch_decode(tokens[:, inputs.input_ids.shape[-1]:], skip_special_tokens=False)[0]
148
+ ```
149
+
150
+ ## Model Details
151
+
152
+ * **Developed by**: [Stability AI](https://stability.ai/)
153
+ * **Model type**: `Stable Code Instruct 3B` model is an auto-regressive language model based on the transformer decoder architecture.
154
+ * **Language(s)**: English
155
+ * **Paper**: [Stable Code Technical Report](https://drive.google.com/file/d/16-DGsR5-qwoPztZ6HcM7KSRUxIXrjlSm/view)
156
+ * **Library**: [Alignment Handbook](https://github.com/huggingface/alignment-handbook.git)
157
+ * **Finetuned from model**: [https://huggingface.co/stabilityai/stable-code-3b](https://huggingface.co/stabilityai/stable-code-3b)
158
+ * **License**: [StabilityAI Community License](https://huggingface.co/stabilityai/stable-code-instruct-3b/blob/main/LICENSE.md).
159
+ * **Commercial License**: to use this model commercially, please refer to https://stability.ai/license
160
+ * **Contact**: For questions and comments about the model, please email `[email protected]`
161
+
162
+
163
+ ## Performance
164
+ ### Multi-PL Benchmark:
165
+ | Model | Size | Avg | Python | C++ | JavaScript | Java | PHP | Rust |
166
+ |------------------------------|------|------|--------|------|------------|------|------|------|
167
+ | Codellama Instruct | 7B | 0.30 | 0.33 | 0.31 | 0.31 | 0.29 | 0.31 | 0.25 |
168
+ | Deepseek Instruct | 1.3B | 0.44 | 0.52 | **0.52** | 0.41 | **0.46** | 0.45 | 0.28 |
169
+ | Stable Code Instruct (SFT) | 3B | 0.44 | 0.55 | 0.45 | 0.42 | 0.42 | 0.44 | 0.32 |
170
+ | Stable Code Instruct (DPO) | 3B | **0.47** | **0.59** | 0.49 | **0.49** | 0.44 | **0.45** | **0.37** |
171
+
172
+ ### MT-Bench Coding:
173
+ | Model | Size | Score |
174
+ |-----------------------------|------|-----------------|
175
+ | DeepSeek Coder | 1.3B | 4.6 |
176
+ | Stable Code Instruct (DPO) | 3B | **5.8**(ours) |
177
+ | Stable Code Instruct (SFT) | 3B | 5.5 |
178
+ | DeepSeek Coder | 6.7B | **6.9** |
179
+ | CodeLlama Instruct | 7B | 3.55 |
180
+ | StarChat2 | 15B | 5.7 |
181
+
182
+ ### SQL Performance
183
+ | Model | Size | Date | Group By | Order By | Ratio | Join | Where |
184
+ |-----------------------------|------|-------|----------|----------|-------|-------|-------|
185
+ | Stable Code Instruct (DPO) | 3B | 24.0% | 54.2% | 68.5% | 40.0% | 54.2% | 42.8% |
186
+ | DeepSeek-Coder Instruct | 1.3B | 24.0% | 37.1% | 51.4% | 34.3% | 45.7% | 45.7% |
187
+ | SQLCoder | 7B | 64.0% | 82.9% | 74.3% | 54.3% | 74.3% | 74.3% |
188
+
189
+
190
+
191
+
192
+ ## How to Cite
193
+ ```bibtex
194
+ @misc{stable-code-instruct-3b,
195
+ url={[https://huggingface.co/stabilityai/stable-code-3b](https://huggingface.co/stabilityai/stable-code-instruct-3b)},
196
+ title={Stable Code 3B},
197
+ author={Phung, Duy, and Pinnaparaju, Nikhil and Adithyan, Reshinth and Zhuravinskyi, Maksym and Tow, Jonathan and Cooper, Nathan}
198
+ }
199
+ ```
200
+