登录 注册
AI 模型与开发框架内容创作与媒体工具数据分析与数据处理 adapterdiffusionfine-tuningllmloraparameter-efficient-learning
21,882
Stars
2,657
Forks
114
Watchers
110
Open Issues
Apache-2.0
许可证
Python
语言
2022-11-25
创建时间
2026-11-11
最近更新

项目能做什么

Hugging Face 推出的参数高效微调(PEFT)库,助你低成本微调大模型。
来源:AI 基于仓库事实生成 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
<!---
Copyright 2023 The HuggingFace Team. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<h1 align="center"> <p>🤗 PEFT</p></h1>
<h3 align="center">
    <p>State-of-the-art Parameter-Efficient Fine-Tuning (PEFT) methods</p>
</h3>

Fine-tuning large pretrained models is often prohibitively costly due to their scale. Parameter-Efficient Fine-Tuning (PEFT) methods enable efficient adaptation of large pretrained models to various downstream applications by only fine-tuning a small number of (extra) model parameters instead of all the model's parameters. This significantly decreases the computational and storage costs. Recent state-of-the-art PEFT techniques achieve performance comparable to fully fine-tuned models.

PEFT is integrated with Transformers for easy model training and inference, Diffusers for conveniently managing different adapters, and Accelerate for distributed training and inference for really big models.

> [!TIP]
> Visit the [PEFT](https://huggingface.co/PEFT) organization to read about the PEFT methods implemented in the library and to see notebooks demonstrating how to apply these methods to a variety of downstream tasks. Click the "Watch repos" button on the organization page to be notified of newly implemented methods and notebooks!

Check the PEFT Adapters API Reference section for a list of supported PEFT methods, and read the [Adapters](https://huggingface.co/docs/peft/en/conceptual_guides/adapter), [Soft prompts](https://huggingface.co/docs/peft/en/conceptual_guides/prompting), and [IA3](https://huggingface.co/docs/peft/en/conceptual_guides/ia3) conceptual guides to learn more about how these methods work.

## Quickstart

Install PEFT from pip:

```bash
pip install peft
```

Prepare a model for training with a PEFT method such as LoRA by wrapping the base model and PEFT configuration with `get_peft_model`. For the bigscience/mt0-large model, you're only training 0.19% of the parameters!

```python
import torch
from transformers import AutoModelForCausalLM
from peft import LoraConfig, TaskType, get_peft_model

device = torch.accelerator.current_accelerator().type if hasattr(torch, "accelerator") else "cuda"
model_id = "Qwen/Qwen2.5-3B-Instruct"
model = AutoModelForCausalLM.from_pretrained(model_id, device_map=device)
peft_config = LoraConfig(
    r=16,
    lora_alpha=32,
    task_type=TaskType.CAUSAL_LM,
    # target_modules=["q_proj", "v_proj", ...]  # optionally indicate target modules
)
model = get_peft_model(model, peft_config
阅读完整原文

商业机会分析 AI 生成

Multi-LoRA 动态推理与网关调度服务

产品构想构建一套基于 PEFT/LoRA 权重的多租户动态加载推理中间件,基座模型常驻显存,依据请求实时热挂载不同的 LoRA 适配器。
核心功能LoRA 适配器冷热缓存调度、高并发请求动态批处理(Dynamic Batching)、多适配器显存池化管理、兼容 OpenAI 协议的 LoRA 路由 API。
目标用户提供个性化/定制化 Agent、行业细分问答等需要为不同客户维护专属 LoRA 的 SaaS 厂商和 AI 创业团队。
难度/周期高 · 2 - 3 个月 · 成本:中等(需租赁主流云 GPU 如 A10G/A100 进行高并发压测与调度算法调优)
收费模式开源核心引擎 + 企业版功能授权(如 SLA 保障、RBAC 权限管理),或云端 Serverless 托管按请求量计费。
竞争风险开源推理引擎(如 vLLM、S-LoRA)正在逐步原生集成多 LoRA 推理,面临底层基础设施直接降维竞争风险(AI推测)。
依据 已验证事实

无代码/低门槛 PEFT 微调与评测轻量化平台

产品构想针对缺少深度学习工程经验的业务人员或小团队,封装 PEFT 工作流,提供从数据标注配比、LoRA 参数自动化推荐到效果评测的一体化 SaaS。
核心功能拖拽式数据集配置与清洗、PEFT 自动超参寻优(Auto-LoRA)、微调前后 Benchmark 自动化对比评测、一键导出/合并模型权重。
目标用户中小企业开发者、传统业务系统集成的软件开发商、垂直行业领域专家。
难度/周期中等 · 1 - 2 个月 · 成本:低至中等(前期可集成现成算力云 API 如 Modal、RunPod,避免自建算力池沉没成本)
收费模式算力加价模式 + 订阅制(按月/按席位收取高级评测与私有化存储费用)。
竞争风险各大云厂商(如 AWS Bedrock、阿里云百炼)均在做类似低代码微调工具,市场面临同质化竞争(AI推测)。
依据 数据支持的判断

私有化 LoRA 模型资产库与合规扫描平台 (Adapter Hub)

产品构想专为企业级应用设计的轻量化适配器版本控制与资产管理系统,提供安全审计、差分权重合并(Merge)与发布管理。
核心功能PEFT 权重差分存储与版本回滚、模型投毒/越狱等安全微调风险扫描、多种 LoRA 融合(TIES-Merging/DARE)可视化编排、内网离线分发权限控制。
目标用户有数据合规要求、多模型实验迭代的大中型企业算法团队及风控部门。
难度/周期中等 · 1.5 - 2 个月 · 成本:低(主要为常规 Web 全栈架构开发及基础安全测试资源)
收费模式软件私有化部署授权费、企业年度维护及技术支持订阅费。
竞争风险中大型企业自研意愿可能较强,且纯安全扫描工具的标准尚未完全成熟(尚需验证的假设)。
依据 尚需验证的假设
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

项目中文简介Stars语言
CymChad/BaseRecyclerViewAdapterHelper 中文介绍暂未生成
BRVAH:Powerful and flexible RecyclerAdapter
24,562 Kotlin
cfug/dio 中文介绍暂未生成
A powerful HTTP client for Dart and Flutter, which supports
12,843 Dart
mfussenegger/nvim-dap 中文介绍暂未生成
Debug Adapter Protocol client implementation for Neovim
7,302 Lua
alibaba/fish-redux 中文介绍暂未生成
An assembled flutter application framework.
7,258 Dart
tencent-ailab/IP-Adapter 中文介绍暂未生成
The image prompt adapter is designed to enable a pretrained
6,713 Jupyter Notebook
Lightning-AI/lit-llama 中文介绍暂未生成
Implementation of the LLaMA language model based on nanoGPT.
6,079 Python
以上为通过 GitHub 官方 Search API 检索的相似项目,功能差异与优劣势需进一步人工确认,配置 AI 后可生成对比分析。

项目优势与风险

技术成熟度创建于 2022-11-25,近 30 天仍在推送,发布过 36 个 Release
社区活跃Star 21,882 / Fork 2,657 / Issue 110(数据支持,可自行核实)
许可证Apache-2.0
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

快速开始(以仓库 README 为准)
git clone https://github.com/huggingface/peft.git
cd peft
# 请阅读仓库 README 获取确切安装步骤(依赖、配置、启动命令)
阅读原仓库文档
术语说明:Docker=应用容器(把程序和依赖打包运行);API Key=调用外部服务的密钥;Git Clone=把仓库代码下载到本地。常见错误:API Key 未配置 / 端口占用 / 数据库连接失败,多数项目在 README 的 Troubleshooting 章节有说明。