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

部署Qwen-Image

  1. 安装准备
pip install git+https://github.com/huggingface/diffusers
pip install peft==0.17.0
  1. 报错:AttributeError: ‘dict’ object has no attribute ‘to_dict’
    在这里插入图片描述
    解决办法
    修改
    /opt/conda/lib/python3.11/site-packages/transformers/generation/configuration_utils.py的第1290行,改为:decoder_config_dict = decoder_config

  2. 最终代码

from diffusers import DiffusionPipeline
from tools.prompt_utils import rewrite
import torch# Initialize the pipeline
pipe = DiffusionPipeline.from_pretrained("/root/private_data/models/Qwen/Qwen-Image", torch_dtype=torch.bfloat16)
pipe = pipe.to("cuda")# Generate with different aspect ratios
aspect_ratios = {"16:9": (1664, 960),
}prompt = "帮我画一个农田里面堆肥的场景"  # Chinese prompt
#prompt = rewrite(prompt)width, height = aspect_ratios["16:9"]image = pipe(prompt=prompt,width=width,height=height,num_inference_steps=50,true_cfg_scale=4.0,generator=torch.Generator(device="cuda").manual_seed(42)
).images[0]image.save("example.png")
http://www.dtcms.com/a/339198.html

相关文章:

  • 【AAOS】Android Automotive 16模拟器源码下载及编译
  • 【LeetCode题解】LeetCode 153. 寻找旋转排序数组中的最小值
  • HJ2 计算某字符出现次数
  • C语言关于函数传参和返回值的一些想法2(参数可修改的特殊情况)
  • 从数据孤岛到实时互联:Canal 驱动的系统间数据同步实战指南
  • 在职老D渗透日记day21:sqli-labs靶场通关(第27a关)get联合注入 过滤select和union “闭合
  • C# 13 与 .NET 9 跨平台开发实战(第一章:开发环境搭建与.NET概述)
  • Milvus 向量数据库中的索引类型
  • SQL 语句进阶实战:从基础查询到性能优化全指南
  • K8s命名空间:资源隔离与管理的核心
  • 轻量级milvus安装和应用示例
  • 一文精通 Swagger 在 .NET 中的全方位配置与应用
  • 软件测试-Selenium学习笔记
  • Dify-MCP服务创建案例
  • 循环高级综合练习①
  • 46 C++ STL模板库15-容器7-顺序容器-双端队列(deque)
  • 人工智能统一信息结构的挑战与前景
  • Vue3编程中更多常见书写错误场景
  • 使用OpenCV计算灰度图像的质心
  • 云原生堡垒机渗透测试场景
  • 所有普通I/O口都支持中断的51单片机@Ai8051U, AiCube 图形化配置
  • 微服务架构的演进:从 Spring Cloud Netflix 到云原生新生态
  • 大模型微调RAG、LORA、强化学习
  • 如何使用VNC对openEuler系统进行远程图形化操作
  • Ubuntu Server 22.04 k8s部署服务较时,文件描述符超过限制的处理方法
  • RabbitMQ:SpringBoot+RabbitMQ 多消费者绑定同一队列
  • Node.js 在 Windows Server 上的离线部署方案
  • leetcode349. 两个数组的交集
  • 轻度娱乐浪潮下定制开发开源AI智能名片S2B2C商城小程序的机遇与策略
  • 厚板数控矫平机的“第三堂课”——把视角拉远,看看它如何重塑整条制造链