$npx skillfedfor your agent

pytorch-deployment

Move trained PyTorch models from notebooks to production environments by mastering serialization formats like TorchScript (via tracing or scripting) and ONNX export. Learn quantization and pruning strategies to shrink model size and accelerate inference across C++, mobile, and edge devices.

PyTorch Deployment helps you serialize and optimize models for production using TorchScript, ONNX, and quantization.

AI-generated summary based on this skill's SKILL.md

19 2 MITupdated by tondevrel

Decision gist · record as of 2026-02-01

PyTorch Deployment helps you serialize and optimize models for production using TorchScript, ONNX, and quantization. Move trained PyTorch models from notebooks to production environments by mastering serialization formats like TorchScript (via tracing or scripting) and ONNX export. Learn quantization and pruning strategies to shrink model size and accelerate inference across C++, mobile, and edge devices.

manual: git clone https://github.com/tondevrel/scientific-agent-skills → cp -r scientific-agent-skills/skills/pytorch-deployment ~/.claude/skills/pytorch-deployment
skills/pytorch-deployment/SKILL.md · version eb189dc7

Use it when

  • pytorch-deployment explains that TorchScript tracing records tensor operations by running your model once with sample inputs.
  • pytorch-deployment covers ONNX export as a key serialization strategy for cross-platform inference.

Verify before relying

Read SKILL.md below before installing (1 file). Open directory: indexed for reading, not audited.

Same gist for agents: .md · .json

Install

tondevrel/scientific-agent-skills/pytorch-deployment

Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do you deploy PyTorch models to production?

pytorch-deployment teaches you to move trained models from notebooks into production by mastering serialization formats like TorchScript and ONNX export. The skill covers exporting models for C++ inference via libtorch, deploying to mobile and edge devices, and optimizing through quantization and pruning to reduce size and accelerate inference speed.

What's the difference between TorchScript tracing vs scripting?

pytorch-deployment explains that TorchScript tracing records tensor operations by running your model once with sample inputs, capturing the execution graph—ideal for models with fixed control flow. Scripting, by contrast, parses Python code directly into TorchScript, preserving dynamic control flow and loops, making it better for models with conditional logic.

How do you export a PyTorch model to ONNX format?

pytorch-deployment covers ONNX export as a key serialization strategy for cross-platform inference. You use torch.onnx.export() to convert your model into the ONNX interchange format, enabling deployment in non-Python environments and runtime engines like ONNX Runtime, TensorRT, and others without requiring PyTorch.

What quantization techniques reduce PyTorch model size?

pytorch-deployment teaches quantization strategies—particularly INT8 quantization—to shrink model size and boost inference speed. These techniques reduce floating-point weights and activations to lower precision, cutting memory footprint and latency on edge and mobile devices while maintaining acceptable accuracy.

How can you run PyTorch inference without Python?

pytorch-deployment shows how to deploy neural networks in non-Python environments using libtorch (C++ API) or ONNX Runtime. Export your model via TorchScript or ONNX, then load and run inference in C++, mobile apps, or edge platforms like Jetson, eliminating the Python runtime dependency.

What's the best approach for PyTorch mobile deployment?

pytorch-deployment covers mobile optimization by combining serialization (TorchScript export), quantization to reduce model size, and the PyTorch Mobile interpreter for efficient on-device inference. These techniques enable fast, lightweight model execution on smartphones and embedded devices with limited compute and memory.

SKILL.md

Rendered from the published skill. Quoted content, verbatim.

PyTorch - Deployment & Production Engineering

Deploying a model in a high-performance environment often means removing the Python dependency. This guide covers how to serialize models into formats that can be loaded in C++, optimized for edge devices, or executed in high-throughput inference engines like TensorRT.

When to Use

  • Moving a model from a Jupyter Notebook to a production web server (FastAPI/Go/Rust).
  • Embedding a neural network into a C++ application (LibTorch).
  • Running inference on mobile devices (iOS/Android) or edge hardware (NVIDIA Jetson).
  • Accelerating inference speed using specialized hardware backends (OpenVINO, TensorRT).
  • Ensuring model reproducibility across different versions of PyTorch.

Core Principles

1. Scripting vs. Tracing
  • Tracing: PyTorch runs the model once with "example data" and records all operations. Fast, but ignores Python control flow

(truncated - see the full file via the links below)

File tree — 1 file
skills/pytorch-deployment/SKILL.md

Let your AI agent find skills like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.

wish › “Export and serialize PyTorch models for production deployment”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

Deep Learning
by pluginagentmarketplace · pluginagentmarketplace/custom-plugin-data-engineer

Master production-grade deep learning using PyTorch, covering neural architectures, transformer models, and optimization techniques. Learn training best practices including mixed precision, gradient management, and deployment strategies for real-world applications.

no license declared → metadata onlyupdated Jan 2026
★ 4repo stars
Matlab Import External Ai Model
by matlab · matlab/matlab-agentic-toolkit

Bring trained deep learning models from PyTorch, ONNX, or Keras into MATLAB as dlnetwork objects. The skill handles .pt2 exported programs, traced .pt files, .onnx models, and Keras 3 files, with guidance on input sizing, custom layer implementation, and numeric verification against source frameworks.

no license declared → metadata onlyupdated Jul 2026
★ 841repo stars
Matlab Deploy Embedded Ai
by matlab · matlab/matlab-agentic-toolkit

Generate production C and CUDA code from neural networks for resource-constrained embedded devices. This skill covers model import from PyTorch, ONNX, and TensorFlow, compression via quantization and pruning, and Simulink integration for system-level verification before deployment to ARM Cortex and x86 targets.

no license declared → metadata onlyupdated Jul 2026
★ 841repo stars
Matlab Deploy Ai Model
by matlab · matlab/matlab-agentic-toolkit

This skill guides you through converting AI models into deployable C/C++ or CUDA code using MATLAB Coder or GPU Coder. It covers the complete workflow from loading PyTorch ExportedProgram (.pt2) or LiteRT models, writing entry-point functions, generating MEX for verification, and producing production libraries or executables for hardware integration.

no license declared → metadata onlyupdated Jul 2026
★ 841repo stars
pytorch-lightning
by K-Dense-AI · K-Dense-AI/scientific-agent-skills

PyTorch Lightning eliminates boilerplate by structuring PyTorch models into LightningModules with built-in support for multi-device training, callbacks, and experiment tracking. Configure Trainers for distributed strategies like DDP and FSDP, organize data pipelines with LightningDataModules, and integrate logging via TensorBoard, Weights & Biases, or MLflow.

MITupdated Jul 2026
★ 31,940repo stars
pytorch-lightning
by foryourhealth111-pixel · foryourhealth111-pixel/Vibe-Skills

PyTorch Lightning eliminates boilerplate by structuring PyTorch projects into reusable LightningModules, automated Trainers, and data pipelines. Scale training across multiple GPUs or TPUs using strategies like DDP, FSDP, and DeepSpeed, with built-in support for callbacks, experiment logging, and best practices.

Apache-2.0updated Jul 2026
★ 2,494repo stars
Tags
model-serializationinference-optimizationcross-platform-deploymentedge-computingproduction-readinesshardware-accelerationmodel-compressionruntime-performance