rlx-sam3
Meta's SAM 3 — Segment Anything with Concepts for RLX. Targets the base SAM 3 image + video architecture: a DETR-style detector (ViT-L vision trunk + text encoder → decoder queries) that turns an image and a text prompt into instance masks and scores. Loads safetensors or GGUF checkpoints; SAM 3.1 multiplex is intentionally out of scope.
Quick start
# or:
# Metal:
CLI flags: --weights, --device (cpu|metal|mlx|cuda|rocm|gpu|vulkan), --text-tokens A,B,C (comma-separated token ids; a placeholder 0..32 is used if omitted), --dry.
Public API
use ;
use Device;
let mut sam = from_checkpoint_on?;
// rgb: row-major [H*W*3] u8; text_tokens: pre-tokenized concept prompt.
let pred = sam.predict_image_text?;
println!;
# Ok
Other exports (src/lib.rs): [Sam3EncodedImage], the video path [Sam3VideoState] / [Sam3VideoFramePrediction]; graph builders build_sam3_detector_encoder_graph and the flow Sam3DetectorEncoderFlow / Sam3DetectorDecoderFlow; GGUF loading via [load_sam3_from_gguf] / gguf_has_packed_linears; and preprocess_image / assemble_patch_tokens. Config: Sam3Config + Sam3VitConfig / Sam3DetectorConfig / Sam3TextConfig / Sam3TrackerConfig (base = 1008px input, patch 14, embed 1024, 200 detector queries).
Example — vision-trunk timing / parity
Times the ViT-L vision trunk per backend and compares against the host reference (max-abs / mean-abs / cosine). Env: RLX_SAM3_VISION_ITERS, RLX_SAM3_VISION_DEVICES.
How it fits
Depends on rlx-sam (compile profiles sam3_profile_default / sam3_profile_near_weights) and rlx-gguf for packed GGUF weights. Sits alongside rlx-sam2 in the segmentation family; host tensor kernels are shared via rlx_core::host_kernels.
Tests