当前位置: 首页 > 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.jsqmd.com/news/102186/

相关文章:

  • LobeChat日志记录功能开启方法:便于后续分析与审计
  • LobeChat安全策略解读:保障数据不出内网的关键设置
  • 大数据领域 ClickHouse 的资源管理策略
  • 统计概览-Cordovaopenharmony多维度数据展示
  • LobeChat WebSocket通信机制剖析:实时对话是如何实现的?
  • LobeChat能否对接Google Sheets?电子表格自动化更新
  • 文件上传+多模态处理:LobeChat如何玩转文档理解
  • Audacity音频处理指令由LobeChat智能生成
  • Java 25 (LTS) 重磅发布:AI、性能、安全全面革新,新手入门门槛再创新低!
  • LobeChat儿童节亲子活动策划
  • 超详细图文教程:Windows环境部署LobeChat全过程
  • 深入研究大数据领域的数据清洗技术应用
  • 数据编目与元数据管理:不可不知的关系
  • 彼得林奇的“反向思维“在牛市中的应用
  • LobeChat能否对接Tesla API?车辆状态查询与远程控制
  • LobeChat能否实现股票行情查询?金融信息问答机器人
  • 跨越城市的求知之约
  • LobeChat能否部署在Google Cloud Platform?GCP部署全记录
  • LobeChat语音合成TTS功能拓展实践
  • LobeChat活动结束总结报告
  • 系统编程—线程
  • LobeChat能否部署在Render平台?持续部署便捷方案
  • Bug Bounty计划启动:奖励发现漏洞的安全专家
  • C语言结构体详解:从定义到实战应用
  • 9 个 MBA 论文降AI工具,AI 写作优化推荐
  • 10 个开题报告工具推荐,本科生降AI率软件解析
  • 10 个降AI率工具,本科生论文查重优化推荐
  • 10 个降AI率工具,专科生也能轻松应对!
  • 随机深度优先搜索(Randomized DFS)算法原理
  • LobeChat插件开发入门:如何为AI聊天界面扩展新功能?