网站搭建徐州百度网络,学生个人网站布局,文明网网站建设,网站设计公司简介Flux 文生图模型#xff0c;是 Black Forest Labs 最近发布的模型#xff0c;图片生成清晰度很高#xff0c;模型可以在 ModelScope 上进行下载#xff0c;本文将在本地环境中部署 Flex。使用环境如下
2080 TI 22GUbuntu 22Amd R7 2700 / 128G
启动 Model Scope 容器
Mo…Flux 文生图模型是 Black Forest Labs 最近发布的模型图片生成清晰度很高模型可以在 ModelScope 上进行下载本文将在本地环境中部署 Flex。使用环境如下
2080 TI 22GUbuntu 22Amd R7 2700 / 128G
启动 Model Scope 容器
ModelScope 1.16 版本
docker run --rm --runtimenvidia --shm-size32g --gpus all -p 8890:8888 -p 8891-8895:8891-8895 \
-v /opt/modelscope/models:/mnt/workspace/.cache \
-v /opt/modelscope/notebook:/notebook \-it registry.cn-beijing.aliyuncs.com/modelscope-repo/modelscope:ubuntu22.04-cuda12.1.0-py310-torch2.3.0-tf2.16.1-1.16.0 /bin/bash通过 Notebook 启动 ComfyUI
安装 ComfyUI
from pathlib import PathOPTIONS {}UPDATE_COMFY_UI True #param {type:boolean}
WORKSPACE ComfyUI
OPTIONS[UPDATE_COMFY_UI] UPDATE_COMFY_UIWORKSPACE ./ComfyUI![ ! -d $WORKSPACE ] echo - Initial setup ComfyUI - git clone https://github.com/comfyanonymous/ComfyUI
%cd $WORKSPACEif OPTIONS[UPDATE_COMFY_UI]:!echo - Updating ComfyUI -!git pull!echo - Install dependencies -
!pip install -r requirements.txt下载模型 ### FLUX1-DEV
!modelscope download --model AI-ModelScope/FLUX.1-dev --local_dir ./models/unet/ flux1-dev.safetensors
!modelscope download --model AI-ModelScope/flux-fp8 --local_dir ./models/unet/ flux1-dev-fp8.safetensors### Download text encoder model
!modelscope download --model AI-ModelScope/flux_text_encoders --local_dir ./models/clip/ t5xxl_fp16.safetensors
!modelscope download --model AI-ModelScope/flux_text_encoders --local_dir ./models/clip/ clip_l.safetensors
!modelscope download --model AI-ModelScope/flux_text_encoders --local_dir ./models/clip/ t5xxl_fp8_e4m3fn.safetensors# ### vae
!modelscope download --model AI-ModelScope/FLUX.1-dev --local_dir ./models/vae/ ae.safetensors安装 Cloudflared
!wget https://modelscope.oss-cn-beijing.aliyuncs.com/resource/cloudflared-linux-amd64.deb
!dpkg -i cloudflared-linux-amd64.deb启动 ComfyUI
import subprocess
import threading
import time
import socket
import urllib.requestdef iframe_thread(port):while True:time.sleep(0.5)sock socket.socket(socket.AF_INET, socket.SOCK_STREAM)result sock.connect_ex((127.0.0.1, port))if result 0:breaksock.close()print(\nComfyUI finished loading, trying to launch cloudflared (if it gets stuck here cloudflared is having issues)\n)p subprocess.Popen([cloudflared, tunnel, --url, http://127.0.0.1:{}.format(port)], stdoutsubprocess.PIPE, stderrsubprocess.PIPE)for line in p.stderr:l line.decode()if trycloudflare.com in l:print(This is the URL to access ComfyUI:, l[l.find(http):], end)#print(l, end)threading.Thread(targetiframe_thread, daemonTrue, args(8892,)).start()!python main.py --dont-print-server --port 8892 --listen 0.0.0.0创建工作流 生成图片
A transparent glass of very very small slim capsule is being held by fingers, inside the capsule there is a nuclear explosion, there is smoke and fire, the background of a cozy room Chinese ink painting, a girl, long hair, colorful hair, shining eyes总结
比之前部署的 SD 精细不少。文中使用到的文件已经上传到资源中有兴趣的同学可以下载。