flyingfishinwater
commited on
Commit
•
3faa8a3
1
Parent(s):
a8b4aa3
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,73 @@
|
|
|
|
1 |
---
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
---
|
3 |
+
tags:
|
4 |
+
- code
|
5 |
+
- starcoder2
|
6 |
+
library_name: transformers
|
7 |
+
pipeline_tag: text-generation
|
8 |
+
license: bigcode-openrail-m
|
9 |
---
|
10 |
+
|
11 |
+
# GGUF version of starcoder2-instruct
|
12 |
+
|
13 |
+
The base model is: [https://huggingface.co/TechxGenus/starcoder2-3b-instruct](https://huggingface.co/TechxGenus/starcoder2-3b-instruct)
|
14 |
+
|
15 |
+
Refer to the following instruction
|
16 |
+
|
17 |
+
<p align="center">
|
18 |
+
<img width="300px" alt="starcoder2-instruct" src="https://huggingface.co/TechxGenus/starcoder2-3b-instruct/resolve/main/starcoder2-instruct.jpg">
|
19 |
+
</p>
|
20 |
+
|
21 |
+
### starcoder2-instruct
|
22 |
+
|
23 |
+
We've fine-tuned starcoder2-3b with an additional 0.7 billion high-quality, code-related tokens for 3 epochs. We used DeepSpeed ZeRO 3 and Flash Attention 2 to accelerate the training process. It achieves **65.9 pass@1** on HumanEval-Python. This model operates using the Alpaca instruction format (excluding the system prompt).
|
24 |
+
|
25 |
+
### Usage
|
26 |
+
|
27 |
+
Here give some examples of how to use our model:
|
28 |
+
|
29 |
+
```python
|
30 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
31 |
+
import torch
|
32 |
+
PROMPT = """### Instruction
|
33 |
+
{instruction}
|
34 |
+
### Response
|
35 |
+
"""
|
36 |
+
instruction = <Your code instruction here>
|
37 |
+
prompt = PROMPT.format(instruction=instruction)
|
38 |
+
tokenizer = AutoTokenizer.from_pretrained("TechxGenus/starcoder2-3b-instruct")
|
39 |
+
model = AutoModelForCausalLM.from_pretrained(
|
40 |
+
"TechxGenus/starcoder2-3b-instruct",
|
41 |
+
torch_dtype=torch.bfloat16,
|
42 |
+
device_map="auto",
|
43 |
+
)
|
44 |
+
inputs = tokenizer.encode(prompt, return_tensors="pt")
|
45 |
+
outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=2048)
|
46 |
+
print(tokenizer.decode(outputs[0]))
|
47 |
+
```
|
48 |
+
|
49 |
+
With text-generation pipeline:
|
50 |
+
|
51 |
+
|
52 |
+
```python
|
53 |
+
from transformers import pipeline
|
54 |
+
import torch
|
55 |
+
PROMPT = """### Instruction
|
56 |
+
{instruction}
|
57 |
+
### Response
|
58 |
+
"""
|
59 |
+
instruction = <Your code instruction here>
|
60 |
+
prompt = PROMPT.format(instruction=instruction)
|
61 |
+
generator = pipeline(
|
62 |
+
model="TechxGenus/starcoder2-3b-instruct",
|
63 |
+
task="text-generation",
|
64 |
+
torch_dtype=torch.bfloat16,
|
65 |
+
device_map="auto",
|
66 |
+
)
|
67 |
+
result = generator(prompt, max_length=2048)
|
68 |
+
print(result[0]["generated_text"])
|
69 |
+
```
|
70 |
+
|
71 |
+
### Note
|
72 |
+
|
73 |
+
Model may sometimes make errors, produce misleading contents, or struggle to manage tasks that are not related to coding. It has undergone very limited testing. Additional safety testing should be performed before any real-world deployments.
|