Skip to content

Commit 4b7a8a3

Browse files
authored
Update README.md
1 parent f63c3de commit 4b7a8a3

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

README.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
# 💫 StarCoder
22

3-
## What is this about?
4-
💫 StarCoder is a language model (LM) trained on source code and natural language text. Its training data incorporates more that 80 different programming languages as well as text extracted from github issues and commits and from notebooks. This repository showcases how we can fine-tune this LM on a specific downstream task.
3+
# What is this about?
4+
💫 StarCoder is a language model (LM) trained on source code and natural language text. Its training data incorporates more that 80 different programming languages as well as text extracted from github issues and commits and from notebooks. This repository showcases how we get an overview of this LM's capabilities.
5+
6+
# Table of Contents
7+
1. [Fine-tuning](#fine-tuning)
8+
- [Step by step installation with conda](#step-by-step-installation-with-conda)
9+
- [Datasets](#datasets)
10+
- [Code Alpaca](#code-alpaca-ca)
11+
- [Stack Exchange](#stack-exchange-se)
12+
- [Merging PEFT adapter layers](#merging-peft-adapter-layers)
13+
- [Example outputs](#example-outputs)
14+
# Fine-tuning
15+
16+
Here, we showcase how we can fine-tune this LM on a specific downstream task.
517

618
## Step by step installation with conda
719

@@ -52,10 +64,10 @@ wandb login
5264
```
5365
Now that everything is done, you can clone the repository and get into the corresponding directory.
5466

55-
## Fine-Tuning (`finetune.py`)
67+
## Datasets
5668
💫 StarCoder can be fine-tuned to achieve multiple downstream tasks. Our interest here is to fine-tune StarCoder in order to make it follow instructions. [Instruction fine-tuning](https://arxiv.org/pdf/2109.01652.pdf) has gained a lot of attention recently as it proposes a simple framework that teaches language models to align their outputs with human needs. That procedure requires the availability of quality instruction datasets, which contain multiple `instruction - answer` pairs. Unfortunately such datasets are not ubiquitous but thanks to Hugging Face 🤗's [datasets](https://github.com/huggingface/datasets) library we can have access to some good proxies. To fine-tune cheaply and efficiently, we use Hugging Face 🤗's [PEFT](https://github.com/huggingface/peft) as well as Tim Dettmers' [bitsandbytes](https://github.com/TimDettmers/bitsandbytes).
5769

58-
### Code Alpaca (CA)
70+
### Code Alpaca CA
5971
[Code Alpaca](https://huggingface.co/datasets/HuggingFaceH4/CodeAlpaca_20K) is a dataset of about 20K `prompt - completion` pairs generated by the technique presented in the [self-instruct](https://arxiv.org/abs/2212.10560) paper. Each prompt describes a task that is asked by a user and the corresponding completion is the answer to that task as generated by `text-davinci-003`.
6072

6173
To execute the fine-tuning script run the following command:
@@ -94,7 +106,7 @@ python -m torch.distributed.launch \
94106
--weight_decay 0.05\
95107
--output_dir="./checkpoints" \
96108
```
97-
### Stack Exchange (SE)
109+
### Stack Exchange SE
98110
[Stack Exchange](https://en.wikipedia.org/wiki/Stack_Exchange) is a well-known network of Q&A websites on topics in diverse fields. It is a place where a user can ask a question and obtain answers from other users. Those answers are scored and ranked based on their quality. [Stack exchange instruction](https://huggingface.co/datasets/ArmelR/stack-exchange-instruction) is a dataset that was obtained by scrapping the site in order to build a collection of Q&A pairs. A language model can then be fine-tuned on that dataset to make it elicit strong and diverse question-answering skills.
99111

100112
To execute the fine-tuning script run the following command:
@@ -141,7 +153,7 @@ python -m torch.distributed.launch \
141153
--weight_decay 0.05\
142154
--output_dir="./checkpoints" \
143155
```
144-
### Merging PEFT adapter layers
156+
## Merging PEFT adapter layers
145157
If you train a model with PEFT, you'll need to merge the adapter layers with the base model if you want to run inference / evaluation. To do so, run:
146158
```bash
147159
python finetune/merge_peft_adapters.py --model_name_or_path model_to_merge --peft_model_path model_checkpoint
@@ -155,7 +167,9 @@ For example
155167
python finetune/merge_peft_adapters.py --model_name_or_path bigcode/large-model --peft_model_path checkpoints/checkpoint-1000 --push_to_hub
156168
```
157169

158-
### Example outputs (CA)
170+
## Example outputs
171+
172+
These are some examples of StarCoder fine-tuned on Code Alpaca.
159173

160174
**Instruction**: Write a function to compute the geometric mean of a list of numbers.
161175

0 commit comments

Comments
 (0)