Text Generation
Transformers
PyTorch
Safetensors
gpt_bigcode
code
Eval Results (legacy)
text-generation-inference
Run this model with HF Jobs
Run bigcode/tiny_starcoder_py 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/tiny_starcoder_py. 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/tiny_starcoder_py 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/tiny_starcoder_py. 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/tiny_starcoder_py. 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/tiny_starcoder_py with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bigcode/tiny_starcoder_py with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="bigcode/tiny_starcoder_py")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("bigcode/tiny_starcoder_py") model = AutoModelForCausalLM.from_pretrained("bigcode/tiny_starcoder_py", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use bigcode/tiny_starcoder_py with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bigcode/tiny_starcoder_py" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bigcode/tiny_starcoder_py", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/bigcode/tiny_starcoder_py
- SGLang
How to use bigcode/tiny_starcoder_py 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/tiny_starcoder_py" \ --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/tiny_starcoder_py", "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/tiny_starcoder_py" \ --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/tiny_starcoder_py", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use bigcode/tiny_starcoder_py with Docker Model Runner:
docker model run hf.co/bigcode/tiny_starcoder_py
Update README.md
Browse files17 unmodified lines181920212223242517 unmodified linesvalue: 7.84%verified: false---159M model with the same architecture and tokenizer as StarCoder (8k context length) pre-trained on 100B tokens of Python from StarCoderData (~6 epochs)Full training arguments + loss at: https://wandb.ai/loubnabnl/tiny_starcoder/runs/qogbxkgy/overview?workspace=user-loubnabnlPass@1: 7.84%17 unmodified lines18192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858617 unmodified linesvalue: 7.84%verified: false---# TinyPyStarCoderThis is a 159M parameters model with teh same architecture as [StarCoder]() (8k context length, MQA & FIM). It was trained on the Python data from StarCoderData]()for ~6 epochs which amounts to 100B tokens.## Use### Intended useThe model was trained on GitHub code, to assist with some tasks like [Assisted Generation](https://huggingface.co/blog/assisted-generation). For pure code completion, we advise using our 15B models [StarCoder]() or [StarCoderBase]().### Generation```python# pip install -q transformersfrom transformers import AutoModelForCausalLM, AutoTokenizercheckpoint = "bigcode/tiny_pystarcoder"device = "cuda" # for GPU usage or "cpu" for CPU usagetokenizer = AutoTokenizer.from_pretrained(checkpoint)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]))```### Fill-in-the-middleFill-in-the-middle uses special tokens to identify the prefix/middle/suffix part of the input and output:```pythoninput_text = "<fim-prefix>def print_hello_world():\n <fim-suffix>\n print('Hello world!')<fim-middle>"inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)outputs = model.generate(inputs)print(tokenizer.decode(outputs[0]))```# LimitationsThe model has been trained on source code from 80+ programming languages. The predominant natural language in source code is English although other languages are also present. As such the model is capable of generating 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://drive.google.com/file/d/1cN-b9GnWtHzQRoE7M7gAEyivY0kl4BYs/view) for an in-depth discussion of the model limitations.# Training## Model- **Architecture:** GPT-2 model with multi-query attention and Fill-in-the-Middle objective- **Pretraining steps:** 50k- **Pretraining tokens:** 100 billion- **Precision:** bfloat16## Hardware- **GPUs:** 32 Tesla A100- **Training time:** 18 hours## Software- **Orchestration:** [Megatron-LM](https://github.com/bigcode-project/Megatron-LM)- **Neural networks:** [PyTorch](https://github.com/pytorch/pytorch)- **BP16 if applicable:** [apex](https://github.com/NVIDIA/apex)# LicenseThe 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).
README.md+64-3