当前位置: 首页 > news >正文

第六十二篇-ComfyUI+V100-32G+代码运行Z-Image

环境

系统:CentOS-7 CPU : E5-2680V4 14核28线程 内存:DDR4 2133 32G * 2 显卡:Tesla V100-32G【PG503】 (水冷) 驱动: 535 CUDA: 12.2

依赖

pipinstalldiffusers -i https://mirrors.aliyun.com/pypi/simple

下载模型

pipinstallmodelscope -i https://mirrors.aliyun.com/pypi/simple modelscope download --model Tongyi-MAI/Z-Image-Turbo --local_dir /models/Z-Image-Turbo

代码

importtorch from diffusersimportZImagePipeline# 1. Load the pipeline# Use bfloat16 for optimal performance on supported GPUspipe=ZImagePipeline.from_pretrained("/models/Z-Image-Turbo",torch_dtype=torch.bfloat16,low_cpu_mem_usage=False,)pipe.to("cuda")# [Optional] Attention Backend# Diffusers uses SDPA by default. Switch to Flash Attention for better efficiency if supported:# pipe.transformer.set_attention_backend("flash") # Enable Flash-Attention-2# pipe.transformer.set_attention_backend("_flash_3") # Enable Flash-Attention-3# [Optional] Model Compilation# Compiling the DiT model accelerates inference, but the first run will take longer to compile.# pipe.transformer.compile()# [Optional] CPU Offloading# Enable CPU offloading for memory-constrained devices.# pipe.enable_model_cpu_offload()prompt="Young Chinese woman in red Hanfu, intricate embroidery. Impeccable makeup, red floral forehead pattern. Elaborate high bun, golden phoenix headdress, red flowers, beads. Holds round folding fan with lady, trees, bird. Neon lightning-bolt lamp (⚡️), bright yellow glow, above extended left palm. Soft-lit outdoor night background, silhouetted tiered pagoda (西安大雁塔), blurred colorful distant lights."# 2. Generate Imageimage=pipe(prompt=prompt,height=1024,width=1024,num_inference_steps=9,# This actually results in 8 DiT forwardsguidance_scale=0.0,# Guidance should be 0 for the Turbo modelsgenerator=torch.Generator("cuda").manual_seed(42),).images[0]image.save("example.png")

运行

exportHF_ENDPOINT=https://hf-mirror.com python run-1.py

参数

1024 * 1024

时间

(comfyui)[root@ai-server Z-Image]# python run-1.pyLoading pipeline components...:20%|█████████▏|1/5[00:00<00:01,2.15it/s]`torch_dtype`is deprecated!Use`dtype`instead!Loading checkpoint shards:100%|███████████████████████████████████████████████████|3/3[00:00<00:00,47.55it/s]Loading checkpoint shards:100%|███████████████████████████████████████████████████|3/3[00:09<00:00,3.11s/it]Loading pipeline components...:100%|██████████████████████████████████████████████|5/5[00:10<00:00,2.06s/it]100%|██████████████████████████████████████████████████████████████████████████████|9/9[00:57<00:00,6.35s/it]

GPU

Tue Dec1623:15:592025+---------------------------------------------------------------------------------------+|NVIDIA-SMI535.129.03 Driver Version:535.129.03 CUDA Version:12.2||-----------------------------------------+----------------------+----------------------+|GPU Name Persistence-M|Bus-Id Disp.A|Volatile Uncorr. ECC||Fan Temp Perf Pwr:Usage/Cap|Memory-Usage|GPU-Util Compute M.||||MIG M.||=========================================+======================+======================||0Tesla PG503-216 On|00000000:04:00.0 Off|0||N/A 35C P0 232W / 250W|29740MiB / 32768MiB|100% Default||||N/A|+-----------------------------------------+----------------------+----------------------+

效果

总结

速度还是可以的,1分钟。
最高占用30G,100%GPU占用。
效果后面继续测试,后续加入到ComfyUI中。

http://www.rkmt.cn/news/112986.html

相关文章:

  • 统计概览-Cordovaopenharmony多维度数据展示
  • LobeChat能否对接Google Sheets?电子表格自动化更新
  • Audacity音频处理指令由LobeChat智能生成
  • Java 25 (LTS) 重磅发布:AI、性能、安全全面革新,新手入门门槛再创新低!
  • 超详细图文教程:Windows环境部署LobeChat全过程
  • LobeChat能否对接Tesla API?车辆状态查询与远程控制
  • LobeChat能否实现股票行情查询?金融信息问答机器人
  • LobeChat语音合成TTS功能拓展实践
  • LobeChat活动结束总结报告
  • 系统编程—线程
  • LobeChat能否部署在Render平台?持续部署便捷方案
  • 10 个降AI率工具,本科生论文查重优化推荐
  • 10 个降AI率工具,专科生也能轻松应对!
  • Realm端口转发教程
  • 电路中mos管的作用
  • 计算机Java毕设实战-基于javaweb的在线图书借阅管理系统图书馆在线借阅管理系统【完整源码+LW+部署说明+演示视频,全bao一条龙等】
  • Java 并发编程之 ThreadPoolExecutor 深度解析:从原理到实战
  • 【LLM基础教程】从序列切分到上下文窗口02_三种数据切分方法
  • 【LLM基础教程】LLM训练数据集是如何构造的:从文档到Token Block
  • 8 个降AI率工具推荐,本科生高效避坑指南
  • 打表小技巧
  • 8 个降AI率工具,自考学生高效避坑指南
  • SQL中的NULL值处理技巧
  • LobeChat与知识库系统联动:构建智能问答闭环
  • LobeChat会议议程自动生成器开发
  • LobeChat认证授权体系设计
  • LobeChat正式版发布新闻稿
  • LobeChat SEO标题生成器实战应用
  • Ansible进行Nginx编译安装的详细步骤
  • 9个AI论文工具,继续教育学员轻松写毕业论文!