HubLensPaddlePaddlePaddlePaddle/PaConvert
// archived 2026-04-11
PaddlePaddle

PaConvert

AI#PaddlePaddle#PyTorch#Deep Learning#Model Migration#Automation
View on GitHub
125

// summary

This tool is officially maintained by Paddle and aims to achieve efficient automated migration from PyTorch code to PaddlePaddle code. It supports one-click conversion of over 1,600 PyTorch APIs and 200 torchvision APIs, maintaining an average conversion rate of over 95% in tests. The conversion process is operated via the command line, preserves the style and structure of the original code, and provides detailed conversion logs and summaries.

// technical analysis

PaConvert is an automated code migration tool maintained by the official PaddlePaddle team, designed to address the pain points for deep learning developers migrating from PyTorch to the PaddlePaddle framework. Based on a comprehensive API mapping table, the tool performs code conversion through static analysis, achieving a high automated conversion rate while maintaining the original project structure and style. Its core design trade-off lies in automating the majority of API mappings to free developers from tedious low-level code refactoring, requiring them to handle only a very small number of APIs that cannot be automatically converted, thereby significantly improving model migration efficiency.

// key highlights

01
Supports one-click automated conversion for over 1600 PyTorch APIs and 200 torchvision APIs.
02
In tests across more than 100 real-world codebases, the average conversion rate for lines of code exceeds 95%, substantially reducing manual migration costs.
03
Features extremely high conversion speed, with processing efficiency of no less than 2000 lines of code per second.
04
The conversion process adopts a non-intrusive design, ensuring the original codebase remains unaffected by specifying an output directory.
05
Provides a detailed conversion summary report, automatically marking unsupported APIs and prompting with specific symbols to facilitate targeted manual fixes by developers.
06
Has been successfully verified and supports the migration of inference code for mainstream large language models such as Llama and Qwen.

// use cases

01
Automatically convert PyTorch deep learning model code to PaddlePaddle framework code
02
Support one-click migration of inference code for large language models (such as Llama and Qwen)
03
Provide conversion progress monitoring, API mapping analysis, and automatic tagging of unsupported APIs

// getting started

Developers can quickly install the tool using the command pip install -U paconvert. Once installed, use paconvert -i <input_directory> -o <output_directory> to start the conversion task. During the conversion process, you can configure log levels or exclude specific files as needed; after completion, please check the code lines marked with >>> in the output directory and perform manual adaptations.