Skip to main content

PhotonRT

PhotonRT is a CPU-first native inference runtime for the Photon image-captioning model and its MobileCLIP-S1 image encoder.

Current pipeline

image (preprocessed CHW float32)
        |
        v
MobileCLIP-S1 native CPU encoder
        |
       512-D
        |
        v
Photon projector
        |
      8 x 256
        |
        v
Photon decoder (6 layers)
        |
        v
caption

The Photon decoder is implemented in C++ with a KV-cache generation path. MobileCLIP-S1 is implemented as a reparameterized FastViT/MCI-1 CPU graph. The upstream MobileCLIP repository defines S1 as a 256-pixel image model with a 512-D embedding and MCI-1 image encoder; see the official Apple implementation for model details.

Build (Windows + Visual Studio generator)

cmake -S . -B build
cmake --build build --config Release --parallel
ctest --test-dir build -C Release --output-on-failure

Convert Photon checkpoint

python tools/convert_photon.py \
  --checkpoint "C:/path/to/nano_ep55.pt" \
  --tokenizer "C:/path/to/mobilecap_tokenizer.json" \
  --model-out photon.f32.photon \
  --tokenizer-out photon.tokenizer

Convert MobileCLIP-S1

Use Apple's official MobileCLIP Python package for conversion:

python tools/convert_mobileclip.py \
  --checkpoint "C:/path/to/mobileclip_s1.pt" \
  --output mobileclip-s1.f32.mclip

The converter writes reparameterized inference weights and does not bundle the original Apple checkpoint.

Prepare an exact-reference MobileCLIP input

python tools/preprocess_mobileclip.py \
  --image "C:/path/to/image.jpg" \
  --output image_chw.f32

Run native MobileCLIP

./build/Release/mobileclip-embedding.exe \
  mobileclip-s1.f32.mclip \
  image_chw.f32

Compare native MobileCLIP against PyTorch

python tools/compare_mobileclip.py \
  --checkpoint "C:/path/to/mobileclip_s1.pt" \
  --image-tensor image_chw.f32 \
  --native-embedding mobileclip_embedding.f32

Run end-to-end C++ image captioning

./build/Release/image-caption.exe \
  mobileclip-s1.f32.mclip \
  photon.f32.photon \
  photon.tokenizer \
  image_chw.f32

Important release note

PhotonRT can distribute its own runtime code under its chosen open-source license. Apple's MobileCLIP source code is MIT, while the pretrained MobileCLIP model weights are governed by Apple's model terms; do not bundle Apple's weights into a release without checking those terms.

Status

  • Photon C++ CPU reference runtime: working
  • real Photon checkpoint conversion: working
  • Photon generation: working
  • native MobileCLIP-S1 CPU graph: implemented
  • PyTorch/native MobileCLIP parity: next validation target
  • optimized SIMD kernels: next
  • quantization: next
  • CUDA kernels: next
  • JPEG/PNG native image decoding: next
  • Python bindings: next

Metadata

Release files for photonrt 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for photonrt 0.2.0
File Size Uploaded
photonrt-0.2.0.tar.gz 6.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for photonrt 0.2.0
File Interpreter ABI Platform
photonrt-0.2.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details

Total release size: 12.6 MB

Release files / photonrt-0.2.0.tar.gz

Download URL photonrt-0.2.0.tar.gz
Size 6.4 MB
Tags Source
SHA-256 checksum
How to use checksums
33586148d031f4c7f205f0b0c689ffe651bd6170eea806bdebe3b137ebd781d7
BLAKE2b-256 checksum
How to use checksums
b80dae1b7e3c2904c41885c03de6643cd27ccac4271c2422955259cf80c1c672
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

Release files / photonrt-0.2.0-cp310-cp310-win_amd64.whl

Download URL photonrt-0.2.0-cp310-cp310-win_amd64.whl
Size 6.2 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
9062420ee4908f85d7c8f06fc29ee3449e6cadeccb1999dd6fdda6ffb0c3a0b0
BLAKE2b-256 checksum
How to use checksums
3c8743a34bc1ed6559df2bdd6c6313857001603384161df8600d4a053abe9dca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

Release history Release notifications | RSS feed

0.2.1

2 release files

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page