Image-Text-to-Text
Transformers
Safetensors
kimi_k31
text-generation
mixture-of-experts
expert-upcycling
scientific-ai
chip-design
space
physics
s-t-a-r
custom_code
8-bit precision
Instructions to use STAR-future/Trinity with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use STAR-future/Trinity with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="STAR-future/Trinity", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForSeq2SeqLM model = AutoModelForSeq2SeqLM.from_pretrained("STAR-future/Trinity", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use STAR-future/Trinity with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "STAR-future/Trinity" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "STAR-future/Trinity", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/STAR-future/Trinity
- SGLang
How to use STAR-future/Trinity 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 "STAR-future/Trinity" \ --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": "STAR-future/Trinity", "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 "STAR-future/Trinity" \ --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": "STAR-future/Trinity", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use STAR-future/Trinity with Docker Model Runner:
docker model run hf.co/STAR-future/Trinity
H6 mode + parametric bpb dir
Browse files- tools/colab_k3pass.py +50 -0
tools/colab_k3pass.py
CHANGED
|
@@ -223,3 +223,53 @@ if MODE == "sealed":
|
|
| 223 |
print("sealed eval exit", rc, flush=True)
|
| 224 |
if rc == 0 and os.environ.get("K3P_BPB", "1") != "0": # bits-per-byte comparison with open models, same VM
|
| 225 |
exec(open(hf_hub_download(REPO, "tools/colab_bpb_compare.py", token=TOK, force_download=True)).read())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
print("sealed eval exit", rc, flush=True)
|
| 224 |
if rc == 0 and os.environ.get("K3P_BPB", "1") != "0": # bits-per-byte comparison with open models, same VM
|
| 225 |
exec(open(hf_hub_download(REPO, "tools/colab_bpb_compare.py", token=TOK, force_download=True)).read())
|
| 226 |
+
|
| 227 |
+
|
| 228 |
+
# 2026-11-24: H6 on the SAME VM that ran K3P=sealed and K3P=train4 (out_sealed and out_train4 are local).
|
| 229 |
+
# Trains a larger specialisation than F1 (head LoRA r256 + layer-92 tail LoRA r128 + LoRA on the 128 hottest routed
|
| 230 |
+
# experts, incl. new ones when they are hot) on caches train2 + train3 + train4 (~3.2 M tokens), then judges it on the
|
| 231 |
+
# sealed holdout against Trinity and the base model. Prereg: 16_EVIDENCE/TRINITY/H6_PREREG_2026-11-24.md.
|
| 232 |
+
if MODE == "h6":
|
| 233 |
+
import shutil
|
| 234 |
+
from huggingface_hub import snapshot_download
|
| 235 |
+
for need in ("out_sealed", "out_train4"):
|
| 236 |
+
if not (W / need / "summary.json").exists():
|
| 237 |
+
raise SystemExit(f"H6 needs {need} on this VM (run K3P=sealed and K3P=train4 first)")
|
| 238 |
+
if (W / "work_train4").exists(): # regenerable work files: free the scratch disk
|
| 239 |
+
shutil.rmtree((W / "work_train4").resolve(), ignore_errors=True)
|
| 240 |
+
scratch = Path("/mnt/local-scratch") if Path("/mnt/local-scratch").exists() else W
|
| 241 |
+
for m in ("train2", "train3"):
|
| 242 |
+
dst = W / f"out_{m}"
|
| 243 |
+
if not (dst / "summary.json").exists():
|
| 244 |
+
dl = scratch / f"dl_{m}"
|
| 245 |
+
snapshot_download(f"STAR-future/Trinity-k3cache-{m}", repo_type="dataset", token=TOK, allow_patterns=[f"{m}/*"],
|
| 246 |
+
local_dir=str(dl), max_workers=8)
|
| 247 |
+
if not dst.exists():
|
| 248 |
+
dst.symlink_to(dl / m)
|
| 249 |
+
if json.loads((dst / "summary.json").read_text()).get("layers_run") != 93:
|
| 250 |
+
raise SystemExit(f"cache {m} is not a 93-layer pass")
|
| 251 |
+
(W / "trinity_full_tail_wsp.py").write_bytes(Path(hf_hub_download(REPO, "tools/trinity_full_tail_wsp.py", token=TOK,
|
| 252 |
+
force_download=True)).read_bytes())
|
| 253 |
+
h6 = W / "h6"
|
| 254 |
+
if not (h6 / "full_tail_wsp.pt").exists():
|
| 255 |
+
rc = run([sys.executable, "-u", str(W / "trinity_full_tail_wsp.py"), "train", "--cache", str(W / "out_train2"),
|
| 256 |
+
str(W / "out_train3"), str(W / "out_train4"), "--out", str(h6), "--domains", "chips,space",
|
| 257 |
+
"--head-rank", "256", "--head-alpha", "256", "--tail-rank", "128", "--tail-alpha", "128",
|
| 258 |
+
"--k", "128", "--routed-rank", "16", "--routed-alpha", "16", "--lr", "1.5e-4", "--epochs", "3.0",
|
| 259 |
+
"--kl", "6.0", "--block-size", "256"], "h6_train.log")
|
| 260 |
+
if rc != 0:
|
| 261 |
+
raise SystemExit(f"H6 training failed ({rc})")
|
| 262 |
+
for f in h6.glob("*"):
|
| 263 |
+
if f.is_file():
|
| 264 |
+
api.upload_file(path_or_fileobj=str(f), path_in_repo=f"eval/h6/{f.name}", repo_id=REPO,
|
| 265 |
+
commit_message=f"H6 trained specialisation: {f.name}")
|
| 266 |
+
rc = run([sys.executable, "-u", str(W / "trinity_full_tail_wsp.py"), "eval", "--cache", str(W / "out_sealed"),
|
| 267 |
+
"--trained", str(h6 / "full_tail_wsp.pt"), "--out", str(W / "h6_sealed")], "h6_sealed_eval.log")
|
| 268 |
+
for f in (W / "h6_sealed").glob("*"):
|
| 269 |
+
if f.is_file():
|
| 270 |
+
api.upload_file(path_or_fileobj=str(f), path_in_repo=f"eval/h6_sealed/{f.name}", repo_id=REPO,
|
| 271 |
+
commit_message=f"H6 sealed holdout: {f.name}")
|
| 272 |
+
print("h6 sealed eval exit", rc, flush=True)
|
| 273 |
+
if rc == 0 and os.environ.get("K3P_BPB", "1") != "0":
|
| 274 |
+
os.environ["BPB_DIR"] = "h6_sealed"
|
| 275 |
+
exec(open(hf_hub_download(REPO, "tools/colab_bpb_compare.py", token=TOK, force_download=True)).read())
|