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
Download training_code/sanity_4node.sbatch from AjayRangoji/AR-4B-base: direct link, hf CLI and curl.
- Browser
- Download file 1.31 kB
-
https://huggingface.co/AjayRangoji/AR-4B-base/resolve/main/training_code/sanity_4node.sbatch
- Command line
-
hf download hf://AjayRangoji/AR-4B-base/training_code/sanity_4node.sbatch
-
curl -L -o sanity_4node.sbatch https://huggingface.co/AjayRangoji/AR-4B-base/resolve/main/training_code/sanity_4node.sbatch
1.31 kB
| #!/bin/bash | |
| #SBATCH --job-name=ar-sanity-4node | |
| #SBATCH --partition=dev | |
| #SBATCH --nodes=4 | |
| #SBATCH --nodelist=ip-10-0-154-148,ip-10-0-184-219,ip-10-0-233-76,ip-10-0-245-227 | |
| #SBATCH --ntasks-per-node=1 | |
| #SBATCH --gres=gpu:8 | |
| #SBATCH --cpus-per-task=96 | |
| #SBATCH --exclusive | |
| #SBATCH --output=sanity_4node_%j.log | |
| set -euo pipefail | |
| cd /fsx/ajay-stu/AR | |
| source .venv/bin/activate | |
| export MASTER_ADDR=$(scontrol show hostnames "$SLURM_JOB_NODELIST" | head -n1) | |
| export MASTER_PORT=29517 | |
| export FI_PROVIDER=efa | |
| export NCCL_PROTO=simple | |
| export NCCL_DEBUG=INFO | |
| export NCCL_SOCKET_IFNAME=enp73s0 | |
| export NCCL_IB_DISABLE=0 | |
| export FI_EFA_USE_DEVICE_RDMA=1 | |
| export LD_LIBRARY_PATH=/fsx/ajay-stu/AR/.venv/lib/python3.10/site-packages/nvidia/cudnn/lib:$LD_LIBRARY_PATH | |
| export LD_LIBRARY_PATH=/fsx/ajay-stu/AR/.venv/lib/python3.10/site-packages/nvidia/cudnn/lib:$LD_LIBRARY_PATH | |
| echo "MASTER_ADDR=$MASTER_ADDR NODES=$SLURM_NNODES job=$SLURM_JOB_ID" | |
| srun bash -c ' | |
| torchrun \ | |
| --nnodes=4 \ | |
| --nproc_per_node=8 \ | |
| --node_rank=$SLURM_NODEID \ | |
| --rdzv_id=$SLURM_JOB_ID \ | |
| --rdzv_backend=c10d \ | |
| --rdzv_endpoint=$MASTER_ADDR:$MASTER_PORT \ | |
| -m ar.train.train_fsdp \ | |
| --bin /fsx/ajay-stu/ar-data/bin/fineweb.bin \ | |
| --model_size full \ | |
| --max_steps 20 \ | |
| --batch_size 1 \ | |
| --seq_len 2048 \ | |
| --warmup_steps 5 | |
| ' | |