当前位置: 首页 > 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.cnnetsun.cn/news/96589.html

相关文章:

  • 公司网站wordpress主题推荐
  • 金融从业者福音:LobeChat搭建合规AI分析助手
  • LobeChat科技新闻深度解读
  • LinkedIn职业建议:LobeChat撰写个人简介
  • 9 个 MBA 论文降AI工具,AI 写作优化推荐
  • 10 个高效降AI率工具,自考党必备!
  • 测试技术如何应用于股市个股的风险评测?
  • Java毕设选题推荐:基于java的畅销图书推荐系统基于springboot+vue的畅销图书推荐系统的设计与实现【附源码、mysql、文档、调试+代码讲解+全bao等】
  • 计算机Java毕设实战-基于JavaWeb的智慧养老院管理系统的设计与实现访客记录、病历档案、入院指南、药品信息【完整源码+LW+部署说明+演示视频,全bao一条龙等】
  • 计算机Java毕设实战-基于JavaWeb的心聘求职平台的设计与实现基于springboot的人才求职招聘平台设计与实现【完整源码+LW+部署说明+演示视频,全bao一条龙等】
  • LobeChat会议议程自动生成器开发
  • Python面向对象——进阶(三)
  • C语言实现图书管理系统[2025-12-17]
  • LobeChat对话摘要自动生成实践
  • 迈向价值透明:基于意义行为原生论的机器学习治理框架——一份人机协作的独立宣言
  • 企业级AI客服新选择:基于LobeChat镜像的智能对话系统搭建
  • LobeChat会员等级权益设计建议
  • LobeChat版本更新日志解读:v0.8.5新增特性一览
  • LobeChat RBAC权限模型设计
  • LobeChat董事会汇报PPT内容生成
  • 8个AI写作工具,专科生轻松搞定论文格式规范!
  • 使用 Python 动手实践全局优化方法
  • 如图,红框是新版QQ,右边是旧版QQ
  • LobeChat差分隐私保护机制设计
  • 《gdb 与 cgdb 深度解析:命令行调试的效率革命》
  • 国产时序数据库崛起:金仓凭什么在复杂场景中碾压InfluxDB
  • 脚本网页 地球演化
  • AXI-A7.4.9 Atomic transaction dependencies
  • 【AI黑科技】6.89%性能炸裂!ASFR框架让知识图谱“开天眼“,小白程序员也能玩转大模型增强技术
  • Google最新AI Agents课程全解析!337页白皮书浓缩精华,从入门到精通,手把手教你成为Agent开发大神!