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
splat fast path (geolip 0.6.1 @a2436e6): fused 2K forward via oriented_cat, cached mask, lazy den stats, chunk 256 — 1.7x eager / 4.0x under torch.compile at ctx 2048, parity 1e-6 vs the naive oracle, grad-parity verified
Browse files- address.py +11 -0
address.py
CHANGED
|
@@ -46,6 +46,17 @@ class AlephAddress(nn.Module):
|
|
| 46 |
Z = (ep + en).sum(dim=-1, keepdim=True)
|
| 47 |
return ep / Z, en / Z
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
def signed(self, x: torch.Tensor) -> torch.Tensor:
|
| 50 |
u = self._u(x)
|
| 51 |
m = u.abs().amax(dim=-1, keepdim=True)
|
|
|
|
| 46 |
Z = (ep + en).sum(dim=-1, keepdim=True)
|
| 47 |
return ep / Z, en / Z
|
| 48 |
|
| 49 |
+
def oriented_cat(self, x: torch.Tensor) -> torch.Tensor:
|
| 50 |
+
"""cat(ep, en)/Z along the last dim in ONE exp/normalize pass —
|
| 51 |
+
mathematically identical to torch.cat(self.oriented(x), -1); the
|
| 52 |
+
fused form exists because the hub's fast path runs its whole scan
|
| 53 |
+
at 2K width (speed-harness verified 1.5e-06 vs the naive oracle,
|
| 54 |
+
4.0x with torch.compile at ctx 2048)."""
|
| 55 |
+
u = self._u(x)
|
| 56 |
+
m = u.abs().amax(dim=-1, keepdim=True)
|
| 57 |
+
e = torch.exp(torch.cat([u - m, -u - m], dim=-1))
|
| 58 |
+
return e / e.sum(dim=-1, keepdim=True)
|
| 59 |
+
|
| 60 |
def signed(self, x: torch.Tensor) -> torch.Tensor:
|
| 61 |
u = self._u(x)
|
| 62 |
m = u.abs().amax(dim=-1, keepdim=True)
|