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/ar/train/train_config.py from AjayRangoji/AR-4B-base: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/AjayRangoji/AR-4B-base/resolve/main/training_code/ar/train/train_config.py
- Command line
-
hf download hf://AjayRangoji/AR-4B-base/training_code/ar/train/train_config.py
-
curl -L -o train_config.py https://huggingface.co/AjayRangoji/AR-4B-base/resolve/main/training_code/ar/train/train_config.py
1.12 kB
| from dataclasses import dataclass | |
| class TrainConfig: | |
| """Training hyperparameters (Qwen-style defaults for a ~4B model).""" | |
| # data | |
| seq_len: int = 4096 | |
| batch_size: int = 4 # sequences per step on one GPU (tune to fit memory) | |
| # optimizer (AdamW) | |
| peak_lr: float = 4e-4 | |
| min_lr: float = 4e-5 | |
| betas: tuple = (0.9, 0.95) | |
| weight_decay: float = 0.1 | |
| grad_clip: float = 1.0 | |
| grad_accum: int = 1 | |
| # learning-rate schedule | |
| warmup_steps: int = 2000 | |
| max_steps: int = 190_000 | |
| # # optimizer (AdamW) | |
| # peak_lr: float = 3e-4 | |
| # min_lr: float = 3e-5 | |
| # betas: tuple = (0.9, 0.95) # 0.95 is the LLM-pretraining convention | |
| # weight_decay: float = 0.1 | |
| # grad_clip: float = 1.0 | |
| # # learning-rate schedule | |
| # warmup_steps: int = 2000 | |
| # max_steps: int = 100_000 # total training steps (set per run) | |
| # logging / checkpointing | |
| log_every: int = 10 | |
| ckpt_every: int = 2000 | |
| ckpt_dir: str = "/fsx/ajay-stu/ar-data/checkpoints" | |
| lr_horizon: int = 186_000 # LR schedule spans this many steps |