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/model/config.py from AjayRangoji/AR-4B-base: direct link, hf CLI and curl.
- Browser
- Download file 1.61 kB
-
https://huggingface.co/AjayRangoji/AR-4B-base/resolve/main/training_code/ar/model/config.py
- Command line
-
hf download hf://AjayRangoji/AR-4B-base/training_code/ar/model/config.py
-
curl -L -o config.py https://huggingface.co/AjayRangoji/AR-4B-base/resolve/main/training_code/ar/model/config.py
1.61 kB
| from dataclasses import dataclass | |
| class ARConfig: | |
| """All the numbers that define the AR model's shape. | |
| Swap these to build a different-sized model with the same code | |
| (e.g. a tiny version for debugging). | |
| """ | |
| vocab_size: int = 151936 # size of the tokenizer vocabulary | |
| dim: int = 2560 # hidden size (width of the residual stream) | |
| n_layers: int = 36 # number of decoder blocks stacked | |
| n_heads: int = 32 # query heads | |
| n_kv_heads: int = 8 # key/value heads (GQA: 32 queries share 8 kv) | |
| head_dim: int = 128 # size of each attention head | |
| hidden_dim: int = 9728 # inner width of the SwiGLU MLP | |
| max_seq_len: int = 40960 # longest sequence the model supports | |
| rope_theta: float = 1_000_000.0 # RoPE base frequency | |
| rms_norm_eps: float = 1e-6 # RMSNorm epsilon | |
| tie_embeddings: bool = True # share input embedding and output head weights | |
| # a very small variant for fast offline code testing (tiny numbers) | |
| def tiny_config() -> ARConfig: | |
| return ARConfig( | |
| vocab_size=1000, dim=128, n_layers=2, | |
| n_heads=4, n_kv_heads=2, head_dim=32, | |
| hidden_dim=512, max_seq_len=256, | |
| ) | |
| # a ~0.5B variant for validating the training loop on a single GPU | |
| # (same architecture shape as the full model, just narrower and shallower) | |
| def small_config() -> ARConfig: | |
| return ARConfig( | |
| vocab_size=151936, dim=1024, n_layers=24, | |
| n_heads=16, n_kv_heads=4, head_dim=128, # keeps the 4:1 GQA ratio | |
| hidden_dim=2816, max_seq_len=40960, | |
| ) |