Text Generation
Transformers
Safetensors
English
llama
small-language-model
slm
from-scratch
tiny
nexus-erebus
arithmetic
text-generation-inference
Instructions to use MaliosDark/Nexus-Erebus-3M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MaliosDark/Nexus-Erebus-3M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MaliosDark/Nexus-Erebus-3M", device_map="auto")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("MaliosDark/Nexus-Erebus-3M") model = AutoModelForCausalLM.from_pretrained("MaliosDark/Nexus-Erebus-3M", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MaliosDark/Nexus-Erebus-3M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MaliosDark/Nexus-Erebus-3M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MaliosDark/Nexus-Erebus-3M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/MaliosDark/Nexus-Erebus-3M
- SGLang
How to use MaliosDark/Nexus-Erebus-3M 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 "MaliosDark/Nexus-Erebus-3M" \ --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": "MaliosDark/Nexus-Erebus-3M", "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 "MaliosDark/Nexus-Erebus-3M" \ --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": "MaliosDark/Nexus-Erebus-3M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use MaliosDark/Nexus-Erebus-3M with Docker Model Runner:
docker model run hf.co/MaliosDark/Nexus-Erebus-3M
| """Self-contained ArithMark-2 verification for Nexus-Erebus models. | |
| Reproduces the reported ArithMark-2 score. No local files needed beyond this repo. | |
| The model ships a digit-atomic, least-significant-digit-first tokenizer, so it must | |
| be loaded with trust_remote_code=True. Text goes in and comes out in normal order; | |
| the digit reversal happens inside the tokenizer. | |
| pip install torch transformers datasets | |
| python benchmark_nexus_arithmark.py # uses this repo | |
| python benchmark_nexus_arithmark.py <model_id> | |
| """ | |
| import sys, ast, torch | |
| from datasets import load_dataset | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| MODEL = sys.argv[1] if len(sys.argv) > 1 else "." | |
| dev = "cuda" if torch.cuda.is_available() else "cpu" | |
| tok = AutoTokenizer.from_pretrained(MODEL, trust_remote_code=True) | |
| model = AutoModelForCausalLM.from_pretrained(MODEL, dtype=torch.bfloat16).to(dev).eval() | |
| ds = load_dataset("AxiomicLabs/ArithMark-2.0", split="train") | |
| def avg_logprob(ctx: str, ending: str) -> float: | |
| """Mean log-prob of `ending` conditioned on `ctx` (the leaderboard's scoring).""" | |
| ctx_ids = tok(ctx, return_tensors="pt").input_ids.to(dev) | |
| full_ids = tok(ctx + ending, return_tensors="pt").input_ids.to(dev) | |
| if full_ids.shape[1] <= ctx_ids.shape[1]: | |
| return -1e9 | |
| logits = model(full_ids).logits[:, :-1, :] | |
| logp = torch.log_softmax(logits, dim=-1) | |
| tgt = full_ids[:, 1:] | |
| sel = logp.gather(2, tgt.unsqueeze(-1)).squeeze(-1)[:, ctx_ids.shape[1] - 1:] | |
| return sel.mean().item() | |
| correct = 0 | |
| for i, e in enumerate(ds): | |
| endings = e["endings"] if isinstance(e["endings"], list) else ast.literal_eval(e["endings"]) | |
| scores = [avg_logprob(e["ctx"], end) for end in endings] | |
| if max(range(len(scores)), key=lambda j: scores[j]) == int(e["label"]): | |
| correct += 1 | |
| if (i + 1) % 500 == 0: | |
| print(f" {i+1}/{len(ds)} running acc: {correct/(i+1):.4f}", flush=True) | |
| print(f"\nArithMark-2 accuracy for {MODEL}: {correct/len(ds)*100:.2f}% ({correct}/{len(ds)})") | |