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,299 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 | #!/bin/bash
# Waits for the final Stage 1 checkpoint (ckpt_571999), then:
# 1) keeps it forever as a hard-link copy (no extra disk space; survives deletion of the original)
# 2) exports a weights-only bf16 file (~8 GB) for downloading to a PC, plus its md5 fingerprint
# Warns and stops if training gets past step 572,100 without that checkpoint (e.g. disk was full).
# Run once on the login node: nohup ./save_stage1.sh > logs/save_stage1.log 2>&1 &
set -uo pipefail
AR=${AR:-/fsx/ajay-stu/AR}
CKDIR=${CKDIR:-/fsx/ajay-stu/ar-data/checkpoints}
OUT=${OUT:-/fsx/ajay-stu/ar-data/stage1_final}
NAME=ckpt_571999
EXC="ip-10-0-136-14,ip-10-0-136-94,ip-10-0-136-253,ip-10-0-138-178,ip-10-0-139-113,ip-10-0-140-247"
cd "$AR" || exit 1
[ -f .venv/bin/activate ] && source .venv/bin/activate
export PYTHONPATH=$PWD
# latest training step from the running job's log (0 if unknown)
latest_step() {
local j
j=$(squeue -u "${USER:-$(id -un)}" -h -n ar-real -t RUNNING -o %i 2>/dev/null | head -1)
[ -n "$j" ] && grep "^step" "logs/real_$j.log" 2>/dev/null | tail -1 | awk '{print $2}' || true
}
# 1) wait until the checkpoint is completely written (.metadata is written last)
echo "$(date -u) waiting for $CKDIR/$NAME"
until [ -f "$CKDIR/$NAME/.metadata" ]; do
s=$(latest_step)
if [ "${s:-0}" -gt 572100 ]; then
echo "$(date -u) WARNING: training is at step $s but $NAME was never saved (disk full at step 571,999?)"
exit 1
fi
sleep "${POLL:-300}"
done
sleep "${SETTLE:-60}" # let the last file writes settle
echo "$(date -u) found complete $NAME"
# 2) permanent hard-link copy
mkdir -p "$OUT"
[ -d "$OUT/$NAME" ] || cp -al "$CKDIR/$NAME" "$OUT/$NAME" || { echo "hard-link copy failed"; exit 1; }
echo "$(date -u) permanent copy: $OUT/$NAME ($(ls "$OUT/$NAME" | wc -l) files)"
# 3) weights-only bf16 export for the PC (CPU job, ~5 min) and its fingerprint
M=$OUT/model_stage1_final.pt
if [ ! -f "$M" ]; then
srun -p dev -N1 -n1 --gpus=0 --cpus-per-task=16 --exclude=$EXC \
python -m ar.eval.export_ckpt --ckpt "$OUT/$NAME" --out "$M" || { echo "export failed"; exit 1; }
fi
( cd "$OUT" && md5sum model_stage1_final.pt > model_stage1_final.md5 )
ls -lh "$M"
cat "$OUT/model_stage1_final.md5"
echo "$(date -u) DONE: Stage 1 final model saved"
|