Text Generation
Transformers
Safetensors
spark2_5
spark
spark-x2.6-4b
recursive-transformer
loop72
mhc
d-lsa
long-context
conversational
custom_code
Instructions to use TassP0lar/Spark-X2.6-4B-Recursive72 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TassP0lar/Spark-X2.6-4B-Recursive72 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TassP0lar/Spark-X2.6-4B-Recursive72", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("TassP0lar/Spark-X2.6-4B-Recursive72", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TassP0lar/Spark-X2.6-4B-Recursive72 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TassP0lar/Spark-X2.6-4B-Recursive72" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TassP0lar/Spark-X2.6-4B-Recursive72", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/TassP0lar/Spark-X2.6-4B-Recursive72
- SGLang
How to use TassP0lar/Spark-X2.6-4B-Recursive72 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 "TassP0lar/Spark-X2.6-4B-Recursive72" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TassP0lar/Spark-X2.6-4B-Recursive72", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "TassP0lar/Spark-X2.6-4B-Recursive72" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TassP0lar/Spark-X2.6-4B-Recursive72", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use TassP0lar/Spark-X2.6-4B-Recursive72 with Docker Model Runner:
docker model run hf.co/TassP0lar/Spark-X2.6-4B-Recursive72
Spark X2.6 4B Recursive72
Spark X2.6 4B Recursive72 (TassP0lar/Spark-X2.6-4B-Recursive72) is the 72-visit recurrent-depth (Loop72) + per-visit Paged Latent Sparse Attention (D-LSA) model built strictly atop the frozen BF16 XHToken/Spark-X2.6-4B (revision=64ca8f2a295b8ceb2757b9d4749a6558c4759e5b) 36-layer hybrid backbone.
Architecture Summary
- Base Backbone:
XHToken/Spark-X2.6-4B(36 physical layers = 9 full-attention + 27 sliding-window layers, native GELU, frozen BF16). - 72-Visit Recurrent Schedule (
4 + 24 + 24 + 12 + 8 = 72):- Prelude
L0..L3(1 pass = 4 visits) - Core Pass 1
L4..L27(24 visits) - Core Pass 2
L4..L27(24 visits) - Inner Pass 3
L12..L23(12 visits) - Coda
L28..L35(1 pass = 8 visits)
- Prelude
- Differentiable
TwoStreamMHCControllers (10,078,176params):- Bounded-gain Schema v2 (
gain_mode='sigmoid',mhc_schema_version=2), guaranteeing $(1 - g)I + gP \in \mathcal{B}_2$ across all 60 core visits. - Mean Pass-2 Gain (Attn/FFN):
0.009997/0.010014 - Mean Pass-3 Gain (Attn/FFN):
0.004999/0.005004
- Bounded-gain Schema v2 (
- 18-Visit
VisitAwareDLSAIndexBank:- Per-visit
(W_k, W_q)$\mathbb{S}^{63}$ projections distilled on the trainedlearned_mhcresidual stream. - Locked
mhc_checkpoint_sha256:7cad7ffc33e7962f445a037f8dddb42b5250da30d1782c8f76c4138c42057456
- Per-visit
Quickstart
import torch
from load_inference_v03 import load_sparkx_loop72_lsa
model, tokenizer = load_sparkx_loop72_lsa(
repo_or_dir='TassP0lar/Spark-X2.6-4B-Recursive72',
base_repo='XHToken/Spark-X2.6-4B',
revision='64ca8f2a295b8ceb2757b9d4749a6558c4759e5b',
recurrence_mode='learned_mhc',
attach_sparse_attention=True,
)
model.eval()
print(model.execution_manifest())
- Downloads last month
- 502