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/sweep_lr.sbatch from AjayRangoji/AR-4B-base: direct link, hf CLI and curl.
- Browser
- Download file 1.79 kB
-
https://huggingface.co/AjayRangoji/AR-4B-base/resolve/main/training_code/sweep_lr.sbatch
- Command line
-
hf download hf://AjayRangoji/AR-4B-base/training_code/sweep_lr.sbatch
-
curl -L -o sweep_lr.sbatch https://huggingface.co/AjayRangoji/AR-4B-base/resolve/main/training_code/sweep_lr.sbatch
1.79 kB
| #!/bin/bash | |
| #SBATCH --job-name=ar-lrsweep | |
| #SBATCH --partition=dev | |
| #SBATCH --nodes=2 | |
| #SBATCH --ntasks-per-node=1 | |
| #SBATCH --gpus-per-node=8 | |
| #SBATCH --cpus-per-task=96 | |
| #SBATCH --output=logs/lrsweep_%x_%j.out | |
| #SBATCH --error=logs/lrsweep_%x_%j.err | |
| # --nodelist is set from the command line via --export; see the launch commands below | |
| set -euo pipefail | |
| # --- env --- | |
| cd /fsx/ajay-stu/AR | |
| source .venv/bin/activate | |
| export PYTHONPATH=$PWD:${PYTHONPATH:-} | |
| export MASTER_ADDR=$(scontrol show hostnames "$SLURM_JOB_NODELIST" | head -1) | |
| export MASTER_PORT=$((29500 + SLURM_JOB_ID % 1000)) | |
| export NCCL_SOCKET_IFNAME=enp73s0 | |
| export FI_PROVIDER=efa | |
| export LD_LIBRARY_PATH=$PWD/.venv/lib/python*/site-packages/nvidia/cudnn/lib:$LD_LIBRARY_PATH | |
| export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True | |
| export TOKENIZERS_PARALLELISM=false | |
| # --- knobs the sweep varies --- | |
| # PEAK_LR must be passed in from the command line via --export | |
| : "${PEAK_LR:?PEAK_LR must be set, e.g. --export=ALL,PEAK_LR=5e-4}" | |
| # --- knobs held constant across the sweep --- | |
| BIN_DIR=/fsx/ajay-stu/ar-data/bin-val | |
| BATCH=4 | |
| SEQ=4096 | |
| STEPS=2000 | |
| WARMUP=200 | |
| echo "=== sweep run: PEAK_LR=$PEAK_LR batch=$BATCH seq=$SEQ steps=$STEPS ===" | |
| srun --cpu-bind=none bash -c ' | |
| export RANK=$SLURM_PROCID | |
| export LOCAL_RANK=$SLURM_LOCALID | |
| export WORLD_SIZE=$SLURM_NTASKS | |
| torchrun \ | |
| --nnodes=$SLURM_NNODES \ | |
| --nproc_per_node=8 \ | |
| --rdzv_backend=c10d \ | |
| --rdzv_endpoint=$MASTER_ADDR:$MASTER_PORT \ | |
| ar/train/train_fsdp.py \ | |
| --bin '"$BIN_DIR"'/fineweb.bin '"$BIN_DIR"'/stack.bin '"$BIN_DIR"'/finemath.bin \ | |
| --weights 0.65 0.20 0.15 \ | |
| --batch_size '"$BATCH"' \ | |
| --seq_len '"$SEQ"' \ | |
| --max_steps '"$STEPS"' \ | |
| --warmup_steps '"$WARMUP"' \ | |
| --peak_lr '"$PEAK_LR"' \ | |
| --model_size full | |
| ' |