news 2026/5/26 7:19:10

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

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
第六十二篇-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中。

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/5/26 5:25:18

Ascend C算子与PyTorch生态无缝融合:自定义算子开发实战指南

目录 &#x1f4cb; 摘要 &#x1f3d7;️ 技术原理 2.1 架构设计理念解析&#xff1a;CANN的七层软件栈哲学 2.2 核心算法实现&#xff1a;Ascend C向量化编程范式 2.3 性能特性分析&#xff1a;达芬奇架构的硬件优势 &#x1f527; 实战部分 3.1 完整可运行代码示例&a…

作者头像 李华
网站建设 2026/5/25 20:53:38

ML.NET实现人名、地名的提取

ML.NET 可以通过文本分类或命名实体识别&#xff08;NER&#xff09;任务实现人名、地名的提取。以下是使用 ML.NET 实现该功能的核心思路和步骤&#xff1a;核心原理提取人名、地名属于命名实体识别&#xff08;NER&#xff09; 任务&#xff0c;本质是对文本中的每个词或字符…

作者头像 李华
网站建设 2026/5/26 1:29:26

教育场景下的AI助教实践:基于LobeChat的智能问答系统

教育场景下的AI助教实践&#xff1a;基于LobeChat的智能问答系统 在一所普通高中的晚自习教室里&#xff0c;一名学生正盯着物理作业本上的一道力学题发愁。他打开学校内网的“AI学习助手”网页&#xff0c;上传了题目截图&#xff0c;输入&#xff1a;“请帮我分析这个物体的受…

作者头像 李华
网站建设 2026/5/26 5:32:46

超详细图文教程:Windows环境部署LobeChat全过程

Windows 环境部署 LobeChat 全过程&#xff1a;从零开始搭建你的私有化 AI 聊天平台 在今天&#xff0c;一个能与大语言模型顺畅对话的界面&#xff0c;几乎成了每个开发者、产品经理甚至普通用户的刚需。我们手握 GPT、通义千问、Llama3 这样的强大模型&#xff0c;却常常被原…

作者头像 李华
网站建设 2026/5/26 6:45:14

大数据领域 ClickHouse 的资源管理策略

大数据领域 ClickHouse 的资源管理策略关键词&#xff1a;大数据、ClickHouse、资源管理策略、性能优化、资源分配摘要&#xff1a;本文聚焦于大数据领域中 ClickHouse 的资源管理策略。随着大数据应用的不断发展&#xff0c;ClickHouse 作为一款高性能的列式数据库管理系统&am…

作者头像 李华
网站建设 2026/5/25 10:41:20

LobeChat能否对接Google Sheets?电子表格自动化更新

LobeChat能否对接Google Sheets&#xff1f;电子表格自动化更新 在日常办公中&#xff0c;你是否曾为重复填写销售报表、手动同步会议纪要或逐条录入客户信息而感到繁琐&#xff1f;尤其是在多平台间切换时——浏览器开十几个标签页&#xff0c;一边听语音记录一边敲键盘&#…

作者头像 李华