Skip to content
Back to skills

Deployment Serving

ASecurity

"Export, optimize, validate, and serve Lightning models for

  • 247 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 8, 2026
toolspythonbashfastapiapibackend

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill deployment-serving --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Deployment Serving?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Deployment Serving
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-deployment-serving/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-deployment-serving)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: deployment-serving
description: "Export, optimize, validate, and serve Lightning models for
  prediction and production with checkpoints, pure PyTorch, TorchScript, ONNX,
  torch.export, pruning/quantization, and ServableModule flows."
disable-model-invocation: true
metadata:
  disco-role: operating
license: Apache 2.0
---

# Lightning Deployment Serving

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.

## Start Here

1. Choose the deployment route before editing code: Lightning `Trainer.predict`, direct `model(x)` inference, pure `torch.nn.Module`, `torch.export`, ONNX, TorchScript, quantization/pruning, or `ServableModule` validation.
2. For Lightning inference, load with `MyModule.load_from_checkpoint("model.ckpt")`, call `model.eval()`, and run under `torch.no_grad()` or `torch.inference_mode()`.
3. Put request-independent inference math in `forward`; put dataloader-aware prediction logic, preprocessing, postprocessing, or Monte Carlo prediction in `predict_step`.
4. Use `Trainer.predict(model, dataloaders=..., return_predictions=...)` when Lightning should own batching/devices; use pure PyTorch when the production runtime should not depend on Lightning.
5. Run `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.

## Route Tasks

- Prediction loops, checkpoint inference, pure PyTorch extraction, ONNX/TorchScript/`torch.export`, pruning/quantization, or `lightning.pytorch.serve`: stay in this sub-skill.
- Training a model or creating checkpoints from scratch: route to `../training-core/SKILL.md`.
- Distributed production training, strategy selection, GPU/TPU/MPS/FSDP/DeepSpeed behavior, or hardware launch issues: route to `../distributed-accelerators/SKILL.md`.
- `LightningCLI`, YAML config, parser subclasses, or CLI wiring around deployment scripts: route to `../cli-configuration/SKILL.md`.

## References

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

## Quick Validation

```bash
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.

Files in this skill

  • SKILL.md3.2 KB
  • references/export-workflows.md8 KB
  • references/serving-reference.md8.3 KB
  • references/troubleshooting.md8.2 KB
  • scripts/servable_smoke.py4.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.