Text Generation
Transformers
Safetensors
starcoder2
code
Eval Results (legacy)
text-generation-inference
Instructions to use bigcode/starcoder2-3b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bigcode/starcoder2-3b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="bigcode/starcoder2-3b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("bigcode/starcoder2-3b") model = AutoModelForCausalLM.from_pretrained("bigcode/starcoder2-3b") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use bigcode/starcoder2-3b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bigcode/starcoder2-3b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bigcode/starcoder2-3b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/bigcode/starcoder2-3b
- SGLang
How to use bigcode/starcoder2-3b 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/starcoder2-3b" \ --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/starcoder2-3b", "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/starcoder2-3b" \ --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/starcoder2-3b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use bigcode/starcoder2-3b with Docker Model Runner:
docker model run hf.co/bigcode/starcoder2-3b
50000
Browse files- config.json +35 -0
- pytorch_model.bin +3 -0
config.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation_function": "gelu",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"GPTBigCodeLMHeadModel"
|
| 5 |
+
],
|
| 6 |
+
"attention_softmax_in_fp32": true,
|
| 7 |
+
"attention_window_size": 8192,
|
| 8 |
+
"attn_pdrop": 0.1,
|
| 9 |
+
"bos_token_id": 0,
|
| 10 |
+
"embd_pdrop": 0.1,
|
| 11 |
+
"eos_token_id": 0,
|
| 12 |
+
"head_groups": 2,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"layer_norm_epsilon": 1e-05,
|
| 15 |
+
"model_type": "gpt_bigcode",
|
| 16 |
+
"n_embd": 3072,
|
| 17 |
+
"n_head": 24,
|
| 18 |
+
"n_inner": 12288,
|
| 19 |
+
"n_layer": 30,
|
| 20 |
+
"n_positions": 16384,
|
| 21 |
+
"resid_pdrop": 0.1,
|
| 22 |
+
"rotary_embedding_scale": -13.81551,
|
| 23 |
+
"scale_attention_softmax_in_fp32": true,
|
| 24 |
+
"scale_attn_weights": true,
|
| 25 |
+
"summary_activation": null,
|
| 26 |
+
"summary_first_dropout": 0.1,
|
| 27 |
+
"summary_proj_to_labels": true,
|
| 28 |
+
"summary_type": "cls_index",
|
| 29 |
+
"summary_use_proj": true,
|
| 30 |
+
"transformers_version": "4.34.1",
|
| 31 |
+
"use_cache": true,
|
| 32 |
+
"use_position_embeddings": false,
|
| 33 |
+
"use_rotary_embeddings": true,
|
| 34 |
+
"vocab_size": 49152
|
| 35 |
+
}
|
pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3147adbbd9adb07a4281b2a4f11e0e33b637a6e4d656f9898168cfdbbfb51518
|
| 3 |
+
size 23636934338
|