pruna

PrunaAIApache-2.0活跃维护

面向开发者的模型优化框架,能对扩散模型、LLM、语音识别等模型做压缩加速,以极低改造成本换来更快、更省资源的推理。

Pruna is a model optimization framework built for developers, enabling you to deliver faster, more efficient models with minimal overhead.

v0.3.5发布于 2026-10-29 16:30 UTC1,382star +18 / 7 天125fork同步于 2026-11-10 11:48 UTC

怎么上手

由 README 提炼,执行前请确认
pip install pruna
硬件要求按 README 说明

README 未说明具体显存要求;安装时可选 CUDA toolkit 以支持 GPU,部分算法对操作系统有限制,可能并非所有平台可用。

需要 CUDA
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

一个面向开发者的模型优化框架,几行代码就能把模型压缩得更快更小更省

面向开发者的模型优化框架,能对扩散模型、LLM、语音识别等模型做压缩加速,以极低改造成本换来更快、更省资源的推理。

核心能力

  • 用 smash 函数一行代码组合多种优化算法
  • 内置缓存、量化、剪枝、蒸馏、编译等压缩算法
  • 支持 LLM、扩散模型、ViT、语音识别等多种模型
  • 提供评估接口量化优化后的质量与性能
  • 可组合多个算法以平衡速度、内存与质量

容易踩的坑

