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
File size: 2,133 Bytes
f80e81a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | """Colab cell: (1) upload the H4 F1 train record, (2) evaluate the non-weight kNN datastore (NW-1) on the REAL holdout cache
with the full vocabulary, with and without a near-duplicate cosine cap (duplicate-sensitivity audit). Results go to
STAR-future/Trinity eval/t3/. Needs /content/k3p/out_train2 (train2 cache) already on the runtime."""
import os
import subprocess
import sys
from pathlib import Path
from huggingface_hub import HfApi, hf_hub_download, snapshot_download
TOK = os.environ["HF_TOKEN"]
REPO = "STAR-future/Trinity"
W = Path("/content/k3p")
api = HfApi(token=TOK)
rec = W / "h4" / "F1_Arm3_HeadLoRA" / "train_record.json"
if rec.exists():
api.upload_file(path_or_fileobj=str(rec), path_in_repo="eval/h4/F1_Arm3_HeadLoRA_train_record.json", repo_id=REPO,
commit_message="H4 F1 train record")
for f in ("k3ref.py", "k3pass.py", "lb_tail_train.py", "lb_tail_eval.py", "trinity_full_tail_wsp.py",
"eval_t3_nonweight_on_k3cache.py"):
(W / f).write_bytes(Path(hf_hub_download(REPO, f"tools/{f}", token=TOK, force_download=True)).read_bytes())
if not (W / "out_holdout" / "summary.json").exists():
snapshot_download("STAR-future/Trinity-k3cache", repo_type="dataset", token=TOK, allow_patterns=["holdout/*"],
local_dir=str(W / "cache_dl"))
(W / "out_holdout").mkdir(exist_ok=True)
for f in (W / "cache_dl" / "holdout").iterdir():
f.rename(W / "out_holdout" / f.name)
env = dict(os.environ, PYTHONPATH=str(W))
for tag, cap in (("t3_nocap", "2.0"), ("t3_cap098", "0.98")):
out = W / tag
rc = subprocess.run([sys.executable, "-u", str(W / "eval_t3_nonweight_on_k3cache.py"), "--train-cache", str(W / "out_train2"),
"--holdout-cache", str(W / "out_holdout"), "--out", str(out), "--cos-cap", cap], cwd=W, env=env).returncode
print(tag, "rc", rc, flush=True)
for p in out.glob("*"):
if p.is_file() and p.stat().st_size < 200e6:
api.upload_file(path_or_fileobj=str(p), path_in_repo=f"eval/t3/{tag}/{p.name}", repo_id=REPO,
commit_message=f"{tag} {p.name}")
|