MLU运行Stable Diffusion WebUI Forge【flux】

文章目录


FLUX模型是由Black Forest Labs推出的一款文本生成图像的AI模型,具有120亿参数,显著提升了图像生成的质量和多样性‌。FLUX模型包含三个版本:FLUX.1 pro、FLUX.1 dev和FLUX.1 schnell,分别针对不同的使用场景和需求。‌

‌FLUX.1 pro‌:这是FLUX的最强版本,专为商业用途设计,提供最先进的图像生成性能,包括顶级的提示词遵循、视觉质量和输出多样性。它是一个闭源模型,需要通过API获取访问权限。

‌FLUX.1 dev‌:这是一个开源的引导蒸馏模型,适用于非商业应用。它从FLUX.1 pro蒸馏而来,具有类似的质量和提示词遵循能力,同时比同等大小的标准模型更高效。

‌FLUX.1 schnell‌:这是响应速度最快的模型,专为本地开发和个人使用设计。它在Apache 2.0许可下公开获取,权重可以在Hugging Face上找到,代码可以在GitHub和Hugging Face的Diffusers中找到。

一、平台环境准备

镜像选择:pytorch:v24.10-torch2.4.0-torchmlu1.23.1-ubuntu22.04-py310

卡选择:任意一款MLU3系列及以上卡

二、代码下载

bash 复制代码
git clone https://githubfast.com/lllyasviel/stable-diffusion-webui-forge.git

三、基础环境准备

此处是修改过的requiment.txt,原因是剔除torch库,不让版本随意改动

bash 复制代码
setuptools==69.5.1  # temp fix for compatibility with some old packages
GitPython==3.1.32
Pillow==9.5.0
accelerate==0.21.0
blendmodes==2022
clean-fid==0.1.35
diskcache==5.6.3
einops==0.4.1
facexlib==0.3.0
fastapi==0.104.1
gradio==4.40.0
httpcore==0.15
inflection==0.5.1
jsonmerge==1.8.0
kornia==0.6.7
lark==1.1.2
numpy==1.26.2
omegaconf==2.2.3
open-clip-torch==2.20.0
piexif==1.1.3
protobuf==3.20.0
psutil==5.9.5
resize-right==0.0.2
safetensors==0.4.2
scikit-image==0.21.0
spandrel==0.3.4
spandrel-extra-arches==0.1.1
tomesd==0.1.3
transformers==4.46.1
torchdiffeq==0.2.5
httpx==0.24.1
pillow-avif-plugin==1.4.3
torchsde==0.2.6
diffusers==0.31.0
gradio_rangeslider==0.0.6
gradio_imageslider==0.0.20
loadimg==0.1.2
tqdm==4.66.1
peft==0.13.2
pydantic==2.8.2
huggingface-hub==0.26.2
huggingface_guess

3.1 支援whl包

bash 复制代码
cambricon_pytorch_lightning-2.4.0+mlu0.6.0-py3-none-any.whl
diffusers_mlu-0.3.0+diffusers0.30.1-py3-none-any.whl

四、代码修改

webui.py的前添加

python 复制代码
import torch
import torch_mlu
import torch_mlu.utils.gpu_migration#注意前三行
import diffusers_mlu

4.2 组件下载

bash 复制代码
mkdir repositories
cd repositories
git clone https://githubfast.com/lllyasviel/google_blockly_prototypes
git clone https://githubfast.com/salesforce/BLIP.git
git clone https://githubfast.com/AUTOMATIC1111/stable-diffusion-webui-assets.git
复制代码
# 五、模型下载

```bash
apt update && apt install git-lfs -y
#models/Stable-diffusion
git-lfs clone https://www.modelscope.cn/AI-ModelScope/FLUX.1-dev.git
#models/text_encoder
git-lfs clone https://www.modelscope.cn/muse/sd35_t5xxl.git
git-lfs clone https://www.modelscope.cn/livehouse/clip_l.git
#models/VAE
#直接把flux里面的vae拷贝过来即可

记得把模型放进对应注释的路径

六、运行效果

命令:

export MLU_VISIBLE_DEVICES=0 && python webui.py --disable-xformers --always-offload-from-vram --skip-torch-cuda-test --skip-version-check


相关推荐
hie9889412 分钟前
MATLAB锂离子电池伪二维(P2D)模型实现
人工智能·算法·matlab
晨同学032714 分钟前
opencv的颜色通道问题 & rgb & bgr
人工智能·opencv·计算机视觉
路来了14 分钟前
Python小工具之PDF合并
开发语言·windows·python
蓝婷儿24 分钟前
Python 机器学习核心入门与实战进阶 Day 3 - 决策树 & 随机森林模型实战
人工智能·python·机器学习
大千AI助手27 分钟前
PageRank:互联网的马尔可夫链平衡态
人工智能·机器学习·贝叶斯·mc·pagerank·条件概率·马尔科夫链
AntBlack1 小时前
拖了五个月 ,不当韭菜体验版算是正式发布了
前端·后端·python
小和尚同志1 小时前
Cline | Cline + Grok3 免费 AI 编程新体验
人工智能·aigc
我就是全世界1 小时前
TensorRT-LLM:大模型推理加速的核心技术与实践优势
人工智能·机器学习·性能优化·大模型·tensorrt-llm
.30-06Springfield1 小时前
决策树(Decision tree)算法详解(ID3、C4.5、CART)
人工智能·python·算法·决策树·机器学习
我不是哆啦A梦1 小时前
破解风电运维“百模大战”困局,机械版ChatGPT诞生?
运维·人工智能·python·算法·chatgpt