Upload ModelLens checkpoint (v2-trained, slim)
Browse files- ModelLens.pt +3 -0
- README.md +105 -0
- args.json +1 -0
ModelLens.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6c7a6ff547ee205e713593e3f0f539b6a646e8eaf02069c9fdfc8dfe052af9ee
|
| 3 |
+
size 709051757
|
README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: pytorch
|
| 4 |
+
tags:
|
| 5 |
+
- model-recommendation
|
| 6 |
+
- model-selection
|
| 7 |
+
- ranking
|
| 8 |
+
- model-routing
|
| 9 |
+
- benchmarks
|
| 10 |
+
- leaderboard
|
| 11 |
+
pipeline_tag: tabular-regression
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# ModelLens — Trained Recommender Checkpoint
|
| 15 |
+
|
| 16 |
+
This is the released **ModelLens** checkpoint — a metric-aware ranker that,
|
| 17 |
+
given a dataset description + task + metric, returns a ranked list of
|
| 18 |
+
HuggingFace models likely to perform well on it. No fine-tuning, no
|
| 19 |
+
forward pass on the target dataset.
|
| 20 |
+
|
| 21 |
+
This repo only ships the weights. For:
|
| 22 |
+
|
| 23 |
+
- **Live demo (Gradio)**: 🤗 [`luisrui/ModelLens`](https://huggingface.co/spaces/luisrui/ModelLens)
|
| 24 |
+
- **Training data**: 🤗 [`luisrui/ModelLens-corpus-v2`](https://huggingface.co/datasets/luisrui/ModelLens-corpus-v2) (1.81M rows, recommended)
|
| 25 |
+
- **Source code**: [github.com/luisrui/ModelLens](https://github.com/luisrui/ModelLens)
|
| 26 |
+
- **Paper**: see citation below
|
| 27 |
+
|
| 28 |
+
## What's in here
|
| 29 |
+
|
| 30 |
+
| File | Size | Description |
|
| 31 |
+
|---|---:|---|
|
| 32 |
+
| `ModelLens.pt` | ~709 MB | Trained recommender weights (slim — inference-ready, ~3 unused parent-class buffers dropped) |
|
| 33 |
+
| `args.json` | ~2 KB | Training-time hyperparameters (model dims, num_models / num_tasks / num_metrics / etc.) |
|
| 34 |
+
|
| 35 |
+
## Provenance
|
| 36 |
+
|
| 37 |
+
- **Trained on**: [`luisrui/ModelLens-corpus-v2`](https://huggingface.co/datasets/luisrui/ModelLens-corpus-v2) — 1,807,133 (model × dataset × metric × value) records
|
| 38 |
+
- **Coverage**: 47,242 HuggingFace models · 2,581 tasks · 3,714 metrics · ~86k datasets
|
| 39 |
+
- **Architecture**: `MLPMetricFull` (the paper model — see [github repo](https://github.com/luisrui/ModelLens))
|
| 40 |
+
- **Loss**: ensemble (listwise + pairwise + pointwise, `λ_list=0.5, λ_pair=1.0, w_point=0.1`)
|
| 41 |
+
- **Training**: 30 epochs, DDP × 4 GPUs, `bs=8`, `lr=1e-3`, `wd=1e-4`, learnable `τ`
|
| 42 |
+
- **Slimmed checkpoint**: inference-unused parent-class buffers + train-set `dataset_desc_matrix` stripped (load with `strict=False`).
|
| 43 |
+
|
| 44 |
+
## Loading
|
| 45 |
+
|
| 46 |
+
```python
|
| 47 |
+
from huggingface_hub import hf_hub_download
|
| 48 |
+
import torch, json
|
| 49 |
+
|
| 50 |
+
ckpt_path = hf_hub_download("luisrui/ModelLens", "ModelLens.pt")
|
| 51 |
+
args_path = hf_hub_download("luisrui/ModelLens", "args.json")
|
| 52 |
+
|
| 53 |
+
args = json.load(open(args_path))
|
| 54 |
+
state = torch.load(ckpt_path, map_location="cpu")
|
| 55 |
+
|
| 56 |
+
# Build the model from source (see github.com/luisrui/ModelLens) and load:
|
| 57 |
+
# model = MLPMetricFull(**args_to_kwargs(args))
|
| 58 |
+
# model.load_state_dict(state, strict=False) # strict=False is intentional
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
For a complete, ready-to-run setup including the candidate model pool +
|
| 62 |
+
metadata, see [`inference_lib.py`](https://huggingface.co/spaces/luisrui/ModelLens/blob/main/inference_lib.py)
|
| 63 |
+
and [`recommend.py`](https://huggingface.co/spaces/luisrui/ModelLens/blob/main/recommend.py)
|
| 64 |
+
in the Space.
|
| 65 |
+
|
| 66 |
+
## How it works
|
| 67 |
+
|
| 68 |
+
1. The dataset description is embedded with OpenAI `text-embedding-3-small`
|
| 69 |
+
(1536-dim — same encoder used at training time).
|
| 70 |
+
2. The ranker scores every candidate model conditioned on
|
| 71 |
+
`(dataset_embedding, task_id, metric_id, model_size_bucket, model_family_id, model_id)`.
|
| 72 |
+
3. Returns the top-K candidates, optionally filtered by param count /
|
| 73 |
+
"HF-hosted only" / "official pretrained only".
|
| 74 |
+
|
| 75 |
+
## Intended use
|
| 76 |
+
|
| 77 |
+
- Picking a starting model for a new task / dataset, without running
|
| 78 |
+
every candidate.
|
| 79 |
+
- Cheap pre-filter ahead of a more expensive transferability estimator
|
| 80 |
+
or partial fine-tune.
|
| 81 |
+
|
| 82 |
+
## Limitations
|
| 83 |
+
|
| 84 |
+
- Knowledge is bounded by what's in `corpus-v2` (up to early 2026).
|
| 85 |
+
- Models / datasets that don't appear in the corpus fall back to text
|
| 86 |
+
similarity over their descriptions — useful but weaker than the full
|
| 87 |
+
signal available for in-corpus entities.
|
| 88 |
+
- Scores are *relative* — the ranking is what matters; the absolute
|
| 89 |
+
numbers are not calibrated to any specific metric scale.
|
| 90 |
+
|
| 91 |
+
## Citation
|
| 92 |
+
|
| 93 |
+
```bibtex
|
| 94 |
+
@misc{modellens2026,
|
| 95 |
+
title = {ModelLens: Finding the Best Model for Your Task from Myriads of Models},
|
| 96 |
+
author = {Cai, Rui and Mo, Weijie Jacky and Wen, Xiaofei and Ma, Qiyao and
|
| 97 |
+
Zhu, Wenhui and Chen, Xiwen and Chen, Muhao and Zhao, Zhe},
|
| 98 |
+
year = {2026},
|
| 99 |
+
url = {https://huggingface.co/luisrui/ModelLens},
|
| 100 |
+
}
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
## License
|
| 104 |
+
|
| 105 |
+
MIT.
|
args.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"device": "cuda:0", "use_data_parallel": false, "device_ids": [0, 1, 2, 3], "use_ddp": true, "ddp_find_unused_parameters": false, "num_workers": 0, "pin_memory": false, "persistent_workers": false, "data_name": "unified_augmented_v2", "ood_split_mode": "new_dataset_evaluation", "test_split_mode": "val", "seed": 2025, "use_wandb": true, "wandb_project": "ModelProfile", "wandb_entity": "ruicai-ucdavis", "trail_name": "FinalModel_v2_full_data_deployment", "start_epoch": 0, "checkpoint_path": "", "is_train": true, "is_ood": false, "loss_type": "ensemble", "point_loss_weight": 0.1, "early_stop": 99999, "eval_every": 99999, "num_epochs": 30, "save_every": 5, "save_final_checkpoint": true, "batch_size": 8, "pair_batch_size": 1024, "learning_rate": 0.001, "weight_decay": 0.0001, "tau": 10.0, "lambda_list": 0.5, "lambda_pair": 1.0, "alpha": 3.0, "size_bucket": [0.001, 0.003, 0.01, 0.03, 0.06, 0.1, 0.15, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1, 3, 7, 14, 35, 70, 100, 1000], "use_id_emb": true, "model_dim": 1536, "token_dim": 512, "use_size_prior": true, "size_dim": 64, "use_family_prior": true, "family_dim": 64, "model_desp_emb_dim": 1536, "model_desp_emb_path": "data/unified_augmented_v2/model2desp_embeddings.npz", "use_dataset_id_as_desp": true, "dataset_desp_dim": 1, "dataset_id_emb_dim": 256, "dataset_desp_emb_dim": 1536, "task_dim": 256, "model_name": "MLPMetricFull", "hidden_dim": 512, "dropout_rate": 0.02, "id_dropout_rate": 0.1, "topk": [1, 10, 30, 50], "margin_eps": 0.02, "val_eval_target_models_all_datasets": false, "val_eval_fixed_backbones": false, "save_best_ic8x10_checkpoint": false, "test_eval_target_models_all_datasets": false, "config": "config/FinalModel_unified_augmented_v2.yaml", "is_distributed": true, "world_size": 4, "rank": 0, "local_rank": 0, "num_models": 47242, "num_tasks": 2581, "num_metrics": 3714, "num_datasets": 85937, "unknown_metric_id": 0, "num_size_buckets": 23, "num_families": 332}
|