Text Generation
Transformers
Safetensors
qwen2
Generated from Trainer
trl
sft
trackio
conversational
text-generation-inference
Instructions to use finnvoorhees/tiny-coder-prompt-completion-0.5B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use finnvoorhees/tiny-coder-prompt-completion-0.5B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="finnvoorhees/tiny-coder-prompt-completion-0.5B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("finnvoorhees/tiny-coder-prompt-completion-0.5B") model = AutoModelForCausalLM.from_pretrained("finnvoorhees/tiny-coder-prompt-completion-0.5B") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use finnvoorhees/tiny-coder-prompt-completion-0.5B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "finnvoorhees/tiny-coder-prompt-completion-0.5B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "finnvoorhees/tiny-coder-prompt-completion-0.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/finnvoorhees/tiny-coder-prompt-completion-0.5B
- SGLang
How to use finnvoorhees/tiny-coder-prompt-completion-0.5B 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 "finnvoorhees/tiny-coder-prompt-completion-0.5B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "finnvoorhees/tiny-coder-prompt-completion-0.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "finnvoorhees/tiny-coder-prompt-completion-0.5B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "finnvoorhees/tiny-coder-prompt-completion-0.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use finnvoorhees/tiny-coder-prompt-completion-0.5B with Docker Model Runner:
docker model run hf.co/finnvoorhees/tiny-coder-prompt-completion-0.5B
Upload README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Tiny Coder Prompt Completion 0.5B
|
| 2 |
+
|
| 3 |
+
A tiny model (~494M parameters, ~942MB weights) for **prompt autocomplete** in agentic coding editors like Claude Code, Codex CLI, aider, etc.
|
| 4 |
+
|
| 5 |
+
## What it does
|
| 6 |
+
|
| 7 |
+
When you're typing a prompt to an AI coding agent, this model suggests how to **complete your thought**. For example:
|
| 8 |
+
|
| 9 |
+
- `fix the bug in src/utils` → `.py where the auth token isn't refreshing`
|
| 10 |
+
- `refactor the database` → `connection logic to use connection pooling`
|
| 11 |
+
- `implement caching for the` → `user profile endpoint using Redis with a 5-minute TTL`
|
| 12 |
+
|
| 13 |
+
## Base Model
|
| 14 |
+
|
| 15 |
+
This is a fine-tuned version of [Qwen2.5-Coder-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-0.5B-Instruct), which was purpose-built for code completion.
|
| 16 |
+
|
| 17 |
+
## On-Device Requirements
|
| 18 |
+
|
| 19 |
+
- **RAM**: ~1GB for fp16 inference (easily fits in 16GB MacBooks)
|
| 20 |
+
- **Disk**: ~1GB for model weights
|
| 21 |
+
- **CPU/GPU**: Works great on CPU (M1/M2/M3 MacBooks), even better with GPU
|
| 22 |
+
|
| 23 |
+
## Quick Start
|
| 24 |
+
|
| 25 |
+
### Python (transformers)
|
| 26 |
+
|
| 27 |
+
```python
|
| 28 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 29 |
+
import torch
|
| 30 |
+
|
| 31 |
+
model_id = "finnvoorhees/tiny-coder-prompt-completion-0.5B"
|
| 32 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
| 33 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 34 |
+
model_id,
|
| 35 |
+
trust_remote_code=True,
|
| 36 |
+
torch_dtype=torch.bfloat16,
|
| 37 |
+
device_map="auto",
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
def complete_prompt(prompt: str) -> str:
|
| 41 |
+
messages = [
|
| 42 |
+
{"role": "system", "content": "You are a helpful coding assistant. Complete the user's partial prompt concisely."},
|
| 43 |
+
{"role": "user", "content": prompt},
|
| 44 |
+
]
|
| 45 |
+
inputs = tokenizer.apply_chat_template(
|
| 46 |
+
messages,
|
| 47 |
+
tokenize=True,
|
| 48 |
+
return_tensors="pt",
|
| 49 |
+
return_dict=True,
|
| 50 |
+
add_generation_prompt=True,
|
| 51 |
+
).to(model.device)
|
| 52 |
+
|
| 53 |
+
outputs = model.generate(
|
| 54 |
+
**inputs,
|
| 55 |
+
max_new_tokens=32,
|
| 56 |
+
temperature=0.3,
|
| 57 |
+
top_p=0.9,
|
| 58 |
+
do_sample=True,
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
new_tokens = outputs[0][inputs["input_ids"].shape[1]:]
|
| 62 |
+
return tokenizer.decode(new_tokens, skip_special_tokens=True).strip()
|
| 63 |
+
|
| 64 |
+
print(complete_prompt("refactor the database"))
|
| 65 |
+
# → "connection logic to use connection pooling instead of creating new connections each time"
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
### Even smaller: GGUF / llama.cpp
|
| 69 |
+
|
| 70 |
+
For ultra-fast CPU inference, convert to GGUF (Q4_K_M quantization → ~300MB):
|
| 71 |
+
|
| 72 |
+
```bash
|
| 73 |
+
# Install llama.cpp
|
| 74 |
+
brew install llama.cpp
|
| 75 |
+
|
| 76 |
+
# Convert to GGUF (or download from the GGUF tag on this repo)
|
| 77 |
+
python convert_hf_to_gguf.py finnvoorhees/tiny-coder-prompt-completion-0.5B --outfile tiny-coder-0.5b-Q4_K_M.gguf
|
| 78 |
+
|
| 79 |
+
# Run inference
|
| 80 |
+
llama-cli -m tiny-coder-0.5b-Q4_K_M.gguf -p "fix the bug in src/utils"
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
## Integration with Agentic Editors
|
| 84 |
+
|
| 85 |
+
### Claude Code
|
| 86 |
+
Create a shell script that calls this model and pipe completions into your prompt:
|
| 87 |
+
|
| 88 |
+
```bash
|
| 89 |
+
# ~/.claude-complete.sh
|
| 90 |
+
python -c "from transformers import pipeline; print(pipeline('text-generation', model='finnvoorhees/tiny-coder-prompt-completion-0.5B')('$1'))"
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
### Codex CLI / aider
|
| 94 |
+
Set up a local API endpoint using `transformers` or `llama.cpp` server mode:
|
| 95 |
+
|
| 96 |
+
```bash
|
| 97 |
+
# llama.cpp server (fast!)
|
| 98 |
+
llama-server -m tiny-coder-0.5b-Q4_K_M.gguf --port 8080
|
| 99 |
+
|
| 100 |
+
# Then use http://localhost:8080/v1/completions in your editor
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
## License
|
| 104 |
+
|
| 105 |
+
Apache-2.0 (same as the base Qwen2.5-Coder-0.5B-Instruct model)
|