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: 1,907 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 | #!/bin/bash
# Test the given nodes in parallel, pick the 8 best for training, list the rest to hand over.
# Usage: ./testnodes.sh ip-a,ip-b,... (about 1-2 minutes)
cd /fsx/ajay-stu/AR
NODES=$(echo "$1" | tr ',' ' ')
COLLEAGUE="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"
OUT=logs/nodetest; rm -rf $OUT; mkdir -p $OUT
# 1) one short whole-node job per node, all at once; give up on a node Slurm can't give within 60 s
for n in $NODES; do
srun -p dev -N1 -n1 -w $n --exclusive --gres=gpu:8 --immediate=60 --time=5 \
bash /fsx/ajay-stu/AR/nodecheck.sh > $OUT/$n.txt 2> $OUT/$n.err &
done
wait
# 2) table and verdict per node
printf "%-17s %4s %7s %6s %5s %6s %6s %6s %s\n" node gpus gpuMiB ramGB swap load users fsxMB verdict
for n in $NODES; do
unset h g gu ram sw ld us mb
read h g gu ram sw ld us mb < <(cat $OUT/$n.txt 2>/dev/null)
if [ -z "$h" ]; then v="NOT AVAILABLE in Slurm"
elif echo " $COLLEAGUE " | grep -q " $n "; then v="colleague node"
elif grep -qx "$n" logs/bad_nodes_perm.txt 2>/dev/null; then v="known bad"
elif [ "$g" -ne 8 ] || [ "$gu" -ge 2000 ] || [ "$ram" -lt 1500 ] || [ "$mb" -lt 100 ] \
|| awk -v l="$ld" 'BEGIN {exit !(l > 16)}'; then v="BAD"
else v="ok"; echo "$us $ld $n" >> $OUT/ok.txt; fi
printf "%-17s %4s %7s %6s %5s %6s %6s %6s %s\n" $n "${g:--}" "${gu:--}" "${ram:--}" "${sw:--}" "${ld:--}" "${us:--}" "${mb:--}" "$v"
done
# 3) best 8 ok nodes (fewest other users, then lowest load); everything else is handed over
PICK=$(sort -k1,1n -k2,2g $OUT/ok.txt 2>/dev/null | head -8 | awk '{print $3}')
echo "$PICK" | grep . > logs/picked_nodes.txt
REST=$(for n in $NODES; do grep -qx $n logs/picked_nodes.txt || echo $n; done)
echo
echo "USE for training ($(echo "$PICK" | grep -c .)): $(echo $PICK | tr ' ' ',')"
echo "GIVE AWAY ($(echo "$REST" | grep -c .)): $(echo $REST | tr ' ' ',')"
|