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)# pip install -U transformers accelerate # 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
mirror alephlm.py from geolip 0.7.0 @a63a29b (MIRROR law; n_const=1 bit-identical)
Browse files- alephlm.py +17 -1
alephlm.py
CHANGED
|
@@ -40,7 +40,8 @@ class Block(nn.Module):
|
|
| 40 |
self.n2 = nn.LayerNorm(d)
|
| 41 |
if self.is_hub:
|
| 42 |
self.attn = CausalSplatHUB(d, cfg.hub_K, cfg.hub_D, cfg.tau,
|
| 43 |
-
chunk=cfg.hub_chunk
|
|
|
|
| 44 |
else:
|
| 45 |
self.attn = CausalSDPA(d, cfg.n_heads)
|
| 46 |
self.bank = AnchoredBank(d, cfg.bank_experts, cfg.bank_ff, cfg.tau,
|
|
@@ -183,6 +184,21 @@ class AlephLM(nn.Module):
|
|
| 183 |
idx = torch.cat([idx, nxt], dim=1)
|
| 184 |
return idx
|
| 185 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
def param_count(self) -> int:
|
| 187 |
seen, total = set(), 0
|
| 188 |
for p in self.parameters():
|
|
|
|
| 40 |
self.n2 = nn.LayerNorm(d)
|
| 41 |
if self.is_hub:
|
| 42 |
self.attn = CausalSplatHUB(d, cfg.hub_K, cfg.hub_D, cfg.tau,
|
| 43 |
+
chunk=cfg.hub_chunk,
|
| 44 |
+
n_const=getattr(cfg, "hub_const", 1))
|
| 45 |
else:
|
| 46 |
self.attn = CausalSDPA(d, cfg.n_heads)
|
| 47 |
self.bank = AnchoredBank(d, cfg.bank_experts, cfg.bank_ff, cfg.tau,
|
|
|
|
| 184 |
idx = torch.cat([idx, nxt], dim=1)
|
| 185 |
return idx
|
| 186 |
|
| 187 |
+
def compile_hubs(self, **compile_kw):
|
| 188 |
+
"""Opt-in: torch.compile each hub's attention (measured 4.0x over
|
| 189 |
+
eager at ctx 2048 with the fused forward, parity 1.4e-06 vs the
|
| 190 |
+
naive oracle; MHA-parity wall-clock by ctx 8192). Call AFTER
|
| 191 |
+
loading weights, and do NOT save a checkpoint while compiled (the
|
| 192 |
+
OptimizedModule wrapper prefixes state_dict keys). TRAINING use is
|
| 193 |
+
gated on a grad-parity + throughput check on the training
|
| 194 |
+
hardware — the speed verdict was no-grad forward only."""
|
| 195 |
+
import torch as _torch
|
| 196 |
+
for wrap in self.blocks:
|
| 197 |
+
blk = getattr(wrap, "block", wrap)
|
| 198 |
+
if blk.is_hub:
|
| 199 |
+
blk.attn = _torch.compile(blk.attn, **compile_kw)
|
| 200 |
+
return self
|
| 201 |
+
|
| 202 |
def param_count(self) -> int:
|
| 203 |
seen, total = set(), 0
|
| 204 |
for p in self.parameters():
|