michaelroyzen
commited on
Commit
•
6025980
1
Parent(s):
a5d9b2a
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,90 @@
|
|
1 |
---
|
2 |
license: llama2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: llama2
|
3 |
+
model-index:
|
4 |
+
- name: Phind-CodeLlama-34B-v1
|
5 |
+
results:
|
6 |
+
- task:
|
7 |
+
type: text-generation
|
8 |
+
dataset:
|
9 |
+
type: openai_humaneval
|
10 |
+
name: HumanEval
|
11 |
+
metrics:
|
12 |
+
- name: pass@1
|
13 |
+
type: pass@1
|
14 |
+
value: 67.6%
|
15 |
+
verified: false
|
16 |
---
|
17 |
+
|
18 |
+
# **Phind-CodeLlama-34B-v1**
|
19 |
+
We've fine-tuned CodeLlama-34B and CodeLlama-34B-Python on an internal Phind dataset that achieve 67.6% and 69.5% pass@1 on HumanEval, respectively. GPT-4 achieves 67%. We've applied OpenAI's decontamination methodology to our dataset to ensure result validity.
|
20 |
+
|
21 |
+
## Model Details
|
22 |
+
This model is fine-tuned from CodeLlama-34B and achieves 67.6% pass@1 on HumanEval.
|
23 |
+
|
24 |
+
## Dataset Details
|
25 |
+
We fined-tuned on a proprietary dataset of ~80k high quality programming problems and solutions. This dataset consists of instruction-answer pairs instead of code completion examples, making it structurally different from HumanEval. The Phind models were trained for 2 epochs, for a total of ~160k examples shown. LoRA was not used -- both models are a native finetune. We used DeepSpeed ZeRO 3 and Flash Attention 2 to train these models in three hours on 32 A100-80GB GPUs. We used a sequence length of 4096 tokens.
|
26 |
+
|
27 |
+
## How to Get Started with the Model
|
28 |
+
|
29 |
+
Make sure to install Transformers from the main git branch:
|
30 |
+
|
31 |
+
```bash
|
32 |
+
pip install git+https://github.com/huggingface/transformers.git
|
33 |
+
```
|
34 |
+
|
35 |
+
To reproduce our results:
|
36 |
+
|
37 |
+
```python
|
38 |
+
|
39 |
+
from transformers import AutoTokenizer, LlamaForCausalLM
|
40 |
+
from human_eval.data import write_jsonl, read_problems
|
41 |
+
from tqdm import tqdm
|
42 |
+
|
43 |
+
# initialize the model
|
44 |
+
|
45 |
+
model_path = "Phind/Phind-CodeLlama-34B-v1"
|
46 |
+
model = LlamaForCausalLM.from_pretrained(model_path, device_map="auto")
|
47 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
48 |
+
|
49 |
+
# HumanEval helper
|
50 |
+
|
51 |
+
def generate_one_completion(prompt: str):
|
52 |
+
tokenizer.pad_token = tokenizer.eos_token
|
53 |
+
inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=4096)
|
54 |
+
|
55 |
+
# Generate
|
56 |
+
generate_ids = model.generate(inputs.input_ids.to("cuda"), max_new_tokens=256, do_sample=True, top_p=0.75, top_k=40, temperature=0.1)
|
57 |
+
completion = tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
|
58 |
+
completion = completion.replace(prompt, "").split("\n\n\n")[0]
|
59 |
+
|
60 |
+
return completion
|
61 |
+
|
62 |
+
# perform HumanEval
|
63 |
+
problems = read_problems()
|
64 |
+
|
65 |
+
num_samples_per_task = 1
|
66 |
+
samples = [
|
67 |
+
dict(task_id=task_id, completion=generate_one_completion(problems[task_id]["prompt"]))
|
68 |
+
for task_id in tqdm(problems)
|
69 |
+
for _ in range(num_samples_per_task)
|
70 |
+
]
|
71 |
+
write_jsonl("samples.jsonl", samples)
|
72 |
+
|
73 |
+
# run `evaluate_functional_correctness samples.jsonl` in your HumanEval code sandbox
|
74 |
+
```
|
75 |
+
|
76 |
+
## Bias, Risks, and Limitations
|
77 |
+
|
78 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
79 |
+
This model has undergone very limited testing. Additional safety testing should be performed before any real-world deployments.
|
80 |
+
|
81 |
+
|
82 |
+
## Training details
|
83 |
+
|
84 |
+
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
85 |
+
|
86 |
+
- **Hardware Type:** 32x A100-80GB
|
87 |
+
- **Hours used:** 90 GPU-hours
|
88 |
+
- **Cloud Provider:** AWS
|
89 |
+
- **Compute Region:** us-east-1
|
90 |
+
|