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
Download tools/colab_t3eval.py from STAR-future/Trinity: direct link, hf CLI and curl.
- Browser
- Download file 2.13 kB
-
https://huggingface.co/STAR-future/Trinity/resolve/bbb24a1be6f28cc30d7ffbb2fe32e2f5841c8ffa/tools/colab_t3eval.py
- Command line
-
hf download hf://STAR-future/Trinity@bbb24a1be6f28cc30d7ffbb2fe32e2f5841c8ffa/tools/colab_t3eval.py
-
curl -L -o colab_t3eval.py https://huggingface.co/STAR-future/Trinity/resolve/bbb24a1be6f28cc30d7ffbb2fe32e2f5841c8ffa/tools/colab_t3eval.py
2.13 kB
| """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}") | |