File size: 4,433 Bytes
e37037e
 
 
3cc12ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1bd3944
 
 
 
 
772392d
1bd3944
 
 
 
 
 
 
 
 
 
 
 
772392d
1bd3944
 
 
 
 
772392d
 
1bd3944
 
 
 
 
 
 
 
 
 
 
 
 
 
 
772392d
1bd3944
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
772392d
1bd3944
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
license: bigcode-openrail-m
---

# **Opencsg-starcoder-v0.1**          [[中文]](#chinese)    [[English]](#english)

<a id="english"></a>

<p align="center">
<img width="300px" alt="OpenCSG" src="https://cdn-uploads.huggingface.co/production/uploads/64c71b27d43e4dee51a8b31a/GwYXPKuEoGCGcMICeW-sb.jpeg">
</p>

<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>


</div>
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.

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.



## Model Description

The [StarCoder](https://huggingface.co/bigcode/starcoder) models are 15.5B parameter models trained on 80+ programming languages from [The Stack (v1.2)](https://huggingface.co/datasets/bigcode/the-stack), with opt-out requests excluded.
Based on StarCoder, opencsg-starcoder-v0.1 was fintuned by OpenCSG LLM Research Team througth full-paramters fine-tuning method.
<br>


## Model Eval

HumanEval is the commonest code generation benchmark to evaluate the performance of models, especially on the the compeltion of code exercise cases.
Somehow, model evaluation is a kind of metaphysics. Different models are sensitive to different decoding methods, paramters and instructions.
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.

Thus, OpenCSG strained our brains to provide a relatively fair method to compare the fine-tuned models on HumanEval benchmark.
To simplify the comparision, we chosed the Pass@1 metric on python language, but our finetuning dataset includes samples in multi language.

**For fair, we evaluated the fine-tuned and origin starcoder models only with the original cases' prompts, not including any other instruction else.**

**Otherwise, we use greedy decoding method for each model during the evaluation.**

| Model     | HumanEval python pass@1                                                 |
| ---  |----------------------------------------------------------------------------- |
| starcoder  | 35.98%|
| opencsg-starcoder-v0.1| **39.02%** |

**TODO**
- we will provide much more benchmark scores on fine-tuned models in future.
- we will provide different practical problems to evaluate the performance of fine-tuned models in the field of software engineering.



# Model Usage


```python
from transformers import AutoTokenizer
import transformers
import torch

model = "opencsg/opencsg-starcoder-v0.1"

tokenizer = AutoTokenizer.from_pretrained(model, trust_remote_code=True)
pipeline = transformers.pipeline(
    "text-generation",
    model=model,
    torch_dtype=torch.float16,
    device_map="auto",
)
input_text = """def quick_sort(arr):
    if len(arr) <= 1:
        return arr
    pivot = arr[0]
    left = []
    right = []
<FILL_ME>
        if arr[i] < pivot:
            left.append(arr[i])
        else:
            right.append(arr[i])
    return quick_sort(left) + [pivot] + quick_sort(right)
"""
sequences = pipeline(
    input_text,
    do_sample=False,
    top_k=10,
    temperature=0.1,
    top_p=0.95,
    num_return_sequences=1,
    eos_token_id=tokenizer1.eos_token_id,
    max_length=256,
)
for seq in sequences:
    print(seq['generated_text'][len(input_text):])
```
# Training

## Hardware

- **GPUs:** 8 Tesla A800 
- **Training time:** 7 hours

## Software

- **Orchestration:** [Deepspeed](https://github.com/OpenCSGs)
- **Neural networks:** [PyTorch](https://github.com/pytorch/pytorch)
- **BP16 if applicable:** [apex](https://github.com/NVIDIA/apex)