deep-ctr-torch
Use DeepCTR-Torch for PyTorch CTR/recommender feature columns, single-task models, DIN/DIEN sequence models, and multi-task learning workflows.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- deep-ctr-torch
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use DeepCTR-Torch for PyTorch CTR/recommender feature columns, single-task models, DIN/DIEN sequence models, and multi-task learning workflows.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/repo-provenance.md2.6 KB
- 参考文档references/repo-routing-metadata.json331 B
- 参考文档references/training-api-and-persistence.md5.1 KB
- 参考文档references/troubleshooting.md4.3 KB
- 脚本scripts/check_deepctr_torch_env.py6.6 KB
03 SKILL.md 正文
DeepCTR-Torch
Use this repo skill when a task names DeepCTR-Torch, deepctr_torch, deepctr-torch, PyTorch CTR prediction, recommender ranking models, SparseFeat/DenseFeat, DeepFM-style models, DIN/DIEN behavior histories, or SharedBottom/ESMM/MMOE/PLE multi-task CTR workflows.
DeepCTR-Torch is a PyTorch package for deep-learning based CTR and recommender models. It exposes feature-column classes, model constructors, and Keras-like compile/fit/predict/evaluate methods.
Install and import
Prefer an isolated Python environment. Minimal package install:
python -m pip install -U deepctr-torch
python - <<'PY'
import deepctr_torch
from deepctr_torch.inputs import SparseFeat, DenseFeat, VarLenSparseFeat, get_feature_names
from deepctr_torch.models import DeepFM
print(deepctr_torch.__version__)
PY
If import deepctr_torch fails with ModuleNotFoundError: requests, install requests explicitly; the package imports it for a best-effort version check even though the distribution metadata may not declare it.
Run the bundled environment checker when starting from an unfamiliar environment:
python scripts/check_deepctr_torch_env.py --quick
Route map
| User task | Load |
|---|---|
Build SparseFeat, DenseFeat, VarLenSparseFeat, feature_names, or model_input dictionaries from tabular data |
feature-column-inputs |
Validate sparse ids, dense vector widths, sequence padding, length_name, shared embedding_name, or batch sizes |
feature-column-inputs |
| Train or predict with DeepFM, WDL, xDeepFM, AFM, AFN, AutoInt, DCN, DCNMix, FiBiNET, IFM, DIFM, MLR, NFM, ONN, PNN, or CCPM | single-task-modeling |
| Convert a binary CTR example to regression, choose losses/metrics, use callbacks, save/load weights, or debug single-target training | single-task-modeling and training API |
Build DIN/DIEN behavior-history models, align hist_* features, share embeddings, set seq_length, or use DIEN negative sampling |
sequence-and-interest-models |
| Use pooled multi-value inputs such as genre lists without DIN/DIEN attention | feature-column-inputs, then sequence-and-interest-models if sequence-specific behavior is needed |
| Train SharedBottom, ESMM, MMOE, or PLE with multiple targets | multitask-modeling |
| Troubleshoot install/import, offline version checks, GPU selection, data shapes, callbacks, metrics, or PyTorch compatibility | troubleshooting |
| Check whether this skill matches a repository checkout or package version | repo provenance |
Common operating pattern
- Build and validate feature columns in
feature-column-inputs. - Choose the model route: single-task, sequence-interest, or multi-task.
- Compile with supported optimizer/loss/metric strings from training API.
- Fit on a
model_inputdictionary whose keys exactly matchget_feature_names(...). - Predict and evaluate by task type; for multi-task outputs, evaluate each prediction column against the matching
task_namesentry. - Use bundled smoke scripts from the owning sub-skill to verify installation or reproduce a minimal pattern before scaling to real data.
Backend notes
DeepCTR-Torch supports CPU workflows and optional PyTorch CUDA devices via device='cuda:0' and, for DataParallel, gpus=[0, 1]. The generated skill was verified for CPU package inspection and tiny CPU training/prediction smokes. Treat GPU and multi-GPU execution as optional unless a user explicitly requests backend verification.
Boundaries
This skill teaches package use, not model-quality benchmarking or recommender-system theory. It does not replace feature engineering, data leakage checks, calibration, or production serving validation. It does not cover arbitrary custom multi-task graph architectures beyond the four package classes.
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).