pytorch-deployment

Export PyTorch models to TorchScript and ONNX for deployment.

19|2|Updated Jan 31, 2026
One-click install
npx skills add https://github.com/tondevrel/scientific-agent-skills --skill pytorch-deployment
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytorch-deployment
Source: https://github.com/tondevrel/scientific-agent-skills/tree/main/skills/pytorch-deployment
Command: npx skills add https://github.com/tondevrel/scientific-agent-skills --skill pytorch-deployment

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill bridges the gap between developing PyTorch models and deploying them in production environments, enabling efficient inference and integration into various applications.

Core Features & Use Cases

  • Model Serialization: Export models using TorchScript (JIT/Tracing) for standalone execution.
  • Cross-Platform Export: Convert models to ONNX format for use with ONNX Runtime and other accelerators.
  • Inference Optimization: Apply techniques like quantization to reduce model size and improve speed.
  • C++ Integration: Utilize LibTorch for deploying models in C++ applications.
  • Use Case: You've trained a PyTorch image classification model and need to deploy it as a high-performance API service or embed it within a C++ desktop application.

Quick Start

Use the pytorch-deployment skill to export the current PyTorch model to TorchScript format.

Frequently Asked Questions about pytorch-deployment

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I deploy a PyTorch model to production using TorchScript?

Deploy PyTorch models to production by serializing them via TorchScript using JIT or tracing, enabling standalone execution without Python dependencies for high-performance inference.

What is the best way to optimize PyTorch inference speed and reduce model size?

Optimize PyTorch inference speed and reduce model size by applying quantization and pruning techniques, which streamline the model for faster execution in production environments.

Can I export a PyTorch model to ONNX for cross-platform compatibility?

Yes, you can export PyTorch models to ONNX format to achieve cross-platform compatibility, allowing execution with ONNX Runtime and various hardware accelerators.

How do I load and run a trained PyTorch model in a C++ application?

Load and run trained PyTorch models in C++ applications by utilizing LibTorch, which facilitates direct integration and inference execution within C++ production environments.

When should I use TorchScript vs ONNX export for PyTorch model deployment?

Use TorchScript for standalone execution within the PyTorch ecosystem or C++ via LibTorch, and use ONNX export when targeting cross-platform compatibility with ONNX Runtime accelerators.

Does this PyTorch deployment workflow support running inference on edge devices?

Yes, the deployment workflow supports inference on edge devices by leveraging model serialization, ONNX export, and optimization techniques like quantization for resource-constrained environments.