training-and-custom-models
Plan and preflight custom CellTypist model training, including data preparation, SGD/mini-batch options, feature selection, downsampling, and model save/use handoff.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- training-and-custom-models
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Plan and preflight custom CellTypist model training, including data preparation, SGD/mini-batch options, feature selection, downsampling, and model save/use handoff.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md6.9 KB
- 参考文档references/training-workflows.md7.0 KB
- 参考文档references/troubleshooting.md5.6 KB
- 脚本scripts/training_data_check.py12.2 KB
03 SKILL.md 正文
Training and Custom Models
Use this sub-skill when a task needs a custom CellTypist model trained from reference expression data, labels, and genes, or when training inputs must be validated before an expensive run.
Start Here
- Read references/api-reference.md for the verified
celltypist.trainandcelltypist.samples.downsample_adatasignatures and parameter caveats. - Use references/training-workflows.md to choose one-pass logistic regression, SGD, mini-batch SGD, two-pass feature selection, sparse-safe settings, and model persistence.
- Run scripts/training_data_check.py before expensive training when the user provides CSV/label/gene fixtures or asks why a run will fail.
- Use references/troubleshooting.md to map validation, solver, memory, GPU, mini-batch, feature-selection, and downsampling failures to concrete fixes.
Boundaries and Routing
- Stay here for
celltypist.train,celltypist.samples.downsample_adata, training matrix/label/gene validation, algorithm choice, feature-selection settings, sparse-memory safeguards, GPU caveats, and writing a trained model. - Route inference with a trained model to
../annotation-workflows/. - Route model conversion, subsetting, built-in model discovery, or model metadata management to
../model-management/. - Route final dotplots, result tables, and visualization polish to
../visualization-and-results/.
Fast Decision Rules
- Use default logistic regression for small or intermediate references when calibrated probabilities matter and runtime is acceptable.
- Use
use_SGD=Truefor large matrices where runtime is the bottleneck, accepting that probability calibration may need more tuning. - Use
use_SGD=True, mini_batch=Trueonly when the reference has more cells thanbatch_size; considerbalance_cell_type=Truefor rare labels. - Use
with_mean=Falsefor sparse input to avoid densifying during scaling; considercheck_expression=Falseonly when the user intentionally trains on an HVG/subset matrix that cannot pass whole-transcriptome normalization checks. - Use
feature_selection=Trueonly when the number of genes is greater thantop_genesand the extra first-pass SGD cost is justified.
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).