keras-model-workflows
Use this DeepCTR sub-skill for Keras-style CTR and recommender models, model selection, compile-fit-predict workflows, save/load, and tiny DeepFM smoke tests.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- keras-model-workflows
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use this DeepCTR sub-skill for Keras-style CTR and recommender models, model selection, compile-fit-predict workflows, save/load, and tiny DeepFM smoke tests.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-reference.md11.4 KB
- 参考文档references/model-catalog.md5.8 KB
- 参考文档references/troubleshooting.md9.5 KB
- 参考文档references/workflows.md10.8 KB
- 脚本scripts/keras_tiny_ctr_smoke.py6.8 KB
03 SKILL.md 正文
Keras Model Workflows
Use this sub-skill for DeepCTR's primary tf.keras.Model-style API: choose a CTR/recommender model, build Keras feature columns, compile, fit, evaluate, predict, save/load, and smoke-test an installation.
When to use this sub-skill
- The user asks for DeepFM, WDL, DCN, xDeepFM, AutoInt, FiBiNET, AFM, NFM, PNN, FGCNN, EDCN, or another single-output DeepCTR model.
- The task is binary CTR classification or scalar regression with tabular sparse/dense features.
- The user needs Keras
compile,fit,predict,evaluate,save_model,load_model, custom objects, callbacks, optimizers, or embedding extraction. - The user wants a safe DeepCTR smoke test that does not depend on example files.
Route map
- Read references/model-catalog.md to choose a model family and understand the supported Keras model constructors.
- Read references/workflows.md for end-to-end preprocessing, model creation, fitting, prediction, evaluation, save/load, embedding extraction, and AFM attention recipes.
- Read references/api-reference.md for verified constructor signatures and Keras method contracts.
- Read references/troubleshooting.md for TensorFlow compatibility, missing dependencies, input shape, string hashing, save/load, and optional GPU issues.
- Run scripts/keras_tiny_ctr_smoke.py to verify a public DeepCTR installation using synthetic data.
Minimal Keras CTR workflow
from deepctr.feature_column import DenseFeat, SparseFeat, get_feature_names
from deepctr.models import DeepFM
feature_columns = [
SparseFeat("user_id", vocabulary_size=10000, embedding_dim=8),
SparseFeat("item_id", vocabulary_size=50000, embedding_dim=8),
DenseFeat("score", 1),
]
feature_names = get_feature_names(feature_columns)
model_input = {name: frame[name].values for name in feature_names}
model = DeepFM(feature_columns, feature_columns, task="binary")
model.compile("adam", "binary_crossentropy", metrics=["binary_crossentropy"])
model.fit(model_input, labels, batch_size=256, epochs=3, validation_split=0.2)
pred = model.predict(model_input, batch_size=256)
For feature-column construction details, route to ../data-and-feature-columns/SKILL.md.
Smoke test
From the generated skill root, run:
python sub-skills/keras-model-workflows/scripts/keras_tiny_ctr_smoke.py --task binary --save-load --json
A successful run builds a tiny DeepFM, trains one epoch on synthetic data, predicts a (n, 1) output, and optionally verifies H5 save/load with DeepCTR custom_objects.
Boundaries
- Use ../sequence-models/SKILL.md for DIN, DIEN, DSIN, and BST history/session-specific conventions.
- Use ../multitask-models/SKILL.md for SharedBottom, ESMM, MMOE, and PLE multi-output models.
- Use ../estimator-workflows/SKILL.md for legacy
tf.estimatorworkflows. - Do not depend on original example scripts or sample files at runtime; use the bundled smoke script and references here.
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).