Views
No views yet
GatedBertPool (cost-aware Mixture-of-BERT-Experts) checkpoint for the
GLUE MRPC paraphrase classification task.prajjwal1/bert-tinyM-FAC/bert-tiny-finetuned-mrpc (cost = 2)howey/bert-base-uncased-mrpc (cost = 7)yoshitomo-matsubara/bert-large-uncased-mrpc (cost = 13)| Metric | Value |
|---|---|
| Soft-gating accuracy | 87.50% |
| Soft-gating F1 | 90.36% |
| Avg router prob (tiny / base / large) | 12.4% / 28.7% / 58.9% |
| Average expected cost | 9.91 / 13 |
| Compute saving vs always-large | 24% |
1ckpt = torch.load('mrpc_best_model.pt', map_location='cpu', weights_only=False)
2ckpt.keys() # ['model_state_dict', 'config']1from huggingface_hub import hf_hub_download
2from mpc_router import GatedBertPool
3import torch
4
5ckpt_path = hf_hub_download('yu505948/mpc-router-mrpc', 'mrpc_best_model.pt')
6ckpt = torch.load(ckpt_path, map_location='cpu', weights_only=False)
7config = ckpt['config']
8model = GatedBertPool(
9 router_model_name = config['model']['router_model_name'],
10 router_stem_layers = config['model']['router_stem_layers'],
11 expert_model_names = config['model']['expert_model_names'],
12 num_labels = config['task']['num_labels'],
13 task_type = config['task']['task_type'],
14 router_hidden_size = config['model']['router_hidden_size'],
15 router_dropout = config['model']['router_dropout'],
16)
17model.load_state_dict(ckpt['model_state_dict'])tutorials/Demo.ipynb
in the source repo for an end-to-end Colab demo.mpc-router-train --config configs/task_mrpc.yaml
(batch=16, epochs=9, lr=2e-6, alpha=0.01, beta=0.03)