models-and-encoders
Load and validate MTEB models, built-in model metadata, SentenceTransformers/CrossEncoder/custom encoder/search protocols, prompts, encode kwargs, embedding cache/compression/search wrappers, and optional model extras.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- models-and-encoders
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Load and validate MTEB models, built-in model metadata, SentenceTransformers/CrossEncoder/custom encoder/search protocols, prompts, encode kwargs, embedding cache/compression/search wrappers, and optional model extras.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/custom-encoders.md7.1 KB
- 参考文档references/model-api.md7.8 KB
- 参考文档references/troubleshooting.md7.5 KB
- 脚本scripts/validate_encoder_protocol.py8.1 KB
03 SKILL.md 正文
MTEB Models and Encoders
Use this sub-skill when the user needs to choose, load, wrap, validate, or troubleshoot a model object for MTEB. This includes built-in MTEB model metadata, fallback Hugging Face/SentenceTransformers loading, CrossEncoder rerankers, custom EncoderProtocol/CrossEncoderProtocol/SearchProtocol implementations, prompt routing, encode_kwargs, BM25 baselines, embedding caching, embedding compression, and optional provider extras.
Route by Need
- Load a registered or Hub model: Use
references/model-api.mdformteb.get_model,mteb.get_model_meta,mteb.get_model_metas,revision,device,embed_dim,experiment_kwargs, and optional extras. - Build or validate a custom model: Use
references/custom-encoders.mdand runscripts/validate_encoder_protocol.pybefore evaluation to catch missingencode,predict,index,search,similarity, or constructor-shape problems. - Add prompts or encode options: Use
references/model-api.mdformodel_prompts, prompt priority,PromptType.query/PromptType.document, and passingencode_kwargsthroughmteb.evaluate. - Cache or compress embeddings: Use
references/model-api.mdforCachedEmbeddingWrapper,NumpyCache,FaissCache,CompressionWrapper,OutputDType, and cache-path hygiene. - Use search/reranking wrappers: Use
references/custom-encoders.mdforSearchEncoderWrapper,SearchCrossEncoderWrapper, BM25 baselines, and when a CrossEncoder requires pre-ranked documents. - Fix model failures: Use
references/troubleshooting.mdfor import/install extras, provider packages, private datasets/models, cache/result paths, task filters, CLI/API misuse, and protocol mismatch symptoms.
Minimal Patterns
import mteb
meta = mteb.get_model_meta("intfloat/multilingual-e5-small")
model = meta.load_model(device="cpu")
# Equivalent eager load:
model = mteb.get_model("intfloat/multilingual-e5-small", device="cpu")
import mteb
from sentence_transformers import SentenceTransformer, CrossEncoder
dense_model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
reranker = CrossEncoder("cross-encoder/ms-marco-MiniLM-L-6-v2")
from mteb.models import CompressionWrapper
from mteb.models.cache_wrappers import CachedEmbeddingWrapper
from mteb.types import OutputDType
model = CachedEmbeddingWrapper(model, cache_path=".mteb-embedding-cache")
model = CompressionWrapper(model, output_dtype=OutputDType.INT8)
Cross-links
- For actually evaluating a loaded model, pass model objects or
ModelMetainto../evaluation-workflows/. - For adding a new
ModelMetaimplementation to MTEB itself, use../contributing-to-mteb/. - For model cards, result submission, and leaderboard expectations, use
../results-and-leaderboard/.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).