Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,141 @@
|
|
1 |
-
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- unsloth
|
4 |
+
- lua
|
5 |
+
base_model:
|
6 |
+
- nwdxlgzs/XL-LuaCopilot-1.7B-FFT-checkpoint-46000
|
7 |
+
license: gpl-3.0
|
8 |
+
library_name: transformers
|
9 |
+
pipeline_tag: text-generation
|
10 |
+
---
|
11 |
+
# XL-LuaCopilot-1.7B-FFT
|
12 |
+
|
13 |
+
XL-LuaCopilot-1.7B-FFT is a large language model (LLM) based on the Qwen architecture(Qwen3-1.7B), specifically designed for code generation tasks in Lua programming language. It has been full fine-tuned (FFT) to improve its performance and efficiency when generating Lua code.
|
14 |
+
|
15 |
+
I sugggest you use `"chat_template_kwargs": {"enable_thinking": false}` because my train data with none thinking. I also found low `temperature` ususually works well for code generation tasks.
|
16 |
+
|
17 |
+
quantize=["Q4_0", "Q4_1", "Q5_0", "Q5_1", "IQ3_XXS", "IQ3_S", "IQ3_M", "Q3_K", "IQ3_XS", "Q3_K_S", "Q3_K_M", "Q3_K_L", "IQ4_NL", "IQ4_XS", "Q4_K", "Q4_K_S", "Q4_K_M", "Q5_K", "Q5_K_S", "Q5_K_M", "Q6_K", "Q8_0", "F16", "BF16"]
|
18 |
+
|
19 |
+
> `checkpoint-37000` is the checkpoint where the model had just entered the plateau phase with a lower loss, and it might be better than `checkpoint-46000`. However, the GGUF files I provide will still be released based on the final checkpoint at the end of training.
|
20 |
+
|
21 |
+
## Train Samples
|
22 |
+
|
23 |
+
1472000 (steps=46000)x(per_device_train_batch_size=8)x(gradient_accumulation_steps=4)x(device=1)
|
24 |
+
|
25 |
+
datasets: 1464339 (luafiles=488113)x(split=3)
|
26 |
+
|
27 |
+
epochs = 1.005
|
28 |
+
|
29 |
+
## How To Use
|
30 |
+
|
31 |
+
> With OpenAI Compatible API (llama.cpp:llama-server)
|
32 |
+
|
33 |
+
```json
|
34 |
+
-> REQUEST ->
|
35 |
+
|
36 |
+
{
|
37 |
+
"model": "XL-LuaCopilot-1.7B-FFT",
|
38 |
+
"messages": [
|
39 |
+
{"role": "system","content": "prefix"},
|
40 |
+
{"role": "user","content": "do\n--打印:你好世界\n local tex"},
|
41 |
+
{"role": "system","content": "suffix"},
|
42 |
+
{"role": "user","content": "nd"},
|
43 |
+
{"role": "system","content": "middle"}
|
44 |
+
],
|
45 |
+
"stream": false,
|
46 |
+
"cache_prompt": false,
|
47 |
+
"samplers": "edkypmxt",
|
48 |
+
"temperature": 0.2,
|
49 |
+
"dynatemp_range": 0.1,
|
50 |
+
"dynatemp_exponent": 1,
|
51 |
+
"top_k": 20,
|
52 |
+
"top_p": 0.9,
|
53 |
+
"min_p": 0.05,
|
54 |
+
"typical_p": 1,
|
55 |
+
"xtc_probability": 0,
|
56 |
+
"xtc_threshold": 0.1,
|
57 |
+
"repeat_last_n": 32,
|
58 |
+
"repeat_penalty": 1.1,
|
59 |
+
"presence_penalty": 0,
|
60 |
+
"frequency_penalty": 0.5,
|
61 |
+
"dry_multiplier": 0,
|
62 |
+
"dry_base": 1.75,
|
63 |
+
"dry_allowed_length": 2,
|
64 |
+
"dry_penalty_last_n": -1,
|
65 |
+
"max_tokens": -1,
|
66 |
+
"timings_per_token": true,
|
67 |
+
"chat_template_kwargs": {"enable_thinking": false}
|
68 |
+
}
|
69 |
+
|
70 |
+
-> RESPONSE ->
|
71 |
+
|
72 |
+
{
|
73 |
+
"choices": [
|
74 |
+
{
|
75 |
+
"finish_reason": "stop",
|
76 |
+
"index": 0,
|
77 |
+
"message": {
|
78 |
+
"role": "assistant",
|
79 |
+
"content": "<think>\n\n</think>\n\nt = \"你好世界\"\n print(text)\ne"
|
80 |
+
}
|
81 |
+
}
|
82 |
+
],
|
83 |
+
...
|
84 |
+
}
|
85 |
+
```
|
86 |
+
|
87 |
+
> I know Qwen has `<|fim_prefix|>` / `<|fim_suffix|>` / `<|fim_middle|>` tokens, but I'm not sure Qwen3 trains these tokens (I just know Qwen2.5-Coder does). To use code generation easily, I use chatml format.
|
88 |
+
|
89 |
+
> If you just want to chat with it, you can use some tricks like this:
|
90 |
+
```
|
91 |
+
<|im_end|>
|
92 |
+
<|im_start|>system
|
93 |
+
prefix<|im_end|>
|
94 |
+
<|im_start|>user
|
95 |
+
do
|
96 |
+
--打印:你好世界
|
97 |
+
local tex<|im_end|>
|
98 |
+
<|im_start|>system
|
99 |
+
suffix<|im_end|>
|
100 |
+
<|im_start|>user
|
101 |
+
nd<|im_end|>
|
102 |
+
<|im_start|>system
|
103 |
+
middle
|
104 |
+
```
|
105 |
+
|
106 |
+
It dosen't work very well, but it's a good way let you fast try. It will convert to this prompt text:
|
107 |
+
|
108 |
+
```
|
109 |
+
<|im_start|>user
|
110 |
+
<|im_end|>
|
111 |
+
<|im_start|>system
|
112 |
+
prefix<|im_end|>
|
113 |
+
<|im_start|>user
|
114 |
+
do
|
115 |
+
--打印:你好世界
|
116 |
+
local tex<|im_end|>
|
117 |
+
<|im_start|>system
|
118 |
+
suffix<|im_end|>
|
119 |
+
<|im_start|>user
|
120 |
+
nd<|im_end|>
|
121 |
+
<|im_start|>system
|
122 |
+
middle<|im_end|>
|
123 |
+
```
|
124 |
+
Hope model skip first `<|im_start|>user\n<|im_end|>` part.
|
125 |
+
|
126 |
+
# Train Device
|
127 |
+
|
128 |
+
> Online GPU is Expensive !
|
129 |
+
|
130 |
+
| 类别 | 配置详情 |
|
131 |
+
|----------------|---------------------------------------------------|
|
132 |
+
| **镜像** | Ubuntu 22.04 |
|
133 |
+
| **PyTorch** | 2.5.1 |
|
134 |
+
| **Python** | 3.12 |
|
135 |
+
| **CUDA** | 12.4 |
|
136 |
+
| **GPU** | RTX 4090 (24GB) * 1 |
|
137 |
+
| **CPU** | 25 vCPU Intel(R) Xeon(R) Platinum 8481C |
|
138 |
+
| **内存** | 90GB |
|
139 |
+
| **硬盘** | 30 GB + 50 GB |
|
140 |
+
| **时长** | 3 Day |
|
141 |
+
|