modules
Use PaddleX module-level APIs and config-driven custom development for create_model, dataset checking, training, evaluation, export, prediction, pdparams2safetensors, and distributed training.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- modules
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use PaddleX module-level APIs and config-driven custom development for create_model, dataset checking, training, evaluation, export, prediction, pdparams2safetensors, and distributed training.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/data-formats.md3.0 KB
- 参考文档references/module-overview.md7.0 KB
- 参考文档references/module-troubleshooting.md3.1 KB
- 脚本scripts/inspect_module_api.py2.8 KB
- 脚本scripts/run_module_smoke.py4.2 KB
03 SKILL.md 正文
PaddleX modules
Use this sub-skill when the user is working with single-model or custom-development workflows rather than a ready-made pipeline. Typical requests mention create_model, a module config YAML, dataset checking, training, evaluation, export, prediction, pdparams2safetensors, checkpoints, or distributed training.
Route away from this sub-skill when the task is:
- quick pre-trained pipeline inference or pipeline config export — use
../pipelines/. - high-performance inference, serving, Paddle2ONNX, GenAI server/client setup, or deployment plugin installation — use
../deployment/.
Start here
- Determine the module family and model name: e.g. image classification, object detection, OCR text recognition, table structure recognition, time-series forecasting, speech recognition, video classification, or document VLM.
- Decide whether the user wants API-level prediction (
create_model) or config-driven development (check_dataset,train,evaluate,export,predict,pdparams2safetensors). - Before training, run dataset checking and fix data-format issues.
- Treat official pretrained weights, local inference model directories, and training checkpoints as different objects.
Read references/module-overview.md for workflow order and config patterns. Read references/data-formats.md for dataset-family notes. Read references/module-troubleshooting.md when config, data, dependency, checkpoint, or distributed-training issues appear.
Minimal model API pattern
from paddlex import create_model
model = create_model("PP-LCNet_x1_0", model_dir="optional/inference/model")
for result in model.predict("demo.jpg", batch_size=1):
result.print()
Verified installed signature for PaddleX 3.7.2:
create_model(model_name, model_dir=None, *args, **kwargs)
model_name selects a supported PaddleX module model. model_dir is for a local model directory; omit it when using official/pretrained resolution if the environment can download the model.
Config-driven workflow
PaddleX module work is typically driven by YAML configs and Global.mode-like modes. Use the bundled helper to keep the module-engine path self-contained:
python scripts/run_module_smoke.py --config module_config.yaml --mode check_dataset --override Dataset.dataset_dir=./data
python scripts/run_module_smoke.py --config module_config.yaml --mode train --override Global.output=./output
python scripts/run_module_smoke.py --config module_config.yaml --mode evaluate --override Evaluate.model_dir=./output/best_model
python scripts/run_module_smoke.py --config module_config.yaml --mode export --override Export.weight_path=./output/best_model/model.pdparams
python scripts/run_module_smoke.py --config module_config.yaml --mode predict --override Predict.model_dir=./output/inference
The installed package also exposes builders for advanced programmatic use:
build_dataset_checker(config: paddlex.utils.config.AttrDict) -> BaseDatasetChecker
build_exportor(config: paddlex.utils.config.AttrDict) -> BaseExportor
build_trainer(config: paddlex.utils.config.AttrDict) -> BaseTrainer
build_evaluator(config: paddlex.utils.config.AttrDict) -> BaseEvaluator
build_weight_converter(config: paddlex.utils.config.AttrDict) -> WeightConverter
Bundled helper
Use scripts/run_module_smoke.py for safe checks and delegated module-engine commands. Use scripts/inspect_module_api.py --help when you only need a signature probe.
python scripts/run_module_smoke.py --dry-run
python scripts/run_module_smoke.py --show-engine-modes
python scripts/run_module_smoke.py --config module_config.yaml --mode check_dataset --override Dataset.dataset_dir=./data
The helpers do not depend on the original checkout. Real training/evaluation/export commands can be long-running and may download weights, so only run them when the user has supplied data, runtime budget, and a prepared backend.
High-value checks before answering a user
- Is the YAML a module config rather than a pipeline config?
- Has
check_datasetpassed for the selected module family? - Is the requested model listed in the module family or support list?
- Does the environment include the extra dependencies for that family (
cv,ocr,ts,speech,video,multimodal, or deployment plugins)? - Is the user trying to deploy/export an already trained model? Route deployment-specific backends to
../deployment/after the module export step.
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).