export

Convert PyTorch models to .pte format for ExecuTorch deployment.

4.9k|1.1k|Updated Feb 25, 2022
One-click install
npx skills add https://github.com/pytorch/executorch --skill export-pytorch
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: export
Source: https://github.com/pytorch/executorch/tree/main/.claude/skills/export
Command: npx skills add https://github.com/pytorch/executorch --skill export-pytorch

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Convert PyTorch models into a compact edge artifact (.pte) to enable fast, private on-device inference with ExecuTorch, by bridging model export and deployment workflows.

Core Features & Use Cases

  • Export a PyTorch model to the .pte edge format using the standard export flow.
  • Lower and transform the exported program for edge deployment via to_edge_transform_and_lower.
  • Generate and persist the .pte file for embedded or mobile environments; supports typical models such as vision and NLP.

Quick Start

Run a minimal export with a sample model and example_inputs to produce model.pte.

Frequently Asked Questions about export

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

FAQPage Schema
How do I convert a PyTorch model to .pte format for edge deployment?▼

To convert a PyTorch model to .pte format for edge deployment, use the standard export flow with torch.export and to_edge_transform_and_lower, then write the edge artifact to a .pte file for on-device inference.

What is the .pte file format used for in on-device inference?▼

The .pte file format is a compact edge artifact used to enable fast, private on-device inference with ExecuTorch across mobile and embedded platforms, bridging model export and deployment workflows.

Do I need to call model.eval() before exporting to .pte?▼

Yes, calling model.eval() before exporting to .pte is required to ensure correct inference behavior during the export process and when generating the edge artifact for on-device deployment.

Can I export vision and NLP PyTorch models for mobile and embedded platforms?▼

Yes, you can export typical vision and NLP PyTorch models to the .pte edge format for mobile and embedded platforms using example_inputs and the to_edge_transform_and_lower workflow.

What is the best way to lower an exported PyTorch program for edge devices?▼

The best way to lower an exported PyTorch program for edge devices is using the to_edge_transform_and_lower function, which transforms and lowers the model to generate a persistent .pte edge artifact.

Why do I need example_inputs to export a PyTorch model to the .pte format?▼

Example_inputs are required during torch.export to trace the PyTorch model's execution graph, ensuring the exported program is correctly shaped before lowering to the .pte edge format.