Instructions to use dcostenco/prism-coder-4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use dcostenco/prism-coder-4b with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="dcostenco/prism-coder-4b", filename="prism-coder-4b-v43-Q4_K_M.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use dcostenco/prism-coder-4b with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf dcostenco/prism-coder-4b:Q4_K_M # Run inference directly in the terminal: llama-cli -hf dcostenco/prism-coder-4b:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf dcostenco/prism-coder-4b:Q4_K_M # Run inference directly in the terminal: llama-cli -hf dcostenco/prism-coder-4b:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf dcostenco/prism-coder-4b:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf dcostenco/prism-coder-4b:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf dcostenco/prism-coder-4b:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf dcostenco/prism-coder-4b:Q4_K_M
Use Docker
docker model run hf.co/dcostenco/prism-coder-4b:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use dcostenco/prism-coder-4b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "dcostenco/prism-coder-4b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dcostenco/prism-coder-4b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/dcostenco/prism-coder-4b:Q4_K_M
- Ollama
How to use dcostenco/prism-coder-4b with Ollama:
ollama run hf.co/dcostenco/prism-coder-4b:Q4_K_M
- Unsloth Studio
How to use dcostenco/prism-coder-4b with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for dcostenco/prism-coder-4b to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for dcostenco/prism-coder-4b to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for dcostenco/prism-coder-4b to start chatting
- Pi
How to use dcostenco/prism-coder-4b with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf dcostenco/prism-coder-4b:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "dcostenco/prism-coder-4b:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use dcostenco/prism-coder-4b with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf dcostenco/prism-coder-4b:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default dcostenco/prism-coder-4b:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use dcostenco/prism-coder-4b with Docker Model Runner:
docker model run hf.co/dcostenco/prism-coder-4b:Q4_K_M
- Lemonade
How to use dcostenco/prism-coder-4b with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull dcostenco/prism-coder-4b:Q4_K_M
Run and chat with the model
lemonade run user.prism-coder-4b-Q4_K_M
List all available models
lemonade list
Add training/train_4b_v43_local.sh
Browse files
training/train_4b_v43_local.sh
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# train_4b_v43_local.sh β mlx_lm.lora SFT for Prism Coder 4B v43 on Apple Silicon
|
| 3 |
+
# Prereq: python3 build_4b_v43_corpus.py (creates /tmp/4b_v43_data/train.jsonl + valid.jsonl)
|
| 4 |
+
# v43.2 patch: resumed from 1400-iter checkpoint with surgical corpus patch
|
| 5 |
+
# (+2075 rows: param-precise, multi-turn chain, abstain, disambiguation)
|
| 6 |
+
set -euo pipefail
|
| 7 |
+
|
| 8 |
+
MODEL="Qwen/Qwen3-4B"
|
| 9 |
+
DATA_DIR="/tmp/4b_v43_data"
|
| 10 |
+
ADAPTER_DIR="/tmp/4b_v43_adapter"
|
| 11 |
+
LOG="/tmp/4b_v43_train.log"
|
| 12 |
+
|
| 13 |
+
# ββ Sanity checks ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 14 |
+
if [ ! -f "$DATA_DIR/train.jsonl" ]; then
|
| 15 |
+
echo "ERROR: $DATA_DIR/train.jsonl not found."
|
| 16 |
+
echo "Run: python3 build_4b_v43_corpus.py"
|
| 17 |
+
exit 1
|
| 18 |
+
fi
|
| 19 |
+
|
| 20 |
+
TRAIN_ROWS=$(wc -l < "$DATA_DIR/train.jsonl")
|
| 21 |
+
VALID_ROWS=$(wc -l < "$DATA_DIR/valid.jsonl")
|
| 22 |
+
echo "=== Prism Coder 4B v43 β Local MLX Training ==="
|
| 23 |
+
echo " Model: $MODEL"
|
| 24 |
+
echo " Train rows: $TRAIN_ROWS"
|
| 25 |
+
echo " Valid rows: $VALID_ROWS"
|
| 26 |
+
echo " Adapter out: $ADAPTER_DIR"
|
| 27 |
+
echo " Log: $LOG"
|
| 28 |
+
echo ""
|
| 29 |
+
|
| 30 |
+
# ββ Hyperparameters ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 31 |
+
# r=32, alpha=64 (scale=2.0), 16 LoRA layers, seq_len=2048
|
| 32 |
+
# Effective batch = batch_size(4) Γ grad_accumulation(4) = 16
|
| 33 |
+
# iters=2000 β 0.35 epochs over ~23k train rows
|
| 34 |
+
# LR 1e-4 cosine β same family as v36 1.7B (5e-6 was after warmup; 1e-4 with cosine suits 4B fresh run)
|
| 35 |
+
# val every 100 steps, save every 200 steps
|
| 36 |
+
# Est. time on M5 Max: 3-5h
|
| 37 |
+
|
| 38 |
+
mkdir -p "$ADAPTER_DIR"
|
| 39 |
+
|
| 40 |
+
mlx_lm.lora \
|
| 41 |
+
--model "$MODEL" \
|
| 42 |
+
--train \
|
| 43 |
+
--data "$DATA_DIR" \
|
| 44 |
+
--adapter-path "$ADAPTER_DIR" \
|
| 45 |
+
--resume-adapter-file "$ADAPTER_DIR/adapters.safetensors" \
|
| 46 |
+
--num-layers 16 \
|
| 47 |
+
--batch-size 2 \
|
| 48 |
+
--grad-checkpoint \
|
| 49 |
+
--iters 250 \
|
| 50 |
+
--val-batches 25 \
|
| 51 |
+
--learning-rate 3e-5 \
|
| 52 |
+
--steps-per-report 10 \
|
| 53 |
+
--steps-per-eval 100 \
|
| 54 |
+
--save-every 200 \
|
| 55 |
+
--max-seq-length 2048 \
|
| 56 |
+
--clear-cache-threshold 0.7 \
|
| 57 |
+
--seed 2027 \
|
| 58 |
+
2>&1 | tee -a "$LOG"
|
| 59 |
+
|
| 60 |
+
echo ""
|
| 61 |
+
echo "β
Training complete. Adapter at: $ADAPTER_DIR"
|
| 62 |
+
echo "Val loss should be checked in $LOG before merging."
|
| 63 |
+
echo ""
|
| 64 |
+
echo "Next: python3 merge_4b_v43.py (then re-eval: python3 bfcl_eval.py --model prism-coder:4b-v43)"
|