How google-deepmind/magiclens works
MagicLens is an image-retrieval model for image-plus-instruction queries. Its shipped workflow prepares benchmark query and image-index examples, loads pretrained parameters, embeds both sides, ranks index images by similarity, then evaluates recall or writes ranked predictions. The README describes self-supervised training and broad benchmark capabilities, but explicitly says training is not supported here; the graph therefore focuses on implemented inference. Internal model layers are shown separately. Dataset-specific implementations beyond the excerpts are represented only at the supported module level.
Main entry points: inference.py Inference runner · model.py MagicLens encoder · data_utils.py Benchmark datasets · layers.py Transformer and pooling
Components 11
Inference workflow
- Inference runner
inference.py - CLIP tokenizer
- Pretrained weights
- Ranked results
Embedding model
- MagicLens encoder
model.py - Transformer and pooling
layers.py - CLIP backbone
Dataset handling
- Benchmark datasets
data_utils.py - Dataset files
data - Recall and export
data_utils.py
Other components
- Evaluator
Connections 10
- Evaluator → Inference runner: runs inference
README.md - Inference runner → CLIP tokenizer: builds tokenizer
inference.py - Inference runner → Benchmark datasets: builds examples
inference.py - Benchmark datasets → Dataset files: reads examples
data_utils.py - Inference runner → Pretrained weights: loads parameters
inference.py - Inference runner → MagicLens encoder: initializes and applies
inference.py - MagicLens encoder → CLIP backbone: encodes image and text
model.py - MagicLens encoder → Transformer and pooling: uses encoder layers
model.py - Inference runner → Recall and export: evaluates or exports
inference.py - Inference runner → Ranked results: writes predictions
inference.py