Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
pipeline_tag: text-generation
|
4 |
+
---
|
5 |
+
# π₯· Safurai-Csharp-34B
|
6 |
+
|
7 |
+
π [Article](https://www.safurai.com/blog/introducing-safurai-csharp)
|
8 |
+
|
9 |
+
π [Paper](https://www.safurai.com/)
|
10 |
+
|
11 |
+
<center><img src="https://i.imgur.com/REPqbYM.png" width="300"></center>
|
12 |
+
|
13 |
+
This is a [`codellama/CodeLlama-34b-hf`](https://huggingface.co/codellama/CodeLlama-34b-hf) model fine-tuned using QLoRA (4-bit precision) on 13B tokens of csharp evolved Q&A
|
14 |
+
|
15 |
+
We obtained <b>state-of-the-art performance</b> on the MultiPL-E code LLM benchmark for csharp, reaching 56% at pass@1 with n=5.
|
16 |
+
|
17 |
+
## π» Quantization
|
18 |
+
|
19 |
+
These are GGUF quantized versions of Safurai-Csharp-34B, it has been made by using the amazing [`llama.cpp`](https://github.com/ggerganov/llama.cpp) library.
|
20 |
+
|
21 |
+
## π§ Training
|
22 |
+
|
23 |
+
It was trained on 2 x NVIDIA A100 PCIe 80GB in 7h 40m with the following configuration file:
|
24 |
+
|
25 |
+
```yaml
|
26 |
+
base_model: codellama/CodeLlama-34b-hf
|
27 |
+
base_model_config: codellama/CodeLlama-34b-hf
|
28 |
+
model_type: LlamaForCausalLM
|
29 |
+
tokenizer_type: CodeLlamaTokenizer
|
30 |
+
is_llama_derived_model: true
|
31 |
+
hub_model_id: "Safurai/Evol-csharp-v1"
|
32 |
+
|
33 |
+
load_in_8bit: false
|
34 |
+
load_in_4bit: true
|
35 |
+
strict: false
|
36 |
+
|
37 |
+
datasets:
|
38 |
+
- path: Safurai/EvolInstruct-csharp-16k-13B-Alpaca
|
39 |
+
type: alpaca
|
40 |
+
dataset_prepared_path: last_run_prepared
|
41 |
+
val_set_size: 0.01
|
42 |
+
output_dir: ./qlora-out
|
43 |
+
|
44 |
+
sequence_len: 4096
|
45 |
+
sample_packing: true
|
46 |
+
pad_to_sequence_len: true
|
47 |
+
|
48 |
+
adapter: lora
|
49 |
+
lora_model_dir:
|
50 |
+
lora_r: 32
|
51 |
+
lora_alpha: 16
|
52 |
+
lora_dropout: 0.05
|
53 |
+
lora_target_linear: true
|
54 |
+
lora_fan_in_fan_out:
|
55 |
+
|
56 |
+
wandb_project: codellama-csharp
|
57 |
+
wandb_entity:
|
58 |
+
wandb_watch:
|
59 |
+
wandb_run_id:
|
60 |
+
wandb_log_model:
|
61 |
+
|
62 |
+
gradient_accumulation_steps: 4
|
63 |
+
micro_batch_size: 2
|
64 |
+
num_epochs: 3
|
65 |
+
optimizer: adamw_bnb_8bit
|
66 |
+
lr_scheduler: cosine
|
67 |
+
learning_rate: 0.0003
|
68 |
+
|
69 |
+
train_on_inputs: false
|
70 |
+
group_by_length: false
|
71 |
+
bf16: true
|
72 |
+
fp16: false
|
73 |
+
tf32: false
|
74 |
+
|
75 |
+
gradient_checkpointing: true
|
76 |
+
early_stopping_patience:
|
77 |
+
resume_from_checkpoint:
|
78 |
+
local_rank:
|
79 |
+
logging_steps: 1
|
80 |
+
xformers_attention:
|
81 |
+
flash_attention: true
|
82 |
+
|
83 |
+
warmup_steps: 40
|
84 |
+
eval_steps: 40
|
85 |
+
save_steps:
|
86 |
+
debug:
|
87 |
+
deepspeed:
|
88 |
+
weight_decay: 0.0
|
89 |
+
fsdp:
|
90 |
+
fsdp_config:
|
91 |
+
special_tokens:
|
92 |
+
bos_token: "<s>"
|
93 |
+
eos_token: "</s>"
|
94 |
+
unk_token: "<unk>"
|
95 |
+
```
|
96 |
+
|
97 |
+
## π Training loss curve:
|
98 |
+
|
99 |
+
![](https://i.imgur.com/rp1htuf.png)
|
100 |
+
|
101 |
+
## π Dataset composition:
|
102 |
+
|
103 |
+
![](https://i.imgur.com/kTNXgGX.png)
|
104 |
+
|
105 |
+
|
106 |
+
## π» Usage for GGUF
|
107 |
+
|
108 |
+
``` python
|
109 |
+
import os
|
110 |
+
|
111 |
+
model_list = [file for file in os.listdir(MODEL_NAME) if GGML_VERSION in file]
|
112 |
+
|
113 |
+
prompt = input("Enter your prompt: ")
|
114 |
+
chosen_method = input("Please specify the quantization method to run the model (options: " + ", ".join(model_list) + "): ")
|
115 |
+
|
116 |
+
# Verify the chosen method is in the list
|
117 |
+
if chosen_method not in model_list:
|
118 |
+
print("Invalid method chosen!")
|
119 |
+
else:
|
120 |
+
qtype = f"{MODEL_NAME}/{MODEL_NAME.lower()}.{GGML_VERSION}.{method}.bin"
|
121 |
+
!./llama.cpp/main -m {qtype} -n 128 --color -ngl 35 -p "{prompt}"
|
122 |
+
```
|
123 |
+
|
124 |
+
[<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)
|