Instructions to use HopitAI/moda-pro-lite with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- OpenCLIP
How to use HopitAI/moda-pro-lite with OpenCLIP:
import open_clip model, preprocess_train, preprocess_val = open_clip.create_model_and_transforms('hf-hub:HopitAI/moda-pro-lite') tokenizer = open_clip.get_tokenizer('hf-hub:HopitAI/moda-pro-lite') - Notebooks
- Google Colab
- Kaggle
Card: MODA Pro Lite (bare encoder); recipe moved to moda-pro-lite-plus
Browse files
README.md
CHANGED
|
@@ -10,17 +10,15 @@ pipeline_tag: feature-extraction
|
|
| 10 |
library_name: open_clip
|
| 11 |
---
|
| 12 |
|
| 13 |
-
# MODA Pro Lite
|
| 14 |
|
| 15 |
-
|
|
|
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
The encoder on its own is **MODA Pro Lite**; with the recipe it is **MODA Pro Lite+**.
|
| 22 |
-
Same weights, same repository, one extra step at index time and none at query time.
|
| 23 |
-
Numbers for both are below.
|
| 24 |
|
| 25 |
## Results
|
| 26 |
|
|
@@ -48,38 +46,12 @@ In-Shop queries average 75 words, and Pro Lite+ scores 0.1026 there against MODA
|
|
| 48 |
If your queries are descriptions rather than titles, use
|
| 49 |
[MODA Duo](https://huggingface.co/HopitAI/moda-duo), which routes per query.
|
| 50 |
|
| 51 |
-
## Serving cost
|
| 52 |
-
|
| 53 |
-
```
|
| 54 |
-
stored vectors per item : 1
|
| 55 |
-
ANN queries per search : 1
|
| 56 |
-
image forwards at index : 3x offline, paid once
|
| 57 |
-
text forwards per query : 2x negligible beside the ANN probe
|
| 58 |
-
```
|
| 59 |
-
|
| 60 |
-
The recipe is a rule for *what you encode*, not a model change. Views are combined into one
|
| 61 |
-
unit vector before indexing, so nearest-neighbour search costs exactly what the bare encoder
|
| 62 |
-
costs — same index, same probe, no extra routes and no re-ranking.
|
| 63 |
-
|
| 64 |
## Use
|
| 65 |
|
| 66 |
```bash
|
| 67 |
-
pip install open_clip_torch pillow
|
| 68 |
-
python serving_ann.py --demo
|
| 69 |
-
```
|
| 70 |
-
|
| 71 |
-
```python
|
| 72 |
-
from serving_ann import load, encode_images, encode_queries, build_index, search
|
| 73 |
-
|
| 74 |
-
enc = load() # open_clip, this repo's weights
|
| 75 |
-
docs = encode_images(catalogue, enc) # (n, 768) float32, one vector per item
|
| 76 |
-
index = build_index(docs) # hnswlib, cosine via inner product
|
| 77 |
-
qry = encode_queries(["black leather ankle boots"], enc)
|
| 78 |
-
ids, scores = search(index, qry, k=10)
|
| 79 |
```
|
| 80 |
|
| 81 |
-
Bare encoder, if you would rather not use the recipe:
|
| 82 |
-
|
| 83 |
```python
|
| 84 |
import open_clip, torch
|
| 85 |
|
|
@@ -94,15 +66,8 @@ with torch.no_grad():
|
|
| 94 |
```
|
| 95 |
|
| 96 |
768-d embeddings, cosine similarity, one vector per item. Index them in any vector database.
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
```
|
| 101 |
-
document = normalize(official + 0.25 * square_pad + 0.25 * foreground_pad)
|
| 102 |
-
query = normalize(raw + 0.25 * "a photo of {query}")
|
| 103 |
-
```
|
| 104 |
-
|
| 105 |
-
`serving_ann.py` implements it. Zero added parameters, one stored vector.
|
| 106 |
|
| 107 |
## Evaluation
|
| 108 |
|
|
@@ -112,6 +77,7 @@ All figures are full corpus, all ground-truth queries, MAP@10 under one evaluato
|
|
| 112 |
|
| 113 |
## Related
|
| 114 |
|
|
|
|
| 115 |
- [MODA Duo](https://huggingface.co/HopitAI/moda-duo) — routes each query to Pro Lite+ or MODA by its shape; beats both on a mixed workload.
|
| 116 |
- [MODA](https://huggingface.co/HopitAI/moda-fashionsiglip-multiview-203m) — FashionSigLIP with a serving recipe. Stronger on long descriptions.
|
| 117 |
- [MODA-SigLIP-Distilled](https://huggingface.co/HopitAI/moda-fashion-distilled) — image-to-image retrieval.
|
|
|
|
| 10 |
library_name: open_clip
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# MODA Pro Lite
|
| 14 |
|
| 15 |
+
A 213M fashion retrieval encoder (SigLIP2-base-384 backbone, fashion-vocabulary build).
|
| 16 |
+
**Open weights.**
|
| 17 |
|
| 18 |
+
Served with its calibrated recipe it becomes
|
| 19 |
+
**[MODA Pro Lite+](https://huggingface.co/HopitAI/moda-pro-lite-plus)** — the strongest open
|
| 20 |
+
system at ≤250M parameters on catalogue and title search. The recipe lives in that repository;
|
| 21 |
+
the weights live here, and Pro Lite+ pulls them at load time.
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
## Results
|
| 24 |
|
|
|
|
| 46 |
If your queries are descriptions rather than titles, use
|
| 47 |
[MODA Duo](https://huggingface.co/HopitAI/moda-duo), which routes per query.
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
## Use
|
| 50 |
|
| 51 |
```bash
|
| 52 |
+
pip install open_clip_torch pillow
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
```
|
| 54 |
|
|
|
|
|
|
|
| 55 |
```python
|
| 56 |
import open_clip, torch
|
| 57 |
|
|
|
|
| 66 |
```
|
| 67 |
|
| 68 |
768-d embeddings, cosine similarity, one vector per item. Index them in any vector database.
|
| 69 |
+
For the recipe that lifts these numbers to the Pro Lite+ column, use
|
| 70 |
+
[moda-pro-lite-plus](https://huggingface.co/HopitAI/moda-pro-lite-plus).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
## Evaluation
|
| 73 |
|
|
|
|
| 77 |
|
| 78 |
## Related
|
| 79 |
|
| 80 |
+
- [MODA Pro Lite+](https://huggingface.co/HopitAI/moda-pro-lite-plus) — this encoder with its serving recipe.
|
| 81 |
- [MODA Duo](https://huggingface.co/HopitAI/moda-duo) — routes each query to Pro Lite+ or MODA by its shape; beats both on a mixed workload.
|
| 82 |
- [MODA](https://huggingface.co/HopitAI/moda-fashionsiglip-multiview-203m) — FashionSigLIP with a serving recipe. Stronger on long descriptions.
|
| 83 |
- [MODA-SigLIP-Distilled](https://huggingface.co/HopitAI/moda-fashion-distilled) — image-to-image retrieval.
|