# Third-party notice — TinyCLIP ViT-8M/16 + Text-3M (YFCC15M)

This directory contains an unmodified pretrained model checkpoint, exported to ONNX by a
third-party maintainer, redistributed under its original license.

- **Model**: TinyCLIP ViT-8M/16, Text-3M, YFCC15M — a heavily distilled CLIP variant (dual
  image/text encoder trained for joint embedding via affinity mimicking + weight inheritance
  from a larger CLIP teacher model), used here for text-to-image visual search
- **Paper**: [TinyCLIP: CLIP Distillation via Affinity Mimicking and Weight Inheritance](https://openaccess.thecvf.com/content/ICCV2023/papers/Wu_TinyCLIP_CLIP_Distillation_via_Affinity_Mimicking_and_Weight_Inheritance_ICCV_2023_paper.pdf)
  (Wu et al., ICCV 2023)
- **Original repository**: https://github.com/wkcn/TinyCLIP
- **Original checkpoint**: https://huggingface.co/wkcn/TinyCLIP-ViT-8M-16-Text-3M-YFCC15M
- **License**: MIT — verified by reading the actual `LICENSE` file at the primary GitHub
  repository (see `LICENSE` in this directory, fetched verbatim). Note: GitHub's automated
  license detector reports "NOASSERTION" for this repo because the LICENSE file appends a
  third-party-notices section listing the license of code it borrows from (CLIP, CoFiPruning,
  OpenCLIP -- all MIT; PyTorch -- BSD-style) below the MIT text, which trips up automatic
  classification. The license text itself is unambiguous: MIT, copyright Microsoft Corporation.
- **Commercial use**: Permitted. MIT has no non-commercial restriction; it only requires
  retaining the copyright/license notice.
- **ONNX export source**: `onnx-community` (Hugging Face's automated ONNX conversion org) —
  https://huggingface.co/onnx-community/TinyCLIP-ViT-8M-16-Text-3M-YFCC15M-ONNX. Weights are
  unmodified from the original checkpoint; only the export format and (for the variant used
  here) dynamic quantization were applied.
- **Asset source**: `onnx/model_quantized.onnx` from the above repository
- **File size**: 24,281,512 bytes
- **SHA-256**: `10921310ddef06557ec1598d1260470a0a4db53f70ffe0deb60b946dcad6d27a`
- **`vocab.json` / `merges.txt`**: the model's byte-level BPE tokenizer files (OpenAI CLIP
  convention), taken verbatim from the same Hugging Face repository -- used at inference time
  to turn a text query into token ids, unmodified.

Preprocessing/postprocessing logic used in this site's `visual-search.js` was independently
implemented in JavaScript: CLIP-style image preprocessing (resize-shortest-edge + center-crop
+ CLIP-specific mean/std normalization) and, notably, a from-scratch byte-level BPE tokenizer
(byte-to-unicode table, CLIP's pre-tokenization regex, greedy rank-ordered merge algorithm, and
the `</w>` end-of-word convention) matching the model's exact tokenizer. This was cross-checked
token-for-token against the reference `@huggingface/transformers` tokenizer output across a
range of test strings (plain text, contractions, punctuation, digits, emoji, unicode
normalization, empty input) with zero mismatches before shipping. Real end-to-end inference was
also verified: five text queries against a small gallery of real photos each correctly ranked
their matching image first. This is original code, not redistributed from the upstream
repository.
