TomPei commited on
Commit
7fcaa1d
·
verified ·
1 Parent(s): 251d817

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +114 -0
README.md CHANGED
@@ -1,3 +1,117 @@
1
  ---
 
 
 
 
 
2
  license: llama2
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - code
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - llama-2
7
  license: llama2
8
  ---
9
+
10
+
11
+
12
+ # **Opencsg-CodeLlama-34b-v0.1** [[中文]](#chinese) [[English]](#english)
13
+
14
+ <a id="english"></a>
15
+
16
+ <p align="center">
17
+ <img width="300px" alt="OpenCSG" src="https://cdn-uploads.huggingface.co/production/uploads/64c71b27d43e4dee51a8b31a/GwYXPKuEoGCGcMICeW-sb.jpeg">
18
+ </p>
19
+
20
+ <p align="center"><a href="https://portal.opencsg.com/models">[OpenCSG Community]</a> <a href="https://github.com/opencsgs">[github]</a> <a href="https://cdn-uploads.huggingface.co/production/uploads/64c71b27d43e4dee51a8b31a/HU6vz21qKTEmUBCWqCFh9.jpeg">[wechat]</a> <a href="https://twitter.com/OpenCsg">[Twitter]</a> </p>
21
+
22
+
23
+ </div>
24
+ OpenCSG stands for Converged resources, Software refined, and Generative LM. The 'C' represents Converged resources, indicating the integration and full utilization of hybrid resources. The 'S' stands for Software refined, signifying software that is refined by large models. The 'G' represents Generative LM, which denotes widespread, inclusive, and democratized generative large models.
25
+
26
+ The vision of OpenCSG is to empower every industry, every company, and every individual to own their models. We adhere to the principles of openness and open source, making the large model software stack of OpenCSG available to the community. We welcome everyone to use, feedback, and collaborative contribute.
27
+
28
+
29
+
30
+
31
+
32
+ ## Model Description
33
+
34
+ CodeLlama is a collection of pretrained and fine-tuned generative text models from Llama2, which ranges in scale from 7 billion to 34 billion parameters.
35
+ Based on CodeLlama, opencsg-CodeLlama-v0.1 is a series of fintuned models througth full-paramters fine-tuning method.
36
+ <br>
37
+
38
+ This is the repository for the base 34B version finetuned based on [CodeLlama-13b-hf](https://huggingface.co/codellama/CodeLlama-34b-hf).
39
+
40
+ | Model Size | Base Model |
41
+ | --- | ----------------------------------------------------------------------------- |
42
+ | 7B | [opencsg/Opencsg-CodeLlama-7b-v0.1](https://huggingface.co/opencsg/opencsg-CodeLlama-7b-v0.1) |
43
+ | 13B | [opencsg/Opencsg-CodeLlama-13b-v0.1](https://huggingface.co/opencsg/opencsg-CodeLlama-13b-v0.1) |
44
+ | 34B | [opencsg/Opencsg-CodeLlama-34b-v0.1](https://huggingface.co/opencsg/opencsg-CodeLlama-34b-v0.1) |
45
+
46
+
47
+ ## Model Eval
48
+
49
+ HumanEval is the commonest code generation benchmark to evaluate the performance of models, especially on the the compeltion of code exercise cases.
50
+ Somehow, model evaluation is a kind of metaphysics. Different models are sensitive to different decoding methods, paramters and instructions.
51
+ It is impratical for us to manually set specific configuration for each fine-tuned model, because a real LLM should master the universal capability despite the parameters manipulated by users.
52
+
53
+ Thus, OpenCSG strained our brains to provide a relatively fair method to compare the fine-tuned models on HumanEval benchmark.
54
+ To simplify the comparision, we chosed the Pass@1 metric on python language, but our finetuning dataset includes samples in multi language.
55
+
56
+ **For fair, we evaluated the fine-tuned and origin codellama models only with the original cases' prompts, not including any other instruction else.**
57
+
58
+ **Otherwise, we use greedy decoding method for each model during the evaluation.**
59
+
60
+ | Model | HumanEval python pass@1 |
61
+ | --- |----------------------------------------------------------------------------- |
62
+ | CodeLlama-7b-hf | 30.5%|
63
+ | opencsg-CodeLlama-7b-v0.1(4k) | **42.7%** |
64
+ | CodeLlama-13b-hf | 36.0%|
65
+ | opencsg-CodeLlama-13b-v0.1(4k) | **45.1%** |
66
+ | CodeLlama-34b-hf | 48.2%|
67
+ | opencsg-CodeLlama-34b-v0.1(4k)| **48.8%** |
68
+
69
+ **TODO**
70
+ - we will provide much more benchmark scores on fine-tuned models in future.
71
+ - we will provide different practical problems to evaluate the performance of fine-tuned models in the field of software engineering.
72
+
73
+
74
+
75
+ # Model Usage
76
+
77
+ ```python
78
+ from transformers import AutoTokenizer
79
+ import transformers
80
+ import torch
81
+
82
+ model = "opencsg/opencsg-CodeLlama-34b-v0.1"
83
+
84
+ tokenizer = AutoTokenizer.from_pretrained(model, trust_remote_code=True)
85
+ pipeline = transformers.pipeline(
86
+ "text-generation",
87
+ model=model,
88
+ torch_dtype=torch.float16,
89
+ device_map="auto",
90
+ )
91
+ input_text = "#write a quick sort algorithm."
92
+ sequences = pipeline(
93
+ input_text,
94
+ do_sample=False,
95
+ top_k=10,
96
+ temperature=0.1,
97
+ top_p=0.95,
98
+ num_return_sequences=1,
99
+ eos_token_id=tokenizer.eos_token_id,
100
+ max_length=256,
101
+ )
102
+ for seq in sequences:
103
+ print(seq['generated_text'][len(input_text):])
104
+ ```
105
+ # Training
106
+
107
+ ## Hardware
108
+
109
+ - **GPUs:** 8 Tesla A800
110
+ - **Training time:** 4 hours
111
+
112
+ ## Software
113
+
114
+ - **Orchestration:** [Deepspeed](https://github.com/OpenCSGs)
115
+ - **Neural networks:** [PyTorch](https://github.com/pytorch/pytorch)
116
+ - **BP16 if applicable:** [apex](https://github.com/NVIDIA/apex)
117
+