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,440 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 | #!/bin/bash
# Export the newest COMPLETE checkpoint, then run all evals on one GPU of a FULLY FREE node.
# (On this cluster "1 GPU anywhere" often lands on GPUs someone else is already using.)
# Run: nohup ./eval_latest.sh > logs/eval_$(date +%m%d_%H%M).log 2>&1 &
# Optional: MODEL=<existing export .pt> to skip the export step
set -uo pipefail
cd /fsx/ajay-stu/AR
source .venv/bin/activate
export PYTHONPATH=$PWD:${PYTHONPATH:-}
export HF_DATASETS_OFFLINE=1 # benchmarks are already saved; some nodes have no internet
C=/fsx/ajay-stu/ar-data/checkpoints
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"
SKIP=$( { echo $EXC | tr ',' '\n'; cat logs/bad_nodes.txt logs/bad_nodes_perm.txt 2>/dev/null; } | sort -u )
# 1) which model: the given export, or the newest complete checkpoint (exported once)
if [ -n "${MODEL:-}" ]; then
M=$MODEL
else
CK=$(for d in $C/ckpt_*; do if [ -f $d/.metadata ]; then echo $d; fi; done | sort -t_ -k2 -n | tail -1)
M=/fsx/ajay-stu/ar-data/eval/model_$(basename $CK).pt
mkdir -p /fsx/ajay-stu/ar-data/eval
[ -f $M ] || srun -p dev -N1 -n1 --gpus=0 --cpus-per-task=16 --exclude=$EXC \
python -m ar.eval.export_ckpt --ckpt $CK --out $M || { echo "export failed"; exit 1; }
fi
ls -lh $M || exit 1
echo "=== evaluating $(basename $M) $(date -u) ==="
# 2) candidates: Slurm-idle nodes with all 8 GPUs empty, minus colleague and bad nodes
CANDS=$(./find_nodes.sh | grep -vxF -f <(echo "$SKIP") | head -10)
[ -z "$CANDS" ] && { echo "no fully free node right now, try again later"; exit 1; }
echo "candidate nodes: $(echo $CANDS)"
# 3) try them one by one until we get a GPU that is really free
rc=1
for NODE in $CANDS; do
srun -p dev -N1 -n1 -w $NODE --gpus=1 --cpus-per-task=8 --immediate=120 bash -c '
used=$(nvidia-smi -i ${CUDA_VISIBLE_DEVICES:-0} --query-gpu=memory.used --format=csv,noheader,nounits)
if [ "$used" -ge 2000 ]; then echo "GPU already in use ($used MiB) on $(hostname), trying the next node"; exit 3; fi
echo "=== on $(hostname), GPU ${CUDA_VISIBLE_DEVICES:-0} ==="
python -m ar.eval.val_loss --model '"$M"' --data /fsx/ajay-stu/ar-data/heldout/stack_python.bin /fsx/ajay-stu/ar-data/heldout/fineweb.bin
python -m ar.eval.humaneval --model '"$M"' | tail -1
python -m ar.eval.gsm8k --model '"$M"' | tail -1
'
rc=$?
[ $rc -eq 0 ] && break
done
echo "=== done (exit $rc) $(date -u) ==="
|