AI大模型教程
一起来学习

Stable Diffusion demo脚本

stable_diffusion-2-1

import torch
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler

model_id = "/mnt/Datasets/Opensource_pretrained_models/Stable_Diffusion/stable_diffusion-2-1/"

# Use the DPMSolverMultistepScheduler (DPM-Solver++) scheduler here instead
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe = pipe.to("cuda")

prompt = "High quality, Smooth, texture-filtered surface highlighting the bold > text with enhanced clarity and contrast."
image = pipe(prompt).images[0]
    
image.save("v2.1smooth.png")

stable-diffusion-v1-4

import torch
from diffusers import StableDiffusionPipeline

model_id = "/mnt/Datasets/Opensource_pretrained_models/Stable_Diffusion/stable-diffusion-v1-4/"
device = "cuda"


pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe = pipe.to(device)

prompt = "Weathered wood with visible cracks and textured grain in varying brown tones"
image = pipe(prompt).images[0]  
    
image.save("output.png")

文章来源于互联网:Stable Diffusion demo脚本

相关推荐: AIGC:重塑文学的新力量

目录 一.AIGC 为文学创作带来的新机遇 1.激发创意灵感 2.提高创作效率 3.拓展文学风格和形式 4.促进文学的普及和传播 二.AIGC 对文学创作的挑战 1.版权问题 2.文学价值的质疑 3.对人类作家的冲击 三.如何应对 AIGC 对文学的影响 1.…

赞(0)
未经允许不得转载:5bei.cn大模型教程网 » Stable Diffusion demo脚本
分享到: 更多 (0)

AI大模型,我们的未来

小欢软考联系我们