Update README.md
Browse files
README.md
CHANGED
@@ -18,8 +18,69 @@ model-index:
|
|
18 |
value: 7.84%
|
19 |
verified: false
|
20 |
---
|
21 |
-
159M model with the same architecture and tokenizer as StarCoder (8k context length) pre-trained on 100B tokens of Python from StarCoderData (~6 epochs)
|
22 |
|
23 |
-
|
24 |
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
value: 7.84%
|
19 |
verified: false
|
20 |
---
|
|
|
21 |
|
22 |
+
# TinyPyStarCoder
|
23 |
|
24 |
+
This is a 159M parameters model with teh same architecture as [StarCoder]() (8k context length, MQA & FIM). It was trained on the Python data from StarCoderData]()
|
25 |
+
for ~6 epochs which amounts to 100B tokens.
|
26 |
+
|
27 |
+
|
28 |
+
## Use
|
29 |
+
|
30 |
+
### Intended use
|
31 |
+
|
32 |
+
The model was trained on GitHub code, to assist with some tasks like [Assisted Generation](https://huggingface.co/blog/assisted-generation). For pure code completion, we advise using our 15B models [StarCoder]() or [StarCoderBase]().
|
33 |
+
|
34 |
+
|
35 |
+
### Generation
|
36 |
+
```python
|
37 |
+
# pip install -q transformers
|
38 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
39 |
+
|
40 |
+
checkpoint = "bigcode/tiny_pystarcoder"
|
41 |
+
device = "cuda" # for GPU usage or "cpu" for CPU usage
|
42 |
+
|
43 |
+
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
|
44 |
+
model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
|
45 |
+
|
46 |
+
inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)
|
47 |
+
outputs = model.generate(inputs)
|
48 |
+
print(tokenizer.decode(outputs[0]))
|
49 |
+
```
|
50 |
+
|
51 |
+
### Fill-in-the-middle
|
52 |
+
Fill-in-the-middle uses special tokens to identify the prefix/middle/suffix part of the input and output:
|
53 |
+
|
54 |
+
```python
|
55 |
+
input_text = "<fim-prefix>def print_hello_world():\n <fim-suffix>\n print('Hello world!')<fim-middle>"
|
56 |
+
inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
|
57 |
+
outputs = model.generate(inputs)
|
58 |
+
print(tokenizer.decode(outputs[0]))
|
59 |
+
```
|
60 |
+
|
61 |
+
# Limitations
|
62 |
+
|
63 |
+
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.
|
64 |
+
|
65 |
+
# Training
|
66 |
+
|
67 |
+
## Model
|
68 |
+
|
69 |
+
- **Architecture:** GPT-2 model with multi-query attention and Fill-in-the-Middle objective
|
70 |
+
- **Pretraining steps:** 50k
|
71 |
+
- **Pretraining tokens:** 100 billion
|
72 |
+
- **Precision:** bfloat16
|
73 |
+
|
74 |
+
## Hardware
|
75 |
+
|
76 |
+
- **GPUs:** 32 Tesla A100
|
77 |
+
- **Training time:** 18 hours
|
78 |
+
|
79 |
+
## Software
|
80 |
+
|
81 |
+
- **Orchestration:** [Megatron-LM](https://github.com/bigcode-project/Megatron-LM)
|
82 |
+
- **Neural networks:** [PyTorch](https://github.com/pytorch/pytorch)
|
83 |
+
- **BP16 if applicable:** [apex](https://github.com/NVIDIA/apex)
|
84 |
+
|
85 |
+
# License
|
86 |
+
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).
|