需要 Python 3.9 或更高版本;部分算法受操作系统限制,可能无法在所有平台使用;示例依赖 diffusers 等外部库加载基础模型。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.3.5
  1. v0.3.5最新正式版2026-10-29 · 2026-10-29 16:30 UTC

    The juiciest bits 🧃

    FP8 quantization lands in the garden 🌱

    This release brings two new FP8 quantization algorithms: a static one, and a time-aware one built for diffusion pipelines. Time-aware quantization already works with more pipelines, and there is a tutorial to walk you through both. All of it comes from @kfachikov, who joined us as a first-time contributor this release and did not slow down once!

    A new metric for the evaluation toolbox 📊

    Locking the garden gate 🔒

    We tightened security across the repo. Checkpoints now load with weights_only, GitHub Actions are pinned to commit SHAs, and dependency updates wait 7 days before we pick them up:

    Some Bug Fixing 🐞 and Maintenance

    Metric evaluation, device handling and diffusers pipelines all got a round of fixes:

    We also capped a few dependencies to keep installs stable, and kept the test suite up to date with new library versions:

    Documentation updates 📚

    A new tutorial shows how to measure the energy and emissions side of your optimized models:

    New Faces in the Garden 👩‍🌾

    Five first-time contributors this release, our biggest batch yet 💐

  2. v0.3.42026-06-22 · 2026-06-22 13:43 UTC
    查看更新说明

    The juiciest bits 🧃

    New algorithms joining the garden 🌱

    We added a fresh batch of algorithm support this release, and this one deserves an extra round of applause: all of these new algorithm additions came from external contributors! Huge thank you to @krishjp, @rensortino, and @kschwethelm for helping expand what Pruna can optimize and for bringing more community-built improvements into the repo

    Compatibility updates and pruning some old branches: ✂️

    Transformers 5 compatibility is here, TorchAO support now goes up to 0.17.0, and stable-fast wheel handling has been updated for newer Torch versions. At the same time, we cleaned up outdated or unreachable dependencies to keep installs smoother and more reliable:

    Some Bug Fixing 🐞 and Maintenance

    A lot of work went into making Pruna more stable across backends, datasets, compilation flows, and test environments:

    We’ve also continued improving the developer experience around CI, dependency handling, pre-commit checks, and test stability:

  3. v0.3.32026-04-23 · 2026-04-23 17:13 UTC
    查看更新说明

    The juiciest bits 🧃

    Algorithm & compatibility improvements ⚙️

    Lots of new tools for benchmarking and evaluation 📊

    Python 3.13 and pytorch 2.11 support is here 🐍

    Some Bug Fixing 🐞 and Maintenance

    We’ve made a bunch of improvements to make installing, testing, and developing locally faster and more reliable:

    We also updated our PR template and Readme for smoother contributions!:

    New Faces in the Garden 👩‍🌾

    Full Changelog: https://github.com/PrunaAI/pruna/compare/v0.3.2...v0.3.3

  4. v0.3.22026-03-09 · 2026-03-09 18:00 UTC
    查看更新说明

    It’s been almost a year since we open-sourced Pruna (time flies when you're compressing models ✨). Since then, the community has grown in ways we couldn’t have imagined, new contributors, new ideas, and so many improvements coming from all directions.

    To celebrate this milestone, we’ve started bringing more of the algorithms that previously lived in our closed-source stack into the open-source Pruna ecosystem. The goal is simple: give the community access to more of the tools we use internally so everyone can experiment, optimize, and build faster

    This release is a big step in that direction, with a whole wave of new algorithms joining the repo, along with stability improvements, compatibility fixes, and some nice quality-of-life upgrades.

    From all of us at Pruna: thank you for being part of this journey 💜 Let’s see what landed in v0.3.2 🔮

    The juiciest bits 🧃

    A whole garden of new algorithms 🌱

    The optimization ecosystem keeps growing with a new set of algorithm building blocks:

    feat: add distiller algorithm by @minettekaum in https://github.com/PrunaAI/pruna/pull/479

    feat: add pruner algorithm by @minettekaum in https://github.com/PrunaAI/pruna/pull/470

    feat: decoder algorithm by @minettekaum in https://github.com/PrunaAI/pruna/pull/444

    feat: add distributer algorithm by @minettekaum in https://github.com/PrunaAI/pruna/pull/459

    feat: add compilation algorithms by @minettekaum in https://github.com/PrunaAI/pruna/pull/443

    feat: add recoverer algorithms by @minettekaum in https://github.com/PrunaAI/pruna/pull/491

    feat: add enhancers algorithms by @minettekaum in https://github.com/PrunaAI/pruna/pull/469

    feat: Sage Attention Algorithm by @Marius-Graml in https://github.com/PrunaAI/pruna/pull/455

    More tutorials to help you get started 📚

    Getting started with Pruna just got easier thanks to new tutorials:

    docs/flux2-klein-tutorial: Flow changed in the tutorial by @minettekaum in https://github.com/PrunaAI/pruna/pull/522

    docs: moving three tutorials from Pruna Pro to Pruna by @minettekaum in https://github.com/PrunaAI/pruna/pull/539

    Algorithms are learning to play nicely together 🤝

    We also improved compatibility between algorithms and model configurations:

    feat: add disjoint algorithm compatibility by @gsprochette in https://github.com/PrunaAI/pruna/pull/520

    Pruning some bugs 🐞 and maintenance 👩‍🌾

    A lot of work went into improving stability, compatibility, and developer tooling:

    [CI] Use a Stable Cache Key to prevent warnings in gh-actions by @ParagEkbote in https://github.com/PrunaAI/pruna/pull/456

    fix: kernels version by @begumcig in https://github.com/PrunaAI/pruna/pull/504

    refactor: formalize artifact saving by @gsprochette in https://github.com/PrunaAI/pruna/pull/492

    ci: mark latest torchao as incompatible with latest diffusers by @gsprochette in https://github.com/PrunaAI/pruna/pull/528

    fix: filter out non reapplied algorithms in resmash by @gsprochette in https://github.com/PrunaAI/pruna/pull/525

    fix: change moe model for compatibility with earlier transformers versions by @gsprochette in https://github.com/PrunaAI/pruna/pull/533

    build: pin transformer<5.0.0 by @gsprochette in https://github.com/PrunaAI/pruna/pull/532

    ci: enforce pr title format via a github actions workflow by @SaboniAmine in https://github.com/PrunaAI/pruna/pull/538

    fix: align sage_attn default hyperparameter return type with refactor by @gsprochette in https://github.com/PrunaAI/pruna/pull/540

    fix: symmetric compatibility by @gsprochette in https://github.com/PrunaAI/pruna/pull/555

    test: extend fast cpu tests so tests default as cpu by @gsprochette in https://github.com/PrunaAI/pruna/pull/556

    build: update ty to v0.0.20 and align type-checking config by @rensortino in https://github.com/PrunaAI/pr

  5. v0.3.12026-01-23 · 2026-01-23 13:23 UTC
    查看更新说明

    This release is mainly about upgrading our minimum PyTorch and torch ecosystem versions ✨ After the bigger structural changes in v0.3.0, we focused on giving Pruna’s dependency stack a little glow-up, smoothing out compatibility issues and making CI more predictable across environments 💅🌸

    The juiciest bits 🧃:

    PyTorch & torch ecosystem upgrades

    • Minimum Python version bumped to 3.10
      by @ParagEkbote

    • Minimum PyTorch / torch stack upgraded, with careful pinning and unpinning by @gsprochette

    • fix: raise error for pytorch compatibility in gptq by @begumcig


    Evaluation & experimentation extras

    • KID metric added
      feat: Kid metric added by @minettekaum

    • Tiny datasets for lightweight experiments
      feat: add tiny datasets for lightweight experiments by @begumcig

    • MoE efficiency improvements, reduced number of experts per token
      feat: reduce nb experts per token in moe architectures by @llcnt


    Algorithm & SmashConfig improvements

    • Target modules extended to quantizers
      feat: add target modules to quantizers by @gsprochette

    • Flora extended to Flux, adding flora_backbone_calls_per_step
      feat: extended flora to flux by @try1233

    Pruning some bugs 🐞 & maintenance 👩‍🌾:

    New faces in the garden 💐

    We’re very excited to welcome a new Pruner to the team 💖✨

    • @try1233 recently joined Pruna and wasted absolutely no time jumping in! Already shipping features by extending Flora to Flux and making meaningful contributions from day one 🚀🌸
      Big “hit the ground running” energy.

    We also want to give a warm, sparkly shoutout to our very own first-time contributor 💫

    • @minettekaum made their first contribution by adding the KID metric to our evaluation suite 🧪💗

    We’re so happy to be building together 💖

    Full Changelog: https://github.com/PrunaAI/pruna/compare/v0.3.0...v0.3.1

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Simply make AI models faster, cheaper, smaller, greener!

    Documentation   Try our Performance Models

    GitHub License GitHub Actions Workflow Status GitHub Actions Workflow Status GitHub Release GitHub commit activity PyPI - Downloads Codacy

    Website X (formerly Twitter) URL Devto Reddit Discord Huggingface Replicate

    Introduction

    Pruna is a model optimization framework built for developers, enabling you to deliver faster, more efficient models with minimal overhead. It provides a comprehensive suite of compression algorithms including caching, quantization, pruning, distillation and compilation techniques to make your models:

    • Faster: Accelerate inference times through advanced optimization techniques
    • Smaller: Reduce model size while maintaining quality
    • Cheaper: Lower computational costs and resource requirements
    • Greener: Decrease energy consumption and environmental impact

    The toolkit is designed with simplicity in mind - requiring just a few lines of code to optimize your models. It supports various model types including LLMs, Diffusion and Flow Matching Models, Vision Transformers, Speech Recognition Models and more.

    Installation

    Pruna is currently available for installation on Linux, MacOS and Windows. However, some algorithms impose restrictions on the operating system and might not be available on all platforms.

    Before installing, ensure you have:

    • Python 3.9 or higher
    • Optional: CUDA toolkit for GPU support
    Option 1: Install Pruna using pip

    Pruna is available on PyPI, so you can install it using pip:

    pip install pruna
    
    Option 2: Install Pruna from source

    You can also install Pruna directly from source by cloning the repository and installing the package in editable mode:

    git clone https://github.com/PrunaAI/pruna.git
    cd pruna
    pip install -e .
    

    Quick Start

    Getting started with Pruna is easy-peasy pruna-squeezy!

    First, load any pre-trained model. Here's an example using Stable Diffusion:

    from diffusers import StableDiffusionPipeline
    base_model = StableDiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5")
    

    Then, use Pruna's smash function to optimize your model. Pruna provides a variety of different optimization algorithms, allowing you to combine different algorithms to get the best possible results. You can customize the optimization process using SmashConfig:

    from pruna import smash, SmashConfig
    
    # Create and smash your model
    smash_config = SmashConfig(["deepcache", "stable_fast"])
    smashed_model = smash(model=base_model, smash_config=smash_config)
    

    Your model is now optimized and you can use it as you would use the original model:

    smashed_model("An image of a cute prune.").images[0]
    

    You can then use our evaluation interface to measure the performance of your model:

    from pruna.evaluation.task import Task
    from pruna.evaluation.evaluation_agent import EvaluationAgent
    from pruna.data.pruna_datamodule import PrunaDataModule
    
    datamodule = PrunaDataModule.from_string("LAION256")
    datamodule.limit_datasets(10)
    task = Task("image_generation_quality", datamodule=datamodule)
    eval_agent = EvaluationAgent(task)
    eval_agent.evaluate(smashed_model)
    

    This was the minimal example, but you are looking for the maximal example? You can check out our documentation for an overview of all supported algorithms as well as our tutorials for more use-cases and examples.

    Algorithm Overview

    Since Pruna offers a broad range of optimization algorithms, the following table provides a high-level overview of all methods available in Pruna. For a detailed description of each algorithm, have a look at our documentation.

    TechniqueDescriptionSpeedMemoryQuality
    batcherGroups multiple inputs together to be processed simultaneously, improving computational efficiency and reducing processing time.✅❌➖
    cacherStores intermediate results of computations to speed up subsequent operations.✅➖➖
    compilerOptimizes the model with instructions for specific hardware.✅➖➖
    distillerTrains a smaller, simpler model to mimic a larger, more complex model.✅✅❌
    quantizerReduces the precision of weights and activations, lowering memory requirements.✅✅❌
    prunerRemoves less important or redundant connections and neurons, resulting in a sparser, more efficient network.✅✅❌
    recovererRestores the performance of a model after compression.➖➖✅
    factorizerFactorization batches several small matrix multiplications into one large fused operation.✅➖➖
    enhancerEnhances the model output by applying post-processing algorithms such as denoising or upscaling.❌➖✅
    distributerDistributes the inference, the model or certain calculations across multiple devices.✅❌➖
    kernelKernels are specialized GPU routines that speed up parts of the computation.✅➖➖

    ✅ (improves), ➖ (approx. the same), ❌ (worsens)

    FAQ and Troubleshooting

    If you can not find an answer to your question or problem in our documentation, in our FAQs or in an existing issue, we are happy to help you! You can either get help from the Pruna community on Discord, join our Office Hours or open an issue on GitHub.

    Contributors

    The Pruna package was made with 💜 by the Pruna AI team and our amazing contributors. Contribute to the repository to become part of the Pruna family!

    Contributors

    Citation

    If you use Pruna in your research, feel free to cite the project! 💜

    @misc{pruna,
        title = {Efficient Machine Learning with Pruna},
        year = {2023},
        note = {Software available from pruna.ai},
        url={https://www.pruna.ai/}
    }