writing-skills
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
deployment-servingExport, optimize, validate, and serve Lightning models for prediction and production with checkpoints, pure PyTorch, TorchScript, ONNX, torch.export, pruning/quantization, and ServableModule flows.
Independent GitHub snapshot · Automated classification · Original documentation governs
Use this sub-skill when the task is about prediction-only scripts, checkpoint loading for inference, removing Lightning from a production artifact, model export, inference optimization, or validating a lightning.pytorch.serve model before deployment.
Trainer.predict, direct model(x) inference, pure torch.nn.Module, torch.export, ONNX, TorchScript, quantization/pruning, or ServableModule validation.MyModule.load_from_checkpoint("model.ckpt"), call model.eval(), and run under torch.no_grad() or torch.inference_mode().forward; put dataloader-aware prediction logic, preprocessing, postprocessing, or Monte Carlo prediction in predict_step.Trainer.predict(model, dataloaders=..., return_predictions=...) when Lightning should own batching/devices; use pure PyTorch when the production runtime should not depend on Lightning.python sub-skills/deployment-serving/scripts/servable_smoke.py --help to validate that the bundled serving example is available without starting a long-lived server.torch.export, pruning/quantization, or lightning.pytorch.serve: stay in this sub-skill.../training-core/SKILL.md.../distributed-accelerators/SKILL.md.LightningCLI, YAML config, parser subclasses, or CLI wiring around deployment scripts: route to ../cli-configuration/SKILL.md.references/serving-reference.md: prediction APIs, checkpoint inference, ServableModule, ServableModuleValidator, and safe serving validation workflow.references/export-workflows.md: pure PyTorch conversion, torch.export, ONNX, TorchScript, TensorRT positioning, pruning, and quantization choices.references/troubleshooting.md: import/install failures, optional serving dependencies, validator misconfiguration, backend/hardware limits, and prediction/export failure signals.scripts/servable_smoke.py: tiny self-contained ServableModule shape/serialization smoke with --help, --check-shape, and optional one-shot validator mode.python sub-skills/deployment-serving/scripts/servable_smoke.py --help
python sub-skills/deployment-serving/scripts/servable_smoke.py --check-shape
Expected signal: the help command prints options; the shape check imports Lightning and Torch, constructs a tiny ServableModule, validates payload serialization and serve_step, and prints SERVABLE_SMOKE_OK. The optional validator mode may require fastapi, uvicorn, requests, and a free localhost port.