Text Generation
Transformers
Safetensors
starcoder2
code
Eval Results (legacy)
text-generation-inference
Run this model with HF Jobs
Run bigcode/starcoder2-7b on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/bigcode/starcoder2-7b. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/bigcode/starcoder2-7b on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/bigcode/starcoder2-7b. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/bigcode/starcoder2-7b. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use bigcode/starcoder2-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bigcode/starcoder2-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="bigcode/starcoder2-7b")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("bigcode/starcoder2-7b") model = AutoModelForCausalLM.from_pretrained("bigcode/starcoder2-7b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use bigcode/starcoder2-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bigcode/starcoder2-7b" # 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-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/bigcode/starcoder2-7b
- SGLang
How to use bigcode/starcoder2-7b 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-7b" \ --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-7b", "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-7b" \ --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-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use bigcode/starcoder2-7b with Docker Model Runner:
docker model run hf.co/bigcode/starcoder2-7b
Adding Evaluation Results
#11
by leaderboard-pr-bot - opened
1234561 unmodified line891011121314151617181945 unmodified lines656667686970143 unmodified lines214215216217---pipeline_tag: text-generationinference:parameters:temperature: 0.2top_p: 0.951 unmodified line- text: 'def print_hello_world():'example_title: Hello worldgroup: Pythondatasets:- bigcode/the-stack-v2-trainlicense: bigcode-openrail-mlibrary_name: transformerstags:- codemodel-index:- name: starcoder2-7bresults:45 unmodified linesmetrics:- type: edit-smiliarityvalue: 72.07---# StarCoder2143 unmodified linesarchivePrefix={arXiv},primaryClass={cs.SE}}```1234567891011121 unmodified line14151617181945 unmodified lines6566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170143 unmodified lines314315316317318319320321322323324325326327328329330---license: bigcode-openrail-mlibrary_name: transformerstags:- codedatasets:- bigcode/the-stack-v2-trainpipeline_tag: text-generationinference:parameters:temperature: 0.2top_p: 0.951 unmodified line- text: 'def print_hello_world():'example_title: Hello worldgroup: Pythonmodel-index:- name: starcoder2-7bresults:45 unmodified linesmetrics:- type: edit-smiliarityvalue: 72.07- task:type: text-generationname: Text Generationdataset:name: AI2 Reasoning Challenge (25-Shot)type: ai2_arcconfig: ARC-Challengesplit: testargs:num_few_shot: 25metrics:- type: acc_normvalue: 38.31name: normalized accuracysource:url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=bigcode/starcoder2-7bname: Open LLM Leaderboard- task:type: text-generationname: Text Generationdataset:name: HellaSwag (10-Shot)type: hellaswagsplit: validationargs:num_few_shot: 10metrics:- type: acc_normvalue: 51.91name: normalized accuracysource:url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=bigcode/starcoder2-7bname: Open LLM Leaderboard- task:type: text-generationname: Text Generationdataset:name: MMLU (5-Shot)type: cais/mmluconfig: allsplit: testargs:num_few_shot: 5metrics:- type: accvalue: 41.21name: accuracysource:url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=bigcode/starcoder2-7bname: Open LLM Leaderboard- task:type: text-generationname: Text Generationdataset:name: TruthfulQA (0-shot)type: truthful_qaconfig: multiple_choicesplit: validationargs:num_few_shot: 0metrics:- type: mc2value: 41.99source:url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=bigcode/starcoder2-7bname: Open LLM Leaderboard- task:type: text-generationname: Text Generationdataset:name: Winogrande (5-shot)type: winograndeconfig: winogrande_xlsplit: validationargs:num_few_shot: 5metrics:- type: accvalue: 59.19name: accuracysource:url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=bigcode/starcoder2-7bname: Open LLM Leaderboard- task:type: text-generationname: Text Generationdataset:name: GSM8k (5-shot)type: gsm8kconfig: mainsplit: testargs:num_few_shot: 5metrics:- type: accvalue: 25.09name: accuracysource:url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=bigcode/starcoder2-7bname: Open LLM Leaderboard---# StarCoder2143 unmodified linesarchivePrefix={arXiv},primaryClass={cs.SE}}```# [Open LLM Leaderboard Evaluation Results](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)Detailed results can be found [here](https://huggingface.co/datasets/open-llm-leaderboard/details_bigcode__starcoder2-7b)| Metric |Value||---------------------------------|----:||Avg. |42.95||AI2 Reasoning Challenge (25-Shot)|38.31||HellaSwag (10-Shot) |51.91||MMLU (5-Shot) |41.21||TruthfulQA (0-shot) |41.99||Winogrande (5-shot) |59.19||GSM8k (5-shot) |25.09|
README.md+121-8