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
Reproduce humaneval pass@10 and pass@100
I was reproducing the Table 7 using MultiPL-E framework.
I used temperature 0.8 and follow the instruction wrote in the paper.
This is the result I got and the metric is much worse than the reported metric.
It seems that applying strip to the prompt in multiPL-E dataset improves the performance, but it is not enough to reach the reported metric (0.49 for pass@100).
Is there anyone who knows further details in the evaluation? Is there any difference between gpt_santacoder and this checkpoint?
ground_truth,1,0.9813664596273292,161,1,1
santacoder,10,0.05375377190333478,161,200,200
santacoder,100,0.19456654232712897,161,200,200
santacoder-strip-prompt-fp32,10,0.07665345298421541,161,200,200
santacoder-strip-prompt-fp32,100,0.30245030981097853,161,200,200
For further details, I was using this dataset.
https://huggingface.co/datasets/nuprl/MultiPL-E/viewer/humaneval-py/test
I think I found it. When we give prompt, remove newline from the prompt. When we get completion, prepend newline from the completion.
Dataset,Pass@k,Estimate,NumProblems,MinCompletions,MaxCompletions
ground_truth,1,0.9813664596273292,161,1,1
santacoder,10,0.05375377190333478,161,200,200
santacoder,100,0.19456654232712897,161,200,200
santacoder-strip-prompt-fp32,10,0.07665345298421541,161,200,200
santacoder-strip-prompt-fp32,100,0.30245030981097853,161,200,200
santacoder-strip-prompt-fp32-add-newline,10,0.27866654269616764,161,200,200
santacoder-strip-prompt-fp32-add-newline,100,0.48030915497938453,161,200,200