lightcraft/crates/segment/src
Brandon Thomas b52f43d1d5 M12: lightcraft-segment: Apache-2.0, checked weights, pure-Rust model download
- The crate ports Apache-2.0-only Hugging Face transformers code: it is
  now `license = "Apache-2.0"`, and every ported file carries the
  modification notice Apache-2.0 §4(b) asks for.
- Weights::open checks every tensor's byte range (and the header)
  against the file's length: a truncated or damaged download is an
  error at load, never a short read later; regression test with
  hostile offsets.
- fetch/: the model download, only when asked for. An ordered mirror
  list (env LIGHTCRAFT_SAM3_MIRRORS, a mirrors file, DEFAULT_MIRRORS —
  empty until LightCraft's CDN exists, TODO for the maintainer),
  fallback to the next mirror, resume via Range, redirects, connect and
  stall timeouts, cancel, size caps, exact size + SHA-256 (pinned from
  tools/install-sam3.sh) before an atomic rename; damaged files are
  deleted, HTTP error bodies never written.
- HTTP/1.1 client over std sockets + rustls with the RustCrypto provider
  (rustls-rustcrypto) and webpki-roots: no ring / aws-lc-rs, nothing
  compiled from C (no new `cc` users in the app's build graph).
- Tests against a local TcpListener server (no internet): fallback,
  redirects, chunked bodies, resume, 416, hash mismatch, too much data,
  stalls, cancel.
- *.safetensors are gitignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 09:56:49 -04:00
..
fetch M12: lightcraft-segment: Apache-2.0, checked weights, pure-Rust model download 2026-10-07 09:56:49 -04:00
clip.rs M12: lightcraft-segment: Apache-2.0, checked weights, pure-Rust model download 2026-10-07 09:56:49 -04:00
detector.rs M12: lightcraft-segment: Apache-2.0, checked weights, pure-Rust model download 2026-10-07 09:56:49 -04:00
lib.rs M12: lightcraft-segment: Apache-2.0, checked weights, pure-Rust model download 2026-10-07 09:56:49 -04:00
mask.rs M12: lightcraft-segment: Apache-2.0, checked weights, pure-Rust model download 2026-10-07 09:56:49 -04:00
neck.rs M12: lightcraft-segment: Apache-2.0, checked weights, pure-Rust model download 2026-10-07 09:56:49 -04:00
nn.rs M12: lightcraft-segment: Apache-2.0, checked weights, pure-Rust model download 2026-10-07 09:56:49 -04:00
tokenizer.rs M12: lightcraft-segment: Apache-2.0, checked weights, pure-Rust model download 2026-10-07 09:56:49 -04:00
tracker.rs M12: lightcraft-segment: Apache-2.0, checked weights, pure-Rust model download 2026-10-07 09:56:49 -04:00
vit.rs M12: lightcraft-segment: Apache-2.0, checked weights, pure-Rust model download 2026-10-07 09:56:49 -04:00
weights.rs M12: lightcraft-segment: Apache-2.0, checked weights, pure-Rust model download 2026-10-07 09:56:49 -04:00