Skip to content

Quickstart

Open In Colab Open In Kaggle

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 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“ฆ Installation

pip install xretrieval

๐Ÿ› ๏ธ Usage

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)

alt text alt text