modeling-and-tokenization
Use when inspecting ColBERT checkpoints, ColBERTConfig model/tokenizer fields, QueryTokenizer or DocTokenizer behavior, query/document max lengths, marker tokens, punctuation masking, embedding dimensions, or safe model/tokenizer import diagnostics.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- modeling-and-tokenization
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use when inspecting ColBERT checkpoints, ColBERTConfig model/tokenizer fields, QueryTokenizer or DocTokenizer behavior, query/document max lengths, marker tokens, punctuation masking, embedding dimensions, or safe model/tokenizer import diagnostics.
- disable-model-invocation
- true
02 资源文件 6
- 参考文档references/api-reference.md6.7 KB
- 参考文档references/config-reference.md5.9 KB
- 参考文档references/modeling-and-tokenization.md6.5 KB
- 参考文档references/troubleshooting.md7.0 KB
- 脚本scripts/inspect_checkpoint_config.py3.8 KB
- 脚本scripts/tokenization_smoke.py5.7 KB
03 SKILL.md 正文
Modeling and Tokenization
Use this sub-skill when an agent needs to reason about ColBERT model checkpoints, tokenizer behavior, config compatibility, text-to-token tensorization, or query/document embedding shapes before indexing, searching, or training.
Route Here For
- Inspecting
Checkpoint(name, colbert_config=None, verbose=3)loading behavior andcheckpoint.colbert_configvalues. - Changing or debugging
ColBERTConfigfields such asquery_maxlen,doc_maxlen,dim,mask_punctuation,attend_to_mask_tokens,query_token_id, ordoc_token_id. - Understanding how
QueryTokenizerandDocTokenizerinsert[Q]and[D]markers, truncate text, pad queries with[MASK], and return IDs/masks. - Explaining
Checkpoint.queryFromText()andCheckpoint.docFromText()output shapes,to_cpu,keep_dims,return_tokens, and packed document outputs. - Diagnosing checkpoint metadata, tokenizer downloads, local-vs-Hugging Face model names, CPU/GPU model loading caveats, or missing optional dependencies.
Start With
- Read
references/modeling-and-tokenization.mdfor the conceptual model, checkpoint/config merge behavior, marker tokens, tokenization, and embedding outputs. - Read
references/config-reference.mdbefore changing shape-sensitive fields such asquery_maxlen,doc_maxlen, ordim. - Read
references/api-reference.mdfor verified imports, constructor signatures, tensorizer methods, encoding outputs, and shape invariants. - Use
scripts/inspect_checkpoint_config.pywhen you need a safe ColBERTConfig summary; pass--allow-remoteonly when remote Hugging Face access is intentional. - Use
scripts/tokenization_smoke.pywhen a local checkpoint or explicitly allowed model name should be checked for marker placement, truncation, and tensor shapes. - Read
references/troubleshooting.mdwhen imports, checkpoint metadata, Hugging Face downloads, max-length truncation, punctuation masking, or device behavior is surprising.
Boundaries
- This sub-skill covers modeling, config, checkpoint, tokenizer, and embedding-inspection tasks.
- For full indexing/search orchestration, index roots, ranking, or
Indexer/Searcherusage, route to the indexing-and-search sub-skill. - For training, triples, distillation, optimizer settings, checkpoint creation, or
Trainer, route to the training-and-distillation sub-skill. - For collection/query/ranking file schemas beyond text passed into tokenizers, route to the data-and-evaluation sub-skill.
Operating Cautions
- Prefer local checkpoint directories for deterministic inspection. Hugging Face model names such as
colbert-ir/colbertv2.0orbert-base-uncasedcan require network/cache access. ColBERTConfig.load_from_checkpoint()can returnNonefor a generic Hugging Face backbone or a checkpoint directory missing ColBERTartifact.metadata.- Query and document marker IDs are inserted at column
1; do not pre-insert marker IDs before calling ColBERT tensorizers. - Query tensor width is normally
query_maxlen; document tensor width is capped bydoc_maxlenbut may be the longest sequence in the batch, not always exactlydoc_maxlen. - CPU-only import/config inspection is safe; full model loading can compile a small CPU extension, download tokenizer/model files, or hit torch/transformers compatibility issues.
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).