Instructions to use AjayRangoji/AR-4B-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AjayRangoji/AR-4B-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AjayRangoji/AR-4B-base", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("AjayRangoji/AR-4B-base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AjayRangoji/AR-4B-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AjayRangoji/AR-4B-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AjayRangoji/AR-4B-base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AjayRangoji/AR-4B-base
- SGLang
How to use AjayRangoji/AR-4B-base 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 "AjayRangoji/AR-4B-base" \ --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": "AjayRangoji/AR-4B-base", "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 "AjayRangoji/AR-4B-base" \ --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": "AjayRangoji/AR-4B-base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use AjayRangoji/AR-4B-base with Docker Model Runner:
docker model run hf.co/AjayRangoji/AR-4B-base
File size: 2,024 Bytes
df64241 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #!/bin/bash
# One-screen status: progress, speed, ETA, loss, checkpoints, disk, helper scripts.
cd /fsx/ajay-stu/AR
STOP=$(grep -oP '^STOP_AT=\K[0-9]+' run_args.sh)
J=$(squeue -u $USER -h -n ar-real -t RUNNING -o %i | head -1)
if [ -z "$J" ]; then
echo "NO training job running"; squeue -u $USER -o "%.8i %.8T %.4D %.10M %j"
else
NN=$(squeue -j $J -h -o %D)
L=$(grep "^step" logs/real_$J.log 2>/dev/null | tail -1)
if [ -z "$L" ]; then
echo "job $J on $NN nodes | starting up: loading checkpoint / compiling (first step in ~3-5 min)"
else
# tokens per step depend on node count (same table as the job script)
case $NN in 3|6) TPSTEP=393216;; 5) TPSTEP=327680;; 7) TPSTEP=458752;; *) TPSTEP=524288;; esac
S=$(echo "$L" | awk '{print $2}')
TPS=$(echo "$L" | awk '{gsub("k", "", $10); print $10 * 1000}')
SEC=$(awk -v l=$((STOP - S)) -v t=$TPSTEP -v r=$TPS 'BEGIN {printf "%d", (r > 0) ? l * t / r : 0}')
echo "job $J on $NN nodes | $L"
awk -v s=$S -v stop=$STOP -v sec=$SEC 'BEGIN {
printf "progress: %d / %d (%.1f%%) left: %d steps, ~%.1f days\n", s, stop, 100*s/stop, stop-s, sec/86400 }'
echo "finish ETA: $(date -u -d "+$SEC sec" '+%a %d %b %H:%M UTC') ($(TZ=Asia/Kolkata date -d "+$SEC sec" '+%H:%M IST'))"
grep "^step" logs/real_$J.log | tail -100 | awk '{s+=$5} END {printf "avg loss (last 100 prints): %.3f\n", s/NR}'
fi
echo "last checkpoint: $(grep -E '^\[ckpt\]' logs/real_$J.log 2>/dev/null | tail -1)"
fi
# disk now, lowest in the last 24 h, and helper scripts
echo "disk now: $(tail -1 logs/disk.log)"
echo "lowest 24h: $(grep free= logs/disk.log | tail -288 | sort -t= -k2 -n | head -1)"
pgrep -f watchdog.sh >/dev/null && echo "watchdog: running" || echo "watchdog: NOT running"
pgrep -f diskwatch.sh >/dev/null && echo "diskwatch: running" || echo "diskwatch: NOT running"
pgrep -f autoreload.sh >/dev/null && echo "autoreload: running" || echo "autoreload: NOT running"
echo "tokenizing jobs: $(squeue -u $USER -h -n ar-tok | wc -l)"
|