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
tools/colab_k3pass.py
Browse files- tools/colab_k3pass.py +42 -0
tools/colab_k3pass.py
CHANGED
|
@@ -172,3 +172,45 @@ elif MODE == "tail":
|
|
| 172 |
up(W / "tail" / "verdict.raw.npz", "lb_tail_verdict.raw.npz")
|
| 173 |
up(W / "tail" / "train_record.json", "lb_tail_train_record.json")
|
| 174 |
up(W / "tail" / "layer92_trained.pt", "layer92_trained.pt")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
up(W / "tail" / "verdict.raw.npz", "lb_tail_verdict.raw.npz")
|
| 173 |
up(W / "tail" / "train_record.json", "lb_tail_train_record.json")
|
| 174 |
up(W / "tail" / "layer92_trained.pt", "layer92_trained.pt")
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
# 2026-11-24: confirmatory evaluation of a trained specialisation on the SEALED holdout (61 sequences, Gemini custody,
|
| 178 |
+
# sha256 9d174d3f...). The texts come only from the private dataset; Trinity and the base model both run (base=True);
|
| 179 |
+
# no checkpoints and no cache upload (private quota is full and the cache stays on this VM); only aggregate verdict
|
| 180 |
+
# and per-token losses (numbers, no text) are published under eval/h5_sealed/.
|
| 181 |
+
if MODE == "sealed":
|
| 182 |
+
import torch
|
| 183 |
+
gpu_gb = torch.cuda.get_device_properties(0).total_memory / 2 ** 30
|
| 184 |
+
if gpu_gb < 39 and not os.environ.get("K3P_ALLOW_SMALL_GPU"):
|
| 185 |
+
raise SystemExit(f"GPU with {gpu_gb:.0f} GB: this pass needs an A100 (40/80 GB). Disconnect and retry later.")
|
| 186 |
+
src = Path(hf_hub_download("STAR-future/Trinity-k3cache", "eval-data/sealed_h2_holdout_61.jsonl", repo_type="dataset",
|
| 187 |
+
token=TOK, force_download=True))
|
| 188 |
+
import hashlib as _h
|
| 189 |
+
if _h.sha256(src.read_bytes()).hexdigest() != "9d174d3fc71accb0001cdab2a4293cfdd44663ff573362735cbe8956d2580dad":
|
| 190 |
+
raise SystemExit("sealed holdout file does not match its sealed sha256")
|
| 191 |
+
rows = []
|
| 192 |
+
for r in map(json.loads, src.read_text(encoding="utf-8").splitlines()):
|
| 193 |
+
st = "wikipedia" if r["set"].startswith("general") else r["set"].replace("h2_", "")
|
| 194 |
+
rows.append({"id": r["id"], "text": r["text"], "set": st, "role": "holdout", "base": True})
|
| 195 |
+
texts = W / "streams_sealed.jsonl"
|
| 196 |
+
texts.write_text("".join(json.dumps(r) + "\n" for r in rows), encoding="utf-8")
|
| 197 |
+
out = W / "out_sealed"
|
| 198 |
+
if not (out / "summary.json").exists():
|
| 199 |
+
rc = run([sys.executable, "-u", str(W / "k3pass.py"), "--texts", str(texts), "--work", str(W / "work_sealed"),
|
| 200 |
+
"--out", str(out), "--batch", "12" if gpu_gb > 60 else "8", "--layers", "-1",
|
| 201 |
+
"--ckpt-repo", "STAR-future/Trinity-k3ckpt-sealed", "--ckpt-every", "999"], "k3pass_sealed.log")
|
| 202 |
+
print("pass exit", rc, flush=True)
|
| 203 |
+
if json.loads((out / "summary.json").read_text()).get("layers_run") != 93:
|
| 204 |
+
raise SystemExit("sealed pass did not run all 93 layers: no verdict")
|
| 205 |
+
trained = os.environ.get("K3P_TRAINED", "eval/h4/F1_Arm3_HeadLoRA_full_tail_wsp.pt")
|
| 206 |
+
tp = Path(hf_hub_download(REPO, trained, token=TOK, force_download=True))
|
| 207 |
+
(W / "trinity_full_tail_wsp.py").write_bytes(Path(hf_hub_download(REPO, "tools/trinity_full_tail_wsp.py", token=TOK,
|
| 208 |
+
force_download=True)).read_bytes())
|
| 209 |
+
rc = run([sys.executable, "-u", str(W / "trinity_full_tail_wsp.py"), "eval", "--cache", str(out), "--trained", str(tp),
|
| 210 |
+
"--out", str(W / "h5_sealed")], "h5_sealed_eval.log")
|
| 211 |
+
for f in (W / "h5_sealed").glob("*"):
|
| 212 |
+
if f.is_file():
|
| 213 |
+
api.upload_file(path_or_fileobj=str(f), path_in_repo=f"eval/h5_sealed/{f.name}", repo_id=REPO,
|
| 214 |
+
commit_message=f"H5 sealed holdout: {f.name}")
|
| 215 |
+
up(out / "summary.json", "h5_sealed/k3pass_sealed_summary.json")
|
| 216 |
+
print("sealed eval exit", rc, flush=True)
|