Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,92 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- JetBrains/KExercises
|
5 |
+
base_model: deepseek-ai/deepseek-coder-6.7b-base
|
6 |
+
results:
|
7 |
+
- task:
|
8 |
+
type: text-generation
|
9 |
+
dataset:
|
10 |
+
name: MultiPL-HumanEval (Kotlin)
|
11 |
+
type: openai_humaneval
|
12 |
+
metrics:
|
13 |
+
- name: pass@1
|
14 |
+
type: pass@1
|
15 |
+
value: 55.28
|
16 |
+
tags:
|
17 |
+
- code
|
18 |
+
---
|
19 |
+
|
20 |
+
# Kexer models
|
21 |
+
|
22 |
+
Kexer models is a collection of fine-tuned open-source generative text models fine-tuned on Kotlin Exercices dataset.
|
23 |
+
This is a repository for fine-tuned Deepseek-coder-6.7b model in the Hugging Face Transformers format.
|
24 |
+
|
25 |
+
# Model use
|
26 |
+
|
27 |
+
```python
|
28 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
29 |
+
|
30 |
+
# Load pre-trained model and tokenizer
|
31 |
+
model_name = 'JetBrains/Deepseek-7B-Kexer'
|
32 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
33 |
+
model = AutoModelForCausalLM.from_pretrained(model_name).to('cuda')
|
34 |
+
|
35 |
+
# Create and encode input
|
36 |
+
input_text = """\
|
37 |
+
This function takes an integer n and returns factorial of a number:
|
38 |
+
fun factorial(n: Int): Int {\
|
39 |
+
"""
|
40 |
+
input_ids = tokenizer.encode(
|
41 |
+
input_text, return_tensors='pt'
|
42 |
+
).to('cuda')
|
43 |
+
|
44 |
+
# Generate
|
45 |
+
output = model.generate(
|
46 |
+
input_ids, max_length=60, num_return_sequences=1,
|
47 |
+
early_stopping=True, pad_token_id=tokenizer.eos_token_id,
|
48 |
+
)
|
49 |
+
|
50 |
+
# Decode output
|
51 |
+
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
|
52 |
+
print(generated_text)
|
53 |
+
```
|
54 |
+
|
55 |
+
As with the base model, we can use FIM. To do this, the following format must be used:
|
56 |
+
```
|
57 |
+
'<|fim▁begin|>' + prefix + '<|fim▁hole|>' + suffix + '<|fim▁end|>'
|
58 |
+
```
|
59 |
+
|
60 |
+
# Training setup
|
61 |
+
|
62 |
+
The model was trained on one A100 GPU with following hyperparameters:
|
63 |
+
|
64 |
+
| **Hyperparameter** | **Value** |
|
65 |
+
|:---------------------------:|:----------------------------------------:|
|
66 |
+
| `warmup` | 10% |
|
67 |
+
| `max_lr` | 1e-4 |
|
68 |
+
| `scheduler` | linear |
|
69 |
+
| `total_batch_size` | 256 (~130K tokens per step) |
|
70 |
+
| `num_epochs` | 4 |
|
71 |
+
|
72 |
+
More details about finetuning can be found in the technical report
|
73 |
+
|
74 |
+
# Fine-tuning data
|
75 |
+
|
76 |
+
For this model we used 15K exmaples of [Kotlin Exercices dataset](https://huggingface.co/datasets/JetBrains/KExercises). Every example follows HumanEval like format. In total dataset contains about 3.5M tokens.
|
77 |
+
For more information about the dataset follow the link.
|
78 |
+
|
79 |
+
# Evaluation
|
80 |
+
|
81 |
+
To evaluate we used Kotlin Humaneval ([more infromation here](https://huggingface.co/datasets/JetBrains/Kotlin_HumanEval))
|
82 |
+
|
83 |
+
Fine-tuned model:
|
84 |
+
|
85 |
+
| **Model name** | **Kotlin HumanEval Pass Rate** |
|
86 |
+
|:---------------------------:|:----------------------------------------:|
|
87 |
+
| `base model` | 40.99 |
|
88 |
+
| `fine-tuned model` | 55.28 |
|
89 |
+
|
90 |
+
# Ethical Considerations and Limitations
|
91 |
+
|
92 |
+
Deepseek and its variants are a new technology that carries risks with use. The testing conducted to date could not cover all scenarios. For these reasons, as with all LLMs, Kexer's potential outputs cannot be predicted in advance, and the model may in some instances produce inaccurate or objectionable responses to user prompts. The model was fine-tuned on a specific data format (Kotlin tasks), and deviation from this format can also lead to inaccurate or undesirable responses to user queries. Therefore, before deploying any applications of Kexer, developers should perform safety testing and tuning tailored to their specific applications of the model.
|