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