poisson-fish commited on
Commit
39e28e7
1 Parent(s): 4e04f4b

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +124 -0
README.md ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ This is [Phind/Phind-CodeLlama-34B-v2](https://huggingface.co/Phind/Phind-CodeLlama-34B-v2) quantized to LMDeploy 4bit AWQ with the following config:
20
+ ```bash
21
+ python3 -m lmdeploy.lite.apis.auto_awq \
22
+ --model ./Phind-CodeLlama-34B-v2 \
23
+ --w_bits 4 \
24
+ --w_group_size 128 \
25
+ --work_dir ./quant
26
+ ```
27
+ # Original Model Card:
28
+
29
+ # **Phind-CodeLlama-34B-v2**
30
+ 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.
31
+
32
+ Furthermore, this model is **instruction-tuned** on the Alpaca/Vicuna format to be steerable and easy-to-use.
33
+
34
+ More details can be found on our [blog post](https://www.phind.com/blog/code-llama-beats-gpt4).
35
+
36
+ ## Model Details
37
+ This model is fine-tuned from Phind-CodeLlama-34B-v1 and achieves **73.8% pass@1** on HumanEval.
38
+
39
+ Phind-CodeLlama-34B-v2 is **multi-lingual** and is proficient in Python, C/C++, TypeScript, Java, and more.
40
+
41
+ ## Dataset Details
42
+ 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.
43
+
44
+ ## How to Get Started with the Model
45
+
46
+ Make sure to install Transformers from the main git branch:
47
+
48
+ ```bash
49
+ pip install git+https://github.com/huggingface/transformers.git
50
+ ```
51
+
52
+ ## How to Prompt the Model
53
+ This model accepts the Alpaca/Vicuna instruction format.
54
+
55
+ For example:
56
+
57
+ ```
58
+ ### System Prompt
59
+ You are an intelligent programming assistant.
60
+
61
+ ### User Message
62
+ Implement a linked list in C++
63
+
64
+ ### Assistant
65
+ ...
66
+ ```
67
+
68
+ ## How to reproduce HumanEval Results
69
+
70
+ To reproduce our results:
71
+
72
+ ```python
73
+
74
+ from transformers import AutoTokenizer, LlamaForCausalLM
75
+ from human_eval.data import write_jsonl, read_problems
76
+ from tqdm import tqdm
77
+
78
+ # initialize the model
79
+
80
+ model_path = "Phind/Phind-CodeLlama-34B-v2"
81
+ model = LlamaForCausalLM.from_pretrained(model_path, device_map="auto")
82
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
83
+
84
+ # HumanEval helper
85
+
86
+ def generate_one_completion(prompt: str):
87
+ tokenizer.pad_token = tokenizer.eos_token
88
+ inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=4096)
89
+
90
+ # Generate
91
+ 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)
92
+ completion = tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
93
+ completion = completion.replace(prompt, "").split("\n\n\n")[0]
94
+
95
+ return completion
96
+
97
+ # perform HumanEval
98
+ problems = read_problems()
99
+
100
+ num_samples_per_task = 1
101
+ samples = [
102
+ dict(task_id=task_id, completion=generate_one_completion(problems[task_id]["prompt"]))
103
+ for task_id in tqdm(problems)
104
+ for _ in range(num_samples_per_task)
105
+ ]
106
+ write_jsonl("samples.jsonl", samples)
107
+
108
+ # run `evaluate_functional_correctness samples.jsonl` in your HumanEval code sandbox
109
+ ```
110
+
111
+ ## Bias, Risks, and Limitations
112
+
113
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
114
+ This model has undergone very limited testing. Additional safety testing should be performed before any real-world deployments.
115
+
116
+
117
+ ## Training details
118
+
119
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
120
+
121
+ - **Hardware Type:** 32x A100-80GB
122
+ - **Hours used:** 480 GPU-hours
123
+ - **Cloud Provider:** AWS
124
+ - **Compute Region:** us-east-1