Specific inputs:
- A dataset
- A model
- A mode (e.g.
image-to-image
)
Get evaluation metrics:
- A retrieval results dataframe
- A retrieval metrics dataframe
- ✅ Supports a wide range of models and datasets.
- ✅ Installation in one line.
- ✅ Run benchmarks with one function call.
import xretrieval
metrics, results_df = xretrieval.run_benchmark(
dataset="coco-val-2017",
model_id="transformers/Salesforce/blip2-itm-vit-g",
mode="text-to-text",
)
Retrieval Metrics
┏━━━━━━━━━━━━━━━┳━━━━━━━━┓
┃ Metric ┃ Score ┃
┡━━━━━━━━━━━━━━━╇━━━━━━━━┩
│ MRR │ 0.3032 │
│ NormalizedDCG │ 0.3497 │
│ Precision │ 0.2274 │
│ Recall │ 0.4898 │
│ HitRate │ 0.4898 │
│ MAP │ 0.2753 │
└───────────────┴────────┘
pip install xretrieval
List datasets:
xretrieval.list_datasets()
Available Datasets
┏━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Dataset Name ┃ Description ┃
┡━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ coco-val-2017 │ The COCO Validation Set with 5k images. │
└───────────────┴─────────────────────────────────────────┘
List models:
xretrieval.list_models()
Available Models
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓
┃ Model ID ┃ Model Input ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩
│ transformers/Salesforce/blip2-itm-vit-g │ text-image │
│ transformers/Salesforce/blip2-itm-vit-g-text │ text │
│ transformers/Salesforce/blip2-itm-vit-g-image │ image │
│ sentence-transformers/paraphrase-MiniLM-L3-v2 │ text │
│ sentence-transformers/paraphrase-albert-small-v2 │ text │
│ sentence-transformers/multi-qa-distilbert-cos-v1 │ text │
│ sentence-transformers/all-MiniLM-L12-v2 │ text │
│ sentence-transformers/all-distilroberta-v1 │ text │
│ sentence-transformers/multi-qa-mpnet-base-dot-v1 │ text │
│ sentence-transformers/all-mpnet-base-v2 │ text │
│ sentence-transformers/multi-qa-MiniLM-L6-cos-v1 │ text │
│ sentence-transformers/all-MiniLM-L6-v2 │ text │
│ timm/resnet18.a1_in1k │ image │
└──────────────────────────────────────────────────┴─────────────┘
Visualize retrieval results:
xretrieval.visualize_retrieval(results_df)