AGENT SKILL

deployment-and-operations

Operate PaddleViT across configuration, environment, AMP/distributed execution, static export, inference, quantization, and optional weight porting without conflating model-family semantics or hiding backend failures.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
deployment-and-operations
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Operate PaddleViT across configuration, environment, AMP/distributed execution, static export, inference, quantization, and optional weight porting without conflating model-family semantics or hiding backend failures.
disable-model-invocation
true

02 资源文件 7

03 SKILL.md 正文

PaddleViT deployment and operations

Use this sub-skill when a task crosses PaddleViT model directories or asks how an existing model is configured, launched, exported, served, diagnosed, or ported. It is an operating guide for the repository's standalone projects, not a replacement for the model-family skills.

Route and boundaries

  • Use configuration.md before changing a YAML, command line, working directory, or checkpoint path.
  • Use distributed-and-amp.md for GPU selection, paddle.distributed.spawn, DataParallel, NCCL, or AMP.
  • Use deployment.md for dynamic-to-static export, Paddle Inference, preprocessing parity, prediction, and PaddleSlim quantization boundaries.
  • Use troubleshooting.md for safe diagnosis of import, CUDA/cuDNN, artifact, and launch failures.
  • Run the bundled probes before attributing a failure to a model: python scripts/check_paddlevit_environment.py --help, python scripts/check_paddle_inference.py --help, and python scripts/validate_checkpoint_manifest.py --help.

This sub-skill does not select a ViT/BEiT/DETR/segmentation/GAN model, define its dataset or transforms, promise benchmark reproduction, perform full training, download data or weights, run arbitrary shell strings, or port weights automatically. Link to the owning model-family skill for those semantics.

Operating sequence

  1. Identify the concrete model directory and its entry script. PaddleViT is a collection of standalone projects rather than one installable package; imports such as from config import ... are commonly resolved relative to the model directory. Prefer an explicit cd into that directory and record the exact commit, config, checkpoint, output prefix, device selection, and preprocessing.
  2. Resolve configuration in this order: Python defaults in config.py, YAML (including its BASE chain), then supplied CLI options. CLI values win over YAML. Record flags such as -eval, -amp, -pretrained, and -resume separately because they change control flow, not only scalar values.
  3. Probe the installed backend and inference API. Treat CPU import success as weaker evidence than a CUDA tensor/layer smoke for GPU claims. Do not copy machine-specific loader fixes, LD_LIBRARY_PATH, cache paths, or private prefixes into a public skill or command.
  4. For training, choose single GPU first. Add -amp only for training on a supported NVIDIA backend and use the distributed procedure only after a one-process smoke is healthy. A multi-GPU batch_size is per GPU in the documented examples.
  5. For export, build the dynamic model, load a compatible state dict, call model.eval(), use an InputSpec matching the model's NCHW shape, call paddle.jit.to_static, and save to an output prefix. Verify the three expected files before inference: <prefix>.pdmodel, <prefix>.pdiparams, and <prefix>.pdiparams.info.
  6. For exported inference, load the .pdmodel/.pdiparams pair with paddle.inference.Config, inspect the predictor's input names, reshape the input handle, copy float32 NCHW data, run, and inspect output names and shapes. Reproduce the original resize/crop/channel/order/scale/mean/std preprocessing exactly; random input only proves the API path, not accuracy.
  7. Keep quantization and weight porting as explicit opt-in boundaries. The documented PaddleSlim post-training flow consumes a static model and emits its own __model__/__params__ layout; it is not interchangeable with Paddle Inference's .pdmodel/.pdiparams files. PyTorch/timm porting needs a manually reviewed parameter-and-buffer mapping, Linear transpose checks, and batched allclose comparison before saving .pdparams.
  8. On failure, classify first (path/config, Python import, backend loader, distributed rendezvous, export graph, artifact manifest, preprocessing, or numerical parity). Apply the smallest local diagnostic, preserve the original error, and stop rather than weakening a required backend claim.

Safe command policy

Commands in this guide are templates. Substitute quoted, user-owned paths only after checking them. Probes are read-only and do not download, overwrite, extract, delete, or alter environment state. Training, multi-process launch, export, quantization, and checkpoint conversion are operational actions: ask for explicit approval and use a new output directory/prefix rather than a source or checkpoint path. CONTRIBUTING.md supports normal review and test expectations; it is not a release/deployment contract.

Evidence and limits

This guide was distilled from docs/paddlevit-config.md, paddlevit-amp.md, paddlevit-multi-gpu.md, paddlevit-export-en.md, paddlevit-quant-cn.md, paddlevit-port-weights.md, image_classification/BEiT/export_models.py, image_classification/BEiT/infer_exported_models.py, image_classification/T2T_ViT/export_models.py, representative config/main parsers, and CONTRIBUTING.md. The requested docs/paddlevit-predict-en.md was not present in this checkout; the available docs/paddlevit-predict-cn.md was used for the custom prediction boundary. The checked-in T2T export example also has an invalid name='x' placement in its InputSpec list and is explicitly treated as reference-only until fixed. Installed construction facts include passing Paddle Inference import, Paddle GPU 2.6.2, and a tiny CUDA smoke. This host required a private cuDNN runtime loader setup; that setup is intentionally not prescribed here.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351