TechxGenus
commited on
Upload README.md
Browse files
README.md
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- code
|
4 |
+
- starcoder2
|
5 |
+
library_name: transformers
|
6 |
+
pipeline_tag: text-generation
|
7 |
+
license: bigcode-openrail-m
|
8 |
+
---
|
9 |
+
|
10 |
+
<p align="center">
|
11 |
+
<img width="300px" alt="starcoder2-instruct" src="https://huggingface.co/TechxGenus/starcoder2-7b-instruct/resolve/main/starcoder2-instruct.jpg">
|
12 |
+
</p>
|
13 |
+
|
14 |
+
GPTQ quantized version of starcoder2-7b-instruct model.
|
15 |
+
|
16 |
+
---
|
17 |
+
|
18 |
+
### starcoder2-instruct
|
19 |
+
|
20 |
+
We've fine-tuned starcoder2-7b 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 **73.2 pass@1** on HumanEval-Python. This model operates using the Alpaca instruction format (excluding the system prompt).
|
21 |
+
|
22 |
+
### Usage
|
23 |
+
|
24 |
+
Here give some examples of how to use our model:
|
25 |
+
|
26 |
+
```python
|
27 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
28 |
+
import torch
|
29 |
+
PROMPT = """### Instruction
|
30 |
+
{instruction}
|
31 |
+
### Response
|
32 |
+
"""
|
33 |
+
instruction = <Your code instruction here>
|
34 |
+
prompt = PROMPT.format(instruction=instruction)
|
35 |
+
tokenizer = AutoTokenizer.from_pretrained("TechxGenus/starcoder2-7b-instruct")
|
36 |
+
model = AutoModelForCausalLM.from_pretrained(
|
37 |
+
"TechxGenus/starcoder2-7b-instruct",
|
38 |
+
torch_dtype=torch.bfloat16,
|
39 |
+
device_map="auto",
|
40 |
+
)
|
41 |
+
inputs = tokenizer.encode(prompt, return_tensors="pt")
|
42 |
+
outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=2048)
|
43 |
+
print(tokenizer.decode(outputs[0]))
|
44 |
+
```
|
45 |
+
|
46 |
+
With text-generation pipeline:
|
47 |
+
|
48 |
+
|
49 |
+
```python
|
50 |
+
from transformers import pipeline
|
51 |
+
import torch
|
52 |
+
PROMPT = """### Instruction
|
53 |
+
{instruction}
|
54 |
+
### Response
|
55 |
+
"""
|
56 |
+
instruction = <Your code instruction here>
|
57 |
+
prompt = PROMPT.format(instruction=instruction)
|
58 |
+
generator = pipeline(
|
59 |
+
model="TechxGenus/starcoder2-7b-instruct",
|
60 |
+
task="text-generation",
|
61 |
+
torch_dtype=torch.bfloat16,
|
62 |
+
device_map="auto",
|
63 |
+
)
|
64 |
+
result = generator(prompt, max_length=2048)
|
65 |
+
print(result[0]["generated_text"])
|
66 |
+
```
|
67 |
+
|
68 |
+
### Note
|
69 |
+
|
70 |
+
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.
|