Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,84 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coder-0.1
|
2 |
+
- sw 오류수정과제 개발 모델
|
3 |
+
- usage: c, cpp 코드 결함 탐지 및 수정 가이드라인 제공
|
4 |
+
- base model: deepseek-coder-7b-instruct-v1.4
|
5 |
+
- Model Size: 7B
|
6 |
+
- task_arithmetic 방법으로 Merge 수행하여 HumanEval 벤치마크에서 성능 66.1%에서 69.1%로 향상
|
7 |
+
|
8 |
+
### Merge Details
|
9 |
+
#### Merge Method
|
10 |
+
이 모델은 [deepseek-ai/deepseek-coder-7b-instruct-v1.5](https://huggingface.co/deepseek-ai/deepseek-coder-7b-instruct-v1.5) 를 기반으로 [task arithmetic](https://arxiv.org/abs/2212.04089) 방법론을 활용하여 성능을 향상시킨 모델입니다.
|
11 |
+
#### Configuration
|
12 |
+
```yaml
|
13 |
+
models:
|
14 |
+
- model: deepseek-ai/deepseek-coder-7b-instruct-v1.5
|
15 |
+
parameters:
|
16 |
+
weight: 1
|
17 |
+
- model: deepseek-ai/deepseek-coder-7b-instruct-v1.5
|
18 |
+
parameters:
|
19 |
+
weight: 1
|
20 |
+
- model: deepseek-ai/deepseek-coder-7b-instruct-v1.5
|
21 |
+
parameters:
|
22 |
+
weight: 1
|
23 |
+
merge_method: task_arithmetic
|
24 |
+
base_model: deepseek-ai/deepseek-coder-7b-instruct-v1.5
|
25 |
+
parameters:
|
26 |
+
normalize: true
|
27 |
+
int8_mask: true
|
28 |
+
dtype: float16
|
29 |
+
|
30 |
+
```
|
31 |
+
### Quickstart
|
32 |
+
```python
|
33 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
34 |
+
import torch
|
35 |
+
|
36 |
+
model_id = "Acryl-Jonathan/coder-0.1"
|
37 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
38 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True, torch_dtype=torch.bfloat16).cuda()
|
39 |
+
|
40 |
+
prompt= """{}
|
41 |
+
### Instruction:
|
42 |
+
{}
|
43 |
+
### Response:"""
|
44 |
+
|
45 |
+
system_message = """You are an expert in C/C++ debugging. Please detect the error codes and propose guidelines for fixing them.
|
46 |
+
#### IMPORTANT RULES
|
47 |
+
1. Only Use Korean
|
48 |
+
2. Organize the detected errors clearly and in order by code lines.
|
49 |
+
3. Describe how you detected errors and the appropriate measures you took to correct them.
|
50 |
+
4. comment detected error command line number
|
51 |
+
#### Final answer
|
52 |
+
detected error code line : line number
|
53 |
+
corrected error
|
54 |
+
correcting guidelines
|
55 |
+
"""
|
56 |
+
user_message="""```cpp
|
57 |
+
#include <iostream>
|
58 |
+
using namespace std;
|
59 |
+
int main() {
|
60 |
+
int a, b;
|
61 |
+
cout << "Enter two numbers: ";
|
62 |
+
cin >> a >> c;
|
63 |
+
if (a > 0 || b > 0) {
|
64 |
+
cout << "Both numbers are positive." << endl;
|
65 |
+
} else {
|
66 |
+
cout << "At least one number is not positive." << endl;
|
67 |
+
}
|
68 |
+
for (int i = 0; i < 5; i++); {
|
69 |
+
cout << "i: " << i << endl;
|
70 |
+
}
|
71 |
+
return "Done";
|
72 |
+
}```
|
73 |
+
"""
|
74 |
+
input_prmpt = prompt.format(system_message, user_message)
|
75 |
+
inputs = tokenizer(input_prmpt , return_tensors="pt").to(model.device)
|
76 |
+
outputs = model.generate(**inputs, max_length=128)
|
77 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
78 |
+
```
|
79 |
+
|
80 |
+
### Inference
|
81 |
+
```sh
|
82 |
+
python run.py
|
83 |
+
```
|
84 |
+
|