Text Generation
Transformers
PyTorch
Safetensors
English
axiom
causal-lm
base-model
custom-architecture
tiktoken
custom_code
Instructions to use user-anto/Axiom-Dense-380M-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use user-anto/Axiom-Dense-380M-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="user-anto/Axiom-Dense-380M-Base", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("user-anto/Axiom-Dense-380M-Base", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use user-anto/Axiom-Dense-380M-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "user-anto/Axiom-Dense-380M-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "user-anto/Axiom-Dense-380M-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/user-anto/Axiom-Dense-380M-Base
- SGLang
How to use user-anto/Axiom-Dense-380M-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 "user-anto/Axiom-Dense-380M-Base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "user-anto/Axiom-Dense-380M-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "user-anto/Axiom-Dense-380M-Base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "user-anto/Axiom-Dense-380M-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use user-anto/Axiom-Dense-380M-Base with Docker Model Runner:
docker model run hf.co/user-anto/Axiom-Dense-380M-Base
| """ | |
| Thin wrapper around tiktoken's cl100k_base (GPT-4 BPE, 100k vocab). | |
| If you prefer a 32k vocab, swap to a trained SentencePiece/HF tokenizer. | |
| Remember to set ModelConfig.vocab_size to match. | |
| """ | |
| import tiktoken | |
| _ENC = None | |
| def get_tokenizer(): | |
| global _ENC | |
| if _ENC is None: | |
| base = tiktoken.get_encoding("cl100k_base") | |
| special = base._special_tokens.copy() | |
| # Patch unused dummy tokens for ChatML to avoid fragmentation | |
| special["<|im_start|>"] = 100264 | |
| special["<|im_end|>"] = 100265 | |
| _ENC = tiktoken.Encoding( | |
| name="chatml_cl100k", | |
| pat_str=base._pat_str, | |
| mergeable_ranks=base._mergeable_ranks, | |
| special_tokens=special | |
| ) | |
| return _ENC | |
| def encode(text: str, allowed_special: set | str = "all") -> list[int]: | |
| # Use encode instead of encode_ordinary to parse the patched special tokens | |
| return get_tokenizer().encode(text, allowed_special=allowed_special) | |
| def decode(ids: list[int]) -> str: | |
| return get_tokenizer().decode(ids) | |
| def get_eos_token_id() -> int: | |
| # cl100k_base exposes this as eot_token. | |
| return get_tokenizer().eot_token | |
| VOCAB_SIZE = get_tokenizer().n_vocab # 100277 | |