Text Generation
Transformers
PyTorch
code
gpt2
custom_code
Eval Results (legacy)
text-generation-inference
Instructions to use bigcode/santacoder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bigcode/santacoder with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="bigcode/santacoder", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("bigcode/santacoder", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("bigcode/santacoder", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use bigcode/santacoder with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bigcode/santacoder" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bigcode/santacoder", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/bigcode/santacoder
- SGLang
How to use bigcode/santacoder with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "bigcode/santacoder" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bigcode/santacoder", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "bigcode/santacoder" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bigcode/santacoder", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use bigcode/santacoder with Docker Model Runner:
docker model run hf.co/bigcode/santacoder
Update README.md
Browse files
README.md
CHANGED
|
@@ -206,7 +206,7 @@ The SantaCoder models are a series of 1B parameter models trained on Python, Jav
|
|
| 206 |
- **Languages:** Python, Java, and JavaScript
|
| 207 |
|
| 208 |
|Model|Architecture|Objective|Filtering|
|
| 209 |
-
|:-|:-|:-|:-|
|
| 210 |
|`mha`|MHA|AR + FIM| Base |
|
| 211 |
|`no-fim`| MQA | AR| Base |
|
| 212 |
|`fim`| MQA | AR + FIM | Base |
|
|
@@ -248,7 +248,7 @@ print(tokenizer.decode(outputs[0]))
|
|
| 248 |
Fill-in-the-mid uses special tokens to identify the prefix/middle/suffic part of the input and output:
|
| 249 |
|
| 250 |
```python
|
| 251 |
-
input_text = "<fim-prefix>def print_hello_world():\n <fim-suffix>\n print(
|
| 252 |
inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
|
| 253 |
outputs = model.generate(inputs)
|
| 254 |
print(tokenizer.decode(outputs[0]))
|
|
@@ -258,10 +258,11 @@ print(tokenizer.decode(outputs[0]))
|
|
| 258 |
We upload the checkpoint of each experiment to a seperate branch as well as the intermediate checkpoints as commits on the branches. You can load them with the `revision` flag:
|
| 259 |
|
| 260 |
```python
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
|
|
|
| 265 |
```
|
| 266 |
|
| 267 |
### Attribution
|
|
|
|
| 206 |
- **Languages:** Python, Java, and JavaScript
|
| 207 |
|
| 208 |
|Model|Architecture|Objective|Filtering|
|
| 209 |
+
|:-|:-|:-|:-|
|
| 210 |
|`mha`|MHA|AR + FIM| Base |
|
| 211 |
|`no-fim`| MQA | AR| Base |
|
| 212 |
|`fim`| MQA | AR + FIM | Base |
|
|
|
|
| 248 |
Fill-in-the-mid uses special tokens to identify the prefix/middle/suffic part of the input and output:
|
| 249 |
|
| 250 |
```python
|
| 251 |
+
input_text = "<fim-prefix>def print_hello_world():\n <fim-suffix>\n print('Hello world!')<fim-middle>"
|
| 252 |
inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
|
| 253 |
outputs = model.generate(inputs)
|
| 254 |
print(tokenizer.decode(outputs[0]))
|
|
|
|
| 258 |
We upload the checkpoint of each experiment to a seperate branch as well as the intermediate checkpoints as commits on the branches. You can load them with the `revision` flag:
|
| 259 |
|
| 260 |
```python
|
| 261 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 262 |
+
"bigcode/santacoder",
|
| 263 |
+
revision="no-fim", # name of branch or commit hash
|
| 264 |
+
trust_remote_code=True
|
| 265 |
+
)
|
| 266 |
```
|
| 267 |
|
| 268 |
### Attribution
|