Text Generation
Transformers
Safetensors
mini-beatrix
byte-level
tokenizer-free
aleph
signed-address
custom_code
Instructions to use AbstractPhil/mini-beatrix-1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AbstractPhil/mini-beatrix-1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AbstractPhil/mini-beatrix-1", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("AbstractPhil/mini-beatrix-1", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AbstractPhil/mini-beatrix-1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AbstractPhil/mini-beatrix-1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AbstractPhil/mini-beatrix-1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/AbstractPhil/mini-beatrix-1
- SGLang
How to use AbstractPhil/mini-beatrix-1 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 "AbstractPhil/mini-beatrix-1" \ --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": "AbstractPhil/mini-beatrix-1", "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 "AbstractPhil/mini-beatrix-1" \ --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": "AbstractPhil/mini-beatrix-1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use AbstractPhil/mini-beatrix-1 with Docker Model Runner:
docker model run hf.co/AbstractPhil/mini-beatrix-1
mini-beatrix-1 pre-classroom annealment point: AutoModel-compatible (trust_remote_code), surgered 58,664 weights (head gate folded, semantic no-op), config from manifest, parity 0.00e+00 vs native stack, generate() verified
b007aec verified | """Embeddings. | |
| TrigramByteEmbedding — the validated composed byte embedding: | |
| e_t = E0[x_t] + E1[x_{t-1}] + E2[x_{t-2}] + P[t] | |
| with the PAD LAW built in permanently: the shift tables carry a dedicated | |
| pad row (index 256). Padding trigram shifts with a legal byte conflates | |
| real history with sequence starts and starves address consumption | |
| (measured +.05..+.11 on repair) — the fix ships on, not opt-in. | |
| TokenEmbedding — plain table + positions for BPE crafts. | |
| """ | |
| from __future__ import annotations | |
| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| BYTE_VOCAB = 256 | |
| PAD_ROW = 256 # dedicated pad index in the shift tables (size 257) | |
| class TrigramByteEmbedding(nn.Module): | |
| def __init__(self, d: int, context: int): | |
| super().__init__() | |
| self.emb0 = nn.Embedding(BYTE_VOCAB, d) | |
| self.emb1 = nn.Embedding(BYTE_VOCAB + 1, d) # + pad row | |
| self.emb2 = nn.Embedding(BYTE_VOCAB + 1, d) | |
| self.pos = nn.Parameter(0.01 * torch.randn(1, context, d)) | |
| def forward(self, idx): | |
| x = self.emb0(idx) \ | |
| + self.emb1(F.pad(idx, (1, 0), value=PAD_ROW)[:, :-1]) \ | |
| + self.emb2(F.pad(idx, (2, 0), value=PAD_ROW)[:, :-2]) | |
| return x + self.pos[:, : idx.shape[1]] | |
| class TokenEmbedding(nn.Module): | |
| def __init__(self, vocab: int, d: int, context: int): | |
| super().__init__() | |
| self.emb = nn.Embedding(vocab, d) | |
| self.pos = nn.Parameter(0.01 * torch.randn(1, context, d)) | |
| def forward(self, idx): | |
| return self.emb(idx) + self.pos[:, : idx.shape[1]] | |