Text Generation
Transformers
PyTorch
gpt_bigcode
code
Eval Results (legacy)
text-generation-inference
Instructions to use bigcode/starcoderbase with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bigcode/starcoderbase with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="bigcode/starcoderbase")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("bigcode/starcoderbase") model = AutoModelForCausalLM.from_pretrained("bigcode/starcoderbase") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use bigcode/starcoderbase with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bigcode/starcoderbase" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bigcode/starcoderbase", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/bigcode/starcoderbase
- SGLang
How to use bigcode/starcoderbase 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/starcoderbase" \ --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/starcoderbase", "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/starcoderbase" \ --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/starcoderbase", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use bigcode/starcoderbase with Docker Model Runner:
docker model run hf.co/bigcode/starcoderbase
KeyError: 'gpt_bigcode'
#4
by Bilibili - opened
Hi, I am trying to run the given inference code in the Model Card, but it gives me such error after downloading the files:
Downloading (β¦)okenizer_config.json: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 677/677 [00:00<00:00, 44.4kB/s]
Downloading (β¦)olve/main/vocab.json: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 777k/777k [00:00<00:00, 1.02MB/s]
Downloading (β¦)olve/main/merges.txt: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 442k/442k [00:00<00:00, 774kB/s]
Downloading (β¦)/main/tokenizer.json: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 2.06M/2.06M [00:00<00:00, 2.09MB/s]
Downloading (β¦)cial_tokens_map.json: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 532/532 [00:00<00:00, 99.9kB/s]
Downloading (β¦)lve/main/config.json: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 1.04k/1.04k [00:00<00:00, 271kB/s]
Traceback (most recent call last):
File "/home/workspace//starcoder/starcoder.py", line 7, in <module>
model = AutoModelForCausalLM.from_pretrained(checkpoint, trust_remote_code=True).to(device)
File "/root/miniconda3/envs/starcoder/lib/python3.9/site-packages/transformers/models/auto/auto_factory.py", line 441, in from_pretrained
config, kwargs = AutoConfig.from_pretrained(
File "/root/miniconda3/envs/starcoder/lib/python3.9/site-packages/transformers/models/auto/configuration_auto.py", line 917, in from_pretrained
config_class = CONFIG_MAPPING[config_dict["model_type"]]
File "/root/miniconda3/envs/starcoder/lib/python3.9/site-packages/transformers/models/auto/configuration_auto.py", line 623, in __getitem__
raise KeyError(key)
KeyError: 'gpt_bigcode'
Seems like error in config.json, right?
Bilibili changed discussion status to closed
you need to be on transformers>=4.28.1