epinnock commited on
Commit
b459148
1 Parent(s): c6d700d

Create README.md

Browse files

# WizardCoder-1B

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

@WizardLM


## Table of Contents

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

## Model Summary

WizardCoder-1B is a 1B parameter model trained on 80+ programming languages from [The Stack (v1.2)](https://huggingface.co/datasets/bigcode/the-stack), with opt-out requests excluded. The model uses [Multi Query Attention](https://arxiv.org/abs/1911.02150), [a context window of 8192 tokens](https://arxiv.org/abs/2205.14135), and was trained using the [Fill-in-the-Middle objective](https://arxiv.org/abs/2207.14255) on 1 trillion tokens.

It is then finetuned on 8 RTXA5000 for ~4 epochs (2400 steps) using LoRA and merged back into a single model.

Training run report:

https://api.wandb.ai/links/aetherfoundry/5usbdn6y

## Use

### Intended use

The model was trained on GitHub code. As such it is _not_ an instruction model and commands like "Write a function that computes the square root." do not work well. However, by using the [Tech Assistant prompt](https://huggingface.co/datasets/bigcode/ta-prompt) you can turn it into a capable technical assistant.

**Feel free to share your generations in the Community tab!**

### 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

```bash
--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:** GPT-2 model with multi-query attention and Fill-in-the-Middle objective
- **Pretraining steps:** 500k
- **Pretraining tokens:** 1 trillion
- **Precision:** bfloat16

## Hardware

- **GPUs:** 8 A5000
- **Training Report: https://api.wandb.ai/links/aetherfoundry/5usbdn6y

## Software

- **Repo:** [StarCoder](https://github.com/bigcode-project/starcoder)


# 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).

Files changed (1) hide show
  1. README.md +7 -0
README.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: bigcode-openrail-m
3
+ datasets:
4
+ - nickrosh/Evol-Instruct-Code-80k-v1
5
+ language:
6
+ - en
7
+ ---