Skip to main content

Easy-to-use and powerful NLP library with Awesome model zoo, supporting wide-range of NLP tasks from research to industrial applications, including Neural Search, Question Answering, Information Extraction and Sentiment Analysis end-to-end system.

Project description


News | Highlights | Installation | Quickstart | Community

PaddleFormers is a Transformer model library built on the PaddlePaddle deep learning framework, delivering both ease of use and high-performance capabilities. It provides a unified model definition interface, modular training components, and comprehensive distributed training strategies specifically designed for large language model development pipelines. This enables developers to train large models efficiently with minimal complexity, making it suitable for diverse scenarios ranging from academic research to industrial applications.

News

[2025/06/28] 🎉 PaddleFormers 0.1 is officially released! This initial version supports SFT/DPO training paradigms, configurable distributed training via unified Trainer API, and integrates PEFT, MergeKit, and Quantization APIs for diverse LLM applications.

Highlights

⚙️ Simplified Distributed Training

Implements 4D parallel strategies through unified Trainer API, lowering the barrier to distributed LLM training.

🛠 Efficient Post-Training

Integrates Packing dataflow and FlashMask operators for SFT/DPO training, eliminating padding waste and boosting throughput.

💾 Industrial Storage Solution

Features Unified Checkpoint storage tools for LLMs, enabling training resumption and dynamic resource scaling. Additionally implements asynchronous storage (up to 95% faster) and Optimizer State Quantization (78% storage reduction), ensuring industrial training meets both efficiency and stability requirements.

Installation

Requires Python 3.10+

# Install via source code
git clone https://github.com/PaddlePaddle/PaddleFormers.git
cd PaddleFormers

# If you don’t need to train models, you can install only the lightweight basic version of paddleformers.
pip install -e .

# If you need to train models, you should install paddleformers with paddlefleet
# cuda12.6
pip install -e '.[paddlefleet]'  --extra-index-url https://www.paddlepaddle.org.cn/packages/nightly/cu126/
# cuda12.9
pip install -e '.[paddlefleet]'  --extra-index-url https://www.paddlepaddle.org.cn/packages/nightly/cu129/
# cuda13.0
pip install -e '.[paddlefleet]'  --extra-index-url https://www.paddlepaddle.org.cn/packages/nightly/cu130/

Quickstart

Text Generation

This example shows how to load Qwen model for text generation with PaddleFormers Auto API:

from paddleformers.transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-0.6B-Base")
model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-0.6B-Base", dtype="bfloat16", convert_from_hf=True).eval()
input_features = tokenizer("Give me a short introduction to large language model.", return_tensors="pd")
outputs = model.generate(**input_features, max_new_tokens=128)
print(tokenizer.batch_decode(outputs[0], skip_special_tokens=True))

SFT Training

Getting started with supervised fine-tuning (SFT) using PaddleFormers:

paddleformers-cli train examples/config/sft/full.yaml

Community

We welcome all contributions! See CONTRIBUTING.md for guidelines.

License

This repository's source code is available under the Apache 2.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

paddleformers-1.0.0-py3-none-any.whl (1.9 MB view details)

Uploaded Python 3

File details

Details for the file paddleformers-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: paddleformers-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for paddleformers-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6cb9afb26265b072d103e995e8048b669cb6d393c2f36734236d2328d11652dd
MD5 0ba342a720827f0ee627d6e7d6441477
BLAKE2b-256 7a93dccb268be1e68238b5e907eed27d230c2e2e491fe95824a7b74aeed6fbed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page