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: 1,694 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 | # LittleBoy: Colab worker. Paste into ONE Colab cell (CPU runtime, high RAM if available) and run.
# Needs the Colab secret STARHUGGIN (or HF_TOKEN) with notebook access enabled (key icon on the left).
# It builds LittleBoy shards from the HIGHEST index down, skipping any shard already on the Hub, so it never repeats
# the work of the PC (shards 1-24) or of the Google Cloud VM (ascending from 25). Resumable: re-run the cell after a
# disconnect.
import os
import subprocess
import sys
from google.colab import userdata
tok = next(v for v in (userdata.get(k) for k in ("STARHUGGIN", "HF_TOKEN")) if v)
with open("/root/hf_token", "w") as f:
f.write(tok.strip())
os.chmod("/root/hf_token", 0o600)
del tok
subprocess.run([sys.executable, "-m", "pip", "install", "-q", "-U", "huggingface_hub", "hf_xet", "numpy"], check=True)
from huggingface_hub import hf_hub_download # noqa: E402
os.makedirs("/content/lb", exist_ok=True)
for f in ("expand_kimi.py", "wsp_activate.py", "publish_littleboy.py"):
hf_hub_download("STAR-future/Trinity", "tools/" + f, local_dir="/content/lb", token=open("/root/hf_token").read())
os.makedirs("/content/lb/none", exist_ok=True)
print("cores:", os.cpu_count())
env = dict(os.environ, HF_TOKEN_FILE="/root/hf_token")
p = subprocess.Popen([sys.executable, "-u", "/content/lb/tools/publish_littleboy.py", "--repo", "STAR-future/Trinity",
"--local", "/content/lb/none", "--work", "/content/lb/work", "--first", "24", "--reverse"],
env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
for line in p.stdout:
if "%|" not in line:
print(line, end="", flush=True)
print("exit", p.wait())
|