Mediocreatmybest commited on
Commit
09dcf3c
1 Parent(s): ef177f2

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +111 -0
README.md ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: 69.5%
15
+ verified: false
16
+ tags:
17
+ - code llama
18
+ ---
19
+
20
+ Quantization with [bitsandbytes](https://github.com/TimDettmers/bitsandbytes)
21
+ _8-bit / fp4 / float16_
22
+ -_Mediocre_ 🥱
23
+
24
+
25
+ # **Phind-CodeLlama-34B-Python-v1**
26
+ 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.
27
+
28
+ More details can be found on our [blog post](https://www.phind.com/blog/code-llama-beats-gpt4).
29
+
30
+ ## Model Details
31
+ This model is fine-tuned from CodeLlama-34B-Python and achieves 69.5% pass@1 on HumanEval.
32
+
33
+ ## Dataset Details
34
+ 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.
35
+
36
+ ## How to Get Started with the Model
37
+
38
+ Make sure to install Transformers from the main git branch:
39
+
40
+ ```bash
41
+ pip install git+https://github.com/huggingface/transformers.git
42
+ ```
43
+
44
+ ## How to Prompt the Model
45
+ **Please note that this model is somewhat instruction-tuned, but not chat-tuned.**
46
+
47
+ Do not try to use the Llama chat markup with this model. Instead, simply tell it what you want and add "\n: " at the end of your task.
48
+
49
+ For example:
50
+
51
+ ```
52
+ Write me a linked list implementation: \n
53
+ ```
54
+
55
+ ## How to reproduce HumanEval Results
56
+
57
+ To reproduce our results:
58
+
59
+ ```python
60
+
61
+ from transformers import AutoTokenizer, LlamaForCausalLM
62
+ from human_eval.data import write_jsonl, read_problems
63
+ from tqdm import tqdm
64
+
65
+ # initialize the model
66
+
67
+ model_path = "Phind/Phind-CodeLlama-34B-v1"
68
+ model = LlamaForCausalLM.from_pretrained(model_path, device_map="auto")
69
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
70
+
71
+ # HumanEval helper
72
+
73
+ def generate_one_completion(prompt: str):
74
+ tokenizer.pad_token = tokenizer.eos_token
75
+ inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=4096)
76
+
77
+ # Generate
78
+ 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)
79
+ completion = tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
80
+ completion = completion.replace(prompt, "").split("\n\n\n")[0]
81
+
82
+ return completion
83
+
84
+ # perform HumanEval
85
+ problems = read_problems()
86
+
87
+ num_samples_per_task = 1
88
+ samples = [
89
+ dict(task_id=task_id, completion=generate_one_completion(problems[task_id]["prompt"]))
90
+ for task_id in tqdm(problems)
91
+ for _ in range(num_samples_per_task)
92
+ ]
93
+ write_jsonl("samples.jsonl", samples)
94
+
95
+ # run `evaluate_functional_correctness samples.jsonl` in your HumanEval code sandbox
96
+ ```
97
+
98
+ ## Bias, Risks, and Limitations
99
+
100
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
101
+ This model has undergone very limited testing. Additional safety testing should be performed before any real-world deployments.
102
+
103
+
104
+ ## Training details
105
+
106
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
107
+
108
+ - **Hardware Type:** 32x A100-80GB
109
+ - **Hours used:** 90 GPU-hours
110
+ - **Cloud Provider:** AWS
111
+ - **Compute Region:** us-east-1