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,711 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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | #!/bin/bash
# One-time switch to the new loop job + Stage 1 extension to 200B tokens.
cd /fsx/ajay-stu/AR
source .venv/bin/activate
# 1) wait for the 4 tokenizing jobs, then check the files
while [ -n "$(squeue -u $USER -h -n ar-tok)" ]; do sleep 300; done
for g in 003 004 005 006; do
[ -s /fsx/ajay-stu/ar-data/bin/fw$g/fineweb.bin ] || { echo "$(date) fw$g missing, aborting"; exit 1; }
done
echo "$(date) new data ready"
# 2) new settings: 200B tokens (end step 381,000) + new data mix
python - << 'PY'
import glob, os
d = "/fsx/ajay-stu/ar-data/bin/"
eng = [d + "fineweb.bin"] + sorted(glob.glob(d + "fw*/fineweb.bin"))
code = [f"{d}stack_{l}.bin" for l in
["python", "javascript", "java", "cpp", "typescript", "go", "rust", "shell", "sql"]]
math = [d + "finemath.bin", d + "finemath3.bin"]
def split(files, share):
s = [os.path.getsize(f) for f in files]
return [round(share * x / sum(s), 4) for x in s]
files = eng + code + math
w = split(eng, 0.65) + split(code, 0.20) + [0.09, 0.06]
out = []
for l in open("run_args.sh").read().splitlines():
if l.startswith("BIN="): l = 'BIN="' + " ".join(files) + '"'
elif l.startswith("WEIGHTS="): l = 'WEIGHTS="' + " ".join(map(str, w)) + '"'
elif l.startswith("STOP_AT="): l = "STOP_AT=381000"
elif l.startswith("LR_HORIZON="): l = "LR_HORIZON=381000"
out.append(l)
open("run_args.sh", "w").write("\n".join(out) + "\n")
print("settings updated:", len(files), "files, stop at 381000")
PY
sed -i 's/ckpt_185999/ckpt_380999/' watchdog.sh # watchdog's new "finished" marker
# 3) pause the watchdog so it can't launch a duplicate during the switch
pkill -f watchdog.sh
J=$(squeue -u $USER -h -n ar-real -o %i | head -1)
if [ -z "$J" ]; then
echo "$(date) training not running; watchdog will start the new job"
nohup ./watchdog.sh >> logs/watchdog.log 2>&1 &
exit 0
fi
NODES=$(squeue -j $J -h -o %N)
# 4) after a checkpoint, switch only if no waiting job could take our nodes (max ~6 tries)
tries=0
while true; do
N=$(grep -c "\[ckpt\] saved" logs/real_$J.log)
while [ "$(grep -c "\[ckpt\] saved" logs/real_$J.log)" -eq "$N" ]; do
[ -z "$(squeue -j $J -h 2>/dev/null)" ] && break 2 # old job died meanwhile
sleep 30
done
tries=$((tries + 1))
risky=$(squeue -p dev -t PD -h -o "%u %D" | awk -v me=$USER '$1 != me && $2 <= 4' | wc -l)
if [ "$risky" -eq 0 ] || [ $tries -ge 6 ]; then break; fi
echo "$(date) $risky waiting jobs could take our nodes; trying at the next checkpoint"
done
sleep 30
scancel $J 2>/dev/null
sleep 20
sbatch --nodelist=$NODES train_real.sbatch
echo "$(date) switched: old job $J stopped, new loop job submitted on $NODES"
nohup ./watchdog.sh >> logs/watchdog.log 2>&1 &
|