Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-sa-4.0
|
3 |
+
datasets:
|
4 |
+
- bigcode/the-stack-dedup
|
5 |
+
- sahil2801/CodeAlpaca-20k
|
6 |
+
- teknium/GPTeacher-CodeInstruct
|
7 |
+
model-base:
|
8 |
+
- replit/replit-code-v1-3b
|
9 |
+
tags:
|
10 |
+
- code
|
11 |
+
- instruct
|
12 |
+
- self instruct
|
13 |
+
language:
|
14 |
+
- code
|
15 |
+
programming_language:
|
16 |
+
- Markdown
|
17 |
+
- Java
|
18 |
+
- JavaScript
|
19 |
+
- Python
|
20 |
+
- TypeScript
|
21 |
+
- PHP
|
22 |
+
- SQL
|
23 |
+
- JSX
|
24 |
+
- reStructuredText
|
25 |
+
- Rust
|
26 |
+
- C
|
27 |
+
- CSS
|
28 |
+
- Go
|
29 |
+
- C++
|
30 |
+
- HTML
|
31 |
+
- Vue
|
32 |
+
- Ruby
|
33 |
+
- Jupyter Notebook
|
34 |
+
- R
|
35 |
+
- Shell
|
36 |
+
---
|
37 |
+
|
38 |
+
Base Model: replit/replit-code-v1-3b
|
39 |
+
|
40 |
+
This model is uploaded in FP16, (half the size as the original fine tuned upload, for easier download)
|
41 |
+
|
42 |
+
This model is fine tuned on both Sahil2801's CodeAlpaca & Teknium's GPTeacher Code-Instruct to give Replit's Code model instruct capabilities.
|
43 |
+
|
44 |
+
Dataset links:
|
45 |
+
CodeAlpaca: https://huggingface.co/datasets/sahil2801/CodeAlpaca-20k
|
46 |
+
GPTeacher subset - Code Instruct: https://github.com/teknium1/GPTeacher
|
47 |
+
|
48 |
+
This model was trained on 2x a100 80gb for 1 hour on ~25,000 code instruction/response pairs in Alpaca format.
|
49 |
+
|
50 |
+
Refer to the base models HuggingFace model card for some basic requirements to run: https://huggingface.co/replit/replit-code-v1-3b
|
51 |
+
|
52 |
+
This fine tune can be prompted like any alpaca fine tune:
|
53 |
+
```
|
54 |
+
### Instruction:
|
55 |
+
<prompt>
|
56 |
+
|
57 |
+
### Input:
|
58 |
+
<additional context>
|
59 |
+
|
60 |
+
### Response:
|
61 |
+
```
|
62 |
+
|
63 |
+
or
|
64 |
+
|
65 |
+
```
|
66 |
+
### Instruction:
|
67 |
+
<prompt>
|
68 |
+
|
69 |
+
### Response:
|
70 |
+
|
71 |
+
```
|
72 |
+
|
73 |
+
This model seems to have issues with device="auto" in the model arguments (and requires the trust_remote_code=True, so you should maybe load it like I am here:
|
74 |
+
```
|
75 |
+
self.tokenizer = AutoTokenizer.from_pretrained("./Replit-CodeInstruct/", trust_remote_code=True)
|
76 |
+
self.model = AutoModelForCausalLM.from_pretrained(
|
77 |
+
"./Replit-CodeInstruct",
|
78 |
+
torch_dtype=torch.bfloat16,
|
79 |
+
trust_remote_code=True
|
80 |
+
)
|
81 |
+
self.model.to('cuda')
|
82 |
+
```
|
83 |
+
|
84 |
+
|
85 |
+
This model for me produced coherent outputs with the following sampler settings, but feel free to experiment:
|
86 |
+
```
|
87 |
+
max_new_tokens=128, do_sample=True, use_cache=True, temperature=0.2, top_p=0.9, eos_token_id= self.tokenizer.eos_token_id
|
88 |
+
```
|
89 |
+
|
90 |
+
In the tokenizer decode arguments, it also needs these settings:
|
91 |
+
```
|
92 |
+
skip_special_tokens=True, clean_up_tokenization_space=False
|
93 |
+
```
|
94 |
+
|
95 |
+
The following parameters were used with HuggingFace trainer to train the model with:
|
96 |
+
```
|
97 |
+
--model_name_or_path replit/replit-code-v1-3b --data_path /root/stanford_alpaca/train.json --bf16 True --output_dir /root/stanford_alpaca/model_ckpts --num_train_epochs 3 --per_device_train_batch_size 4 --per_device_eval_batch_size 1 --gradient_accumulation_steps 8 --save_strategy steps --save_steps 200 --save_total_limit 3 --learning_rate 1e-5 --weight_decay 0. --warmup_ratio 0.03 --tf32 True --run_name Replit1
|
98 |
+
```
|