Diffusers库安装

diffusers 是由 Hugging Face团队开发并维护的开源 Python 库,专门用于加载、使用和定制扩散模型(Diffusion Models),聚焦于生成式 AI 领域(如图像生成、文生图、图生图等)。

它的核心定位是:降低扩散模型的使用门槛 ------ 不需要从零实现复杂的扩散算法,实现简单调用 Stable Diffusion、DALL-E 类的扩散模型,同时也支持研究者对模型进行定制和扩展。

在安装diffusers库也遇到了一些问题,这里做一个安装顺序记录:

参考diffusers安装教程https://huggingface.co/docs/diffusers/installation?install=conda

diffusers库支持:Python 3.8+ and PyTorch 1.4+

(1)创建虚拟环境:

python 复制代码
conda create -n diffusion_env python=3.9

(2)安装pytorch

python 复制代码
conda install pytorch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 pytorch-cuda=11.8 -c pytorch -c nvidia

(3)安装diffusers库(利用conda安装):

python 复制代码
conda install -c conda-forge diffusers

安装后遇到numpy兼容报错问题,解决方法见这篇博文

导出requirements.txt文件:

python 复制代码
# 导出所有包(包括系统级包)
pip freeze > requirements.txt

# 导出当前虚拟环境中的包
pip list --format=freeze > requirements.txt
复制代码
datasets==4.4.2
diffusers==0.35.2
huggingface_hub==0.34.4
matplotlib==3.6.0
numpy==1.26.4
pandas==2.3.3
pillow==11.3.0
torch==2.1.1
torchaudio==2.1.1
torchvision==0.16.1
相关推荐
西岸行者5 天前
学习笔记:SKILLS 能帮助更好的vibe coding
笔记·学习
starlaky5 天前
Django入门笔记
笔记·django
勇气要爆发5 天前
吴恩达《LangChain LLM 应用开发精读笔记》1-Introduction_介绍
笔记·langchain·吴恩达
悠哉悠哉愿意5 天前
【单片机学习笔记】串口、超声波、NE555的同时使用
笔记·单片机·学习
勇气要爆发5 天前
吴恩达《LangChain LLM 应用开发精读笔记》2-Models, Prompts and Parsers 模型、提示和解析器
android·笔记·langchain
qianshanxue115 天前
计算机操作的一些笔记标题
笔记
土拨鼠烧电路5 天前
笔记11:数据中台:不是数据仓库,是业务能力复用的引擎
数据仓库·笔记
土拨鼠烧电路5 天前
笔记14:集成与架构:连接孤岛,构建敏捷响应能力
笔记·架构
烟花落o5 天前
栈和队列的知识点及代码
开发语言·数据结构·笔记·栈和队列·编程学习