File size: 3,681 Bytes
b459148
 
 
 
 
 
ba94ecb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59a8a70
ba94ecb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---
license: bigcode-openrail-m
datasets:
- nickrosh/Evol-Instruct-Code-80k-v1
language:
- en
---



# epinnock/WizardCoder-1B-merged

##  Table of Contents

1. [Model Summary](##model-summary)
2. [Use](##use)
3. [Limitations](##limitations)
4. [Training](##training)
5. [License](##license)


## Model Summary


1B version of [StarCoderBase](https://huggingface.co/bigcode/starcoderbase). LoRa finetuned on Evol-Instruct-Code-80k-v1 dataset generated using the [Evol-Teacher](https://github.com/nickrosh/evol-teacher) repo. 
Based on Previous works of @WizardLM

- **Training Report:** [wandb](https://wandb.ai/aetherfoundry/huggingface/reports/Training-Report--Vmlldzo1MDUwOTcx)
- **Repository:** [bigcode/Starcoder](https://github.com/bigcode-project/starcoder)
- **Project Website:** [bigcode-project.org](https://www.bigcode-project.org)


## Use

### Generation
```python
# pip install -q transformers
from transformers import AutoModelForCausalLM, AutoTokenizer

checkpoint = "epinnock/wizardcoder-1b-merged"
device = "cuda" # for GPU usage or "cpu" for CPU usage

tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)

inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0]))
```

### Fill-in-the-middle
Fill-in-the-middle uses special tokens to identify the prefix/middle/suffix part of the input and output:

```python
input_text = "<fim_prefix>def print_hello_world():\n    <fim_suffix>\n    print('Hello world!')<fim_middle>"
inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0]))
```

### Attribution & Other Requirements

The pretraining dataset of the model was filtered for permissive licenses only. Nevertheless, the model can generate source code verbatim from the dataset. The code's license might require attribution and/or other specific requirements that must be respected. We provide a [search index](https://huggingface.co/spaces/bigcode/starcoder-search) that let's you search through the pretraining data to identify where generated code came from and apply the proper attribution to your code.

# Limitations

The model has been trained on source code from 80+ programming languages. The predominant natural language in source code is English although other languages are also present. As such the model is capable of generating code snippets provided some context but the generated code is not guaranteed to work as intended. It can be inefficient, contain bugs or exploits. See [the paper](https://drive.google.com/file/d/1cN-b9GnWtHzQRoE7M7gAEyivY0kl4BYs/view) for an in-depth discussion of the model limitations. 

# Training


starcoder/finetune/finetune.py 
--model_path=bigcode/starcoderbase-1b 
--dataset_name=nickrosh/Evol-Instruct-Code-80k-v1 
--split=train 
--size_valid_set 5000 
--streaming 
--seq_length 2048 
--max_steps 2400 
--batch_size 6 
--input_column_name=instruction 
--gradient_accumulation_steps 16 
--learning_rate 1e-4 
--lr_scheduler_type=cosine 
--num_warmup_steps 100 
--weight_decay 0.05

## Model

- **Architecture:** StarCoder GPT-2 model with multi-query attention and Fill-in-the-Middle objective with LoRA layers merged
- **Fintune steps:** 2400
- **Pretraining tokens:** 1 trillion
- **Precision:** bfloat16

## Hardware

- **GPUs:** 8 A5000
- **Training time:** 2 days



# License
The model is licensed under the BigCode OpenRAIL-M v1 license agreement. You can find the full agreement [here](https://huggingface.co/spaces/bigcode/bigcode-model-license-agreement).