PEFT documentation

安装

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

安装

在开始之前,您需要配置环境、安装相应的包并设置 🤗 PEFT。🤗 PEFT 已在 Python 3.11+ 上经过测试。

🤗 PEFT 可在 PyPI 和 GitHub 上获取:

PyPI

要从 PyPI 安装 🤗 PEFT:

pip install peft

CUDA Windows Arm64

要在 Windows Arm64 上(例如 NVIDIA RTX Spark 笔记本电脑)使用 PyTorch CUDA 安装 PEFT,请从 NVIDIA PyPI 索引安装 PyTorch。这些设备需要 NVIDIA 提供的 Windows Arm64 版 PyTorch 构建,而默认 PyPI 索引或标准 PyTorch wheel 索引中并不提供这些构建。

运行以下命令以检查您的系统是否检测到 NVIDIA GPU。

nvidia-smi

从 NVIDIA PyPI 索引安装 PyTorch,然后安装 PEFT。

pip install torch --index-url https://pypi.nvidia.com/nvtorch_oot_nightly
pip install peft

源代码

尚未发布的新功能每天都在添加,这也意味着可能存在一些 bug。如需试用,请从 GitHub 仓库安装:

pip install git+https://github.com/huggingface/peft

如果您希望操作源代码并在运行代码时查看实时结果,可以从本地克隆的仓库安装可编辑版本:

git clone https://github.com/huggingface/peft
cd peft
pip install -e ".[test]"

如果您计划为 PEFT 做出贡献,请遵循 贡献指南,其中还涵盖了创建 fork、添加上游远程仓库以及创建工作分支的内容。

Update on GitHub