michaelroyzen commited on
Commit
30b5cd7
1 Parent(s): 66a980e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +112 -0
README.md CHANGED
@@ -1,3 +1,115 @@
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: 73.8%
15
+ verified: false
16
+ tags:
17
+ - code llama
18
  ---
19
+
20
+ # **Phind-CodeLlama-34B-v2**
21
+ We've fine-tuned Phind-CodeLlama-34B-v1 on an additional 1.5B tokens high-quality programming-related data, achieving **73.8% pass@1** on HumanEval. It's the current state-of-the-art amongst open-source models.
22
+
23
+ Furthermore, this model is **instruction-tuned** on the Alpaca/Vicuna format to be steerable and easy-to-use.
24
+
25
+ More details can be found on our [blog post](https://www.phind.com/blog/code-llama-beats-gpt4).
26
+
27
+ ## Model Details
28
+ This model is fine-tuned from Phind-CodeLlama-34B-v1 and achieves **73.8% pass@1** on HumanEval.
29
+
30
+ Phind-CodeLlama-34B-v2 is **multi-lingual** and is proficient in Python, C/C++, TypeScript, Java, and more.
31
+
32
+ ## Dataset Details
33
+ We fined-tuned on a proprietary dataset of 1.5B tokens of high quality programming problems and solutions. This dataset consists of instruction-answer pairs instead of code completion examples, making it structurally different from HumanEval. LoRA was not used -- both models are a native finetune. We used DeepSpeed ZeRO 3 and Flash Attention 2 to train these models in 15 hours on 32 A100-80GB GPUs. We used a sequence length of 4096 tokens.
34
+
35
+ ## How to Get Started with the Model
36
+
37
+ Make sure to install Transformers from the main git branch:
38
+
39
+ ```bash
40
+ pip install git+https://github.com/huggingface/transformers.git
41
+ ```
42
+
43
+ ## How to Prompt the Model
44
+ This model accepts the Alpaca/Vicuna instruction format.
45
+
46
+ For example:
47
+
48
+ ```
49
+ ### System Prompt
50
+ You are an intelligent programming assistant.
51
+
52
+ ### User Message
53
+ Implement a linked list in C++
54
+
55
+ ### Assistant
56
+ ...
57
+ ```
58
+
59
+ ## How to reproduce HumanEval Results
60
+
61
+ To reproduce our results:
62
+
63
+ ```python
64
+
65
+ from transformers import AutoTokenizer, LlamaForCausalLM
66
+ from human_eval.data import write_jsonl, read_problems
67
+ from tqdm import tqdm
68
+
69
+ # initialize the model
70
+
71
+ model_path = "Phind/Phind-CodeLlama-34B-v2"
72
+ model = LlamaForCausalLM.from_pretrained(model_path, device_map="auto")
73
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
74
+
75
+ # HumanEval helper
76
+
77
+ def generate_one_completion(prompt: str):
78
+ tokenizer.pad_token = tokenizer.eos_token
79
+ inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=4096)
80
+
81
+ # Generate
82
+ generate_ids = model.generate(inputs.input_ids.to("cuda"), max_new_tokens=384, do_sample=True, top_p=0.75, top_k=40, temperature=0.1)
83
+ completion = tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
84
+ completion = completion.replace(prompt, "").split("\n\n\n")[0]
85
+
86
+ return completion
87
+
88
+ # perform HumanEval
89
+ problems = read_problems()
90
+
91
+ num_samples_per_task = 1
92
+ samples = [
93
+ dict(task_id=task_id, completion=generate_one_completion(problems[task_id]["prompt"]))
94
+ for task_id in tqdm(problems)
95
+ for _ in range(num_samples_per_task)
96
+ ]
97
+ write_jsonl("samples.jsonl", samples)
98
+
99
+ # run `evaluate_functional_correctness samples.jsonl` in your HumanEval code sandbox
100
+ ```
101
+
102
+ ## Bias, Risks, and Limitations
103
+
104
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
105
+ This model has undergone very limited testing. Additional safety testing should be performed before any real-world deployments.
106
+
107
+
108
+ ## Training details
109
+
110
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
111
+
112
+ - **Hardware Type:** 32x A100-80GB
113
+ - **Hours used:** 480 GPU-hours
114
+ - **Cloud Provider:** AWS
115
+ - **Compute Region:** us-east-1