Run this model with HF Jobs
Run nold/starcoder2-15b-GGUF 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/nold/starcoder2-15b-GGUF. 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/nold/starcoder2-15b-GGUF 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/nold/starcoder2-15b-GGUF. 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/nold/starcoder2-15b-GGUF. 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 nold/starcoder2-15b-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nold/starcoder2-15b-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nold/starcoder2-15b-GGUF")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("nold/starcoder2-15b-GGUF", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use nold/starcoder2-15b-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf nold/starcoder2-15b-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf nold/starcoder2-15b-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf nold/starcoder2-15b-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf nold/starcoder2-15b-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf nold/starcoder2-15b-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf nold/starcoder2-15b-GGUF:Q4_K_M
Use Docker
docker model run hf.co/nold/starcoder2-15b-GGUF:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use nold/starcoder2-15b-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nold/starcoder2-15b-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nold/starcoder2-15b-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/nold/starcoder2-15b-GGUF:Q4_K_M
- SGLang
How to use nold/starcoder2-15b-GGUF 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 "nold/starcoder2-15b-GGUF" \ --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": "nold/starcoder2-15b-GGUF", "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 "nold/starcoder2-15b-GGUF" \ --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": "nold/starcoder2-15b-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use nold/starcoder2-15b-GGUF with Ollama:
ollama run hf.co/nold/starcoder2-15b-GGUF:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use nold/starcoder2-15b-GGUF with Docker Model Runner:
docker model run hf.co/nold/starcoder2-15b-GGUF:Q4_K_M
- Lemonade
How to use nold/starcoder2-15b-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull nold/starcoder2-15b-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.starcoder2-15b-GGUF-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Upload folder using huggingface_hub (#1)
Browse files- 737ed73e668a45074793066c0f33a4f721b5e6ffce7adb5bbf5b33991bfaf7d3 (fe4bbc2cc6f923cbb4734ea3e4958b14d828db97)
- 77126f242b4b8abcebaa2b58a3b184b0df90b8780c8ea3b5041aa6bdb9d53d8f (59c6ac36b457dcf235bc9f40854e0b3a79125e18)
- beda355110530ef17efa52421a8b3a26218ebac3d0d12c875b962e1abaa36b78 (1fd2bd20a4687c9cada24f36ff704bf56d8881af)
- b8b5b6974a1ce55c5844c925e5e4a3e5de9a97f8e695336862e66b673e85e813 (efd1fc9bfc6ff18eef847a3ffc191b15d02a1333)
- 77cb08df6ddf89a06d2c4dcef9088937ce36f9c582d96b1cf88369a908ef4331 (56093e673cc345f05140bf14978ac1c03634d59c)
- e4c0bb70d37a361b919b8438da08c6e9dc13b7b8576d567e034aa79ea44131ae (138fdec1e3c9cd8ed2e979dd504aa38754fe22d6)
Files changed (7)
- .gitattributes+5
- README.mdAdded+217
- starcoder2-15b_Q3_K_M.ggufAdded+3
- starcoder2-15b_Q4_K_M.ggufAdded+3
- starcoder2-15b_Q5_K_M.ggufAdded+3
- starcoder2-15b_Q6_K.ggufAdded+3
- starcoder2-15b_Q8_0.ggufAdded+3
32 unmodified lines33343532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text32 unmodified lines333435363738394032 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textstarcoder2-15b_Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -textstarcoder2-15b_Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -textstarcoder2-15b_Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -textstarcoder2-15b_Q6_K.gguf filter=lfs diff=lfs merge=lfs -textstarcoder2-15b_Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217---pipeline_tag: text-generationinference: truewidget:- text: 'def print_hello_world():' example_title: Hello world group: Pythondatasets:- bigcode/the-stack-v2-trainlicense: bigcode-openrail-mlibrary_name: transformerstags:- codemodel-index:- name: starcoder2-15b results: - task: type: text-generation dataset: name: CruxEval-I type: cruxeval-i metrics: - type: pass@1 value: 48.1 - task: type: text-generation dataset: name: DS-1000 type: ds-1000 metrics: - type: pass@1 value: 33.8 - task: type: text-generation dataset: name: GSM8K (PAL) type: gsm8k-pal metrics: - type: accuracy value: 65.1 - task: type: text-generation dataset: name: HumanEval+ type: humanevalplus metrics: - type: pass@1 value: 37.8 - task: type: text-generation dataset: name: HumanEval type: humaneval metrics: - type: pass@1 value: 46.3 - task: type: text-generation dataset: name: RepoBench-v1.1 type: repobench-v1.1 metrics: - type: edit-smiliarity value: 74.08---
# StarCoder2
<center> <img src="https://huggingface.co/datasets/bigcode/admin_private/resolve/main/starcoder2_banner.png" alt="SC2" width="900" height="600"></center>
## Table of Contents
1. [Model Summary](#model-summary)2. [Use](#use)3. [Limitations](#limitations)4. [Training](#training)5. [License](#license)6. [Citation](#citation)
## Model Summary
StarCoder2-15B model is a 15B parameter model trained on 600+ programming languages from [The Stack v2](https://huggingface.co/datasets/bigcode/the-stack-v2-train), with opt-out requests excluded. The model uses [Grouped Query Attention](https://arxiv.org/abs/2305.13245), [a context window of 16,384 tokens](https://arxiv.org/abs/2205.14135) with [a sliding window attention of 4,096 tokens](https://arxiv.org/abs/2004.05150v2), and was trained using the [Fill-in-the-Middle objective](https://arxiv.org/abs/2207.14255) on 4+ trillion tokens. The model was trained with [NVIDIA NeMo™ Framework](https://www.nvidia.com/en-us/ai-data-science/generative-ai/nemo-framework/) using the [NVIDIA Eos Supercomputer](https://blogs.nvidia.com/blog/eos/) built with [NVIDIA DGX H100](https://www.nvidia.com/en-us/data-center/dgx-h100/) systems.
- **Project Website:** [bigcode-project.org](https://www.bigcode-project.org)- **Paper:** [Link](https://huggingface.co/papers/2402.19173)- **Point of Contact:** [contact@bigcode-project.org](mailto:contact@bigcode-project.org)- **Languages:** 600+ Programming languages
## Use
### Intended use
The model was trained on GitHub code as well as additional selected data sources such as Arxiv and Wikipedia. As such it is _not_ an instruction model and commands like "Write a function that computes the square root." do not work well.
### GenerationHere are some examples to get started with the model. You can find a script for fine-tuning in StarCoder2's [GitHub repository](https://github.com/bigcode-project/starcoder2).
First, make sure to install `transformers` from source:```bashpip install git+https://github.com/huggingface/transformers.git```
#### Running the model on CPU/GPU/multi GPU* _Using full precision_```python# pip install git+https://github.com/huggingface/transformers.git # TODO: merge PR to mainfrom transformers import AutoModelForCausalLM, AutoTokenizer
checkpoint = "bigcode/starcoder2-15b"device = "cuda" # for GPU usage or "cpu" for CPU usage
tokenizer = AutoTokenizer.from_pretrained(checkpoint)# for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)outputs = model.generate(inputs)print(tokenizer.decode(outputs[0]))```
* _Using `torch.bfloat16`_```python# pip install accelerateimport torchfrom transformers import AutoTokenizer, AutoModelForCausalLM
checkpoint = "bigcode/starcoder2-15b"tokenizer = AutoTokenizer.from_pretrained(checkpoint)
# for fp16 use `torch_dtype=torch.float16` insteadmodel = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto", torch_dtype=torch.bfloat16)
inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to("cuda")outputs = model.generate(inputs)print(tokenizer.decode(outputs[0]))``````bash>>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")Memory footprint: 32251.33 MB```
#### Quantized Versions through `bitsandbytes`* _Using 8-bit precision (int8)_
```python# pip install bitsandbytes acceleratefrom transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
# to use 4bit use `load_in_4bit=True` insteadquantization_config = BitsAndBytesConfig(load_in_8bit=True)
checkpoint = "bigcode/starcoder2-15b"tokenizer = AutoTokenizer.from_pretrained(checkpoint)model = AutoModelForCausalLM.from_pretrained(checkpoint, quantization_config=quantization_config)
inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to("cuda")outputs = model.generate(inputs)print(tokenizer.decode(outputs[0]))``````bash>>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")# load_in_8bitMemory footprint: 16900.18 MB# load_in_4bit>>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")Memory footprint: 9224.60 MB```### Attribution & Other Requirements
The pretraining dataset of the model was filtered for permissive licenses and code with no license only. Nevertheless, the model can generate source code verbatim from the dataset. The code's license might require attribution and/or other specific requirements that must be respected. We provide a [search index](https://huggingface.co/spaces/bigcode/search-v2) that let's you search through the pretraining data to identify where generated code came from and apply the proper attribution to your code.
# Limitations
The model has been trained on source code from 600+ programming languages. The predominant language in source is English although other languages are also present. As such the model is capable to generate 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://huggingface.co/papers/2402.19173) for an in-depth discussion of the model limitations.
# Training
## Model
- **Architecture:** Transformer decoder with grouped-query and sliding window attention and Fill-in-the-Middle objective- **Pretraining steps:** 1 million- **Pretraining tokens:** 4+ trillion- **Precision:** bfloat16
## Hardware
- **GPUs:** 1024 x H100
## Software
- **Framework:** [NeMo Framework](https://www.nvidia.com/en-us/ai-data-science/generative-ai/nemo-framework/) - **Neural networks:** [PyTorch](https://github.com/pytorch/pytorch)
# License
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).
# Citation
```bash@misc{lozhkov2024starcoder, title={StarCoder 2 and The Stack v2: The Next Generation}, author={Anton Lozhkov and Raymond Li and Loubna Ben Allal and Federico Cassano and Joel Lamy-Poirier and Nouamane Tazi and Ao Tang and Dmytro Pykhtar and Jiawei Liu and Yuxiang Wei and Tianyang Liu and Max Tian and Denis Kocetkov and Arthur Zucker and Younes Belkada and Zijian Wang and Qian Liu and Dmitry Abulkhanov and Indraneil Paul and Zhuang Li and Wen-Ding Li and Megan Risdal and Jia Li and Jian Zhu and Terry Yue Zhuo and Evgenii Zheltonozhskii and Nii Osae Osae Dade and Wenhao Yu and Lucas Krauß and Naman Jain and Yixuan Su and Xuanli He and Manan Dey and Edoardo Abati and Yekun Chai and Niklas Muennighoff and Xiangru Tang and Muhtasham Oblokulov and Christopher Akiki and Marc Marone and Chenghao Mou and Mayank Mishra and Alex Gu and Binyuan Hui and Tri Dao and Armel Zebaze and Olivier Dehaene and Nicolas Patry and Canwen Xu and Julian McAuley and Han Hu and Torsten Scholak and Sebastien Paquet and Jennifer Robinson and Carolyn Jane Anderson and Nicolas Chapados and Mostofa Patwary and Nima Tajbakhsh and Yacine Jernite and Carlos Muñoz Ferrandis and Lingming Zhang and Sean Hughes and Thomas Wolf and Arjun Guha and Leandro von Werra and Harm de Vries}, year={2024}, eprint={2402.19173}, archivePrefix={arXiv}, primaryClass={cs.SE}}```
***
Quantization of Model [bigcode/starcoder2-15b](https://huggingface.co/bigcode/starcoder2-15b).Created using [llm-quantizer](https://github.com/Nold360/llm-quantizer) Pipeline123version https://git-lfs.github.com/spec/v1oid sha256:46850c70de6cde0add8dd1d969ec5e5ef1fa3f06a09a8cf6eb18727025619c33size 8101037920123version https://git-lfs.github.com/spec/v1oid sha256:39f5c7318e79ca074ae1f145b0032ce8afadf98e7cf2444a7550d5cc9e0f3dd4size 9860188000123version https://git-lfs.github.com/spec/v1oid sha256:8eff8c468a50aed32c7f59906dc5a4009723ea9608fad54ff676a1f906e126besize 11431479136123version https://git-lfs.github.com/spec/v1oid sha256:02f0270f7305f6b2822f4b7258d8b54cc7566e24c98142460a7075a367e7dfaesize 13100975968123version https://git-lfs.github.com/spec/v1oid sha256:17eb99384c548294414993ad238f0d9865c3694911f76dc4815edd63d1706f57size 16965109600