Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,33 @@
|
|
1 |
---
|
2 |
license: bsd-3-clause
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: bsd-3-clause
|
3 |
+
metrics:
|
4 |
+
- code_eval
|
5 |
+
pipeline_tag: text-generation
|
6 |
+
tags:
|
7 |
+
- code
|
8 |
---
|
9 |
+
# Model Card for instruct-codegen-16B
|
10 |
+
|
11 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
12 |
+
|
13 |
+
Instruct-codegen-16B is an instruction following codegen model based on [Salesforce codegen-16B-multi](https://huggingface.co/Salesforce/codegen-16B-multi) , finetuned on a dataset of 250k instruction-following samples in the alpaca format.
|
14 |
+
|
15 |
+
The data was not generated using any commercial LLM api.
|
16 |
+
|
17 |
+
The model achieves a new SoTA result of 36.1% pass@1 on the HumanEval benchmark.
|
18 |
+
|
19 |
+
## Generation
|
20 |
+
|
21 |
+
```python
|
22 |
+
# pip install -q transformers
|
23 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
24 |
+
checkpoint = "sahil2801/instruct-codegen-16B"
|
25 |
+
device = "cuda"
|
26 |
+
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
|
27 |
+
model = AutoModelForCausalLM.from_pretrained(checkpoint).half().to(device)
|
28 |
+
instruction = "Write a function to scrape hacker news."
|
29 |
+
prompt = f"Below is an instruction that describes a task.\n Write a response that appropriately completes the request.\n\n ### Instruction:\n{instruction}\n\n### Response:"
|
30 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(device)
|
31 |
+
outputs = model.generate(**inputs,temperature=0.3,do_sample=True)
|
32 |
+
print(tokenizer.decode(outputs[0],skip_special_tokens=True))
|
33 |
+
```
|