一个比SDXL更快的模型——Stable Cascade【必坑指北】

2024年的春节假期,AIGC界又发生了重大革命性事件。

  • OpenAI 发布了首款文生视频模型------Sora。简单来说就是,AI视频要变天了!之前的SVD,还是Google的Lumiere最多就几十帧,大约十秒左右,但是Sora却是SOTA级别且达到60s长度的文生视频模型。
  • Stability AI 开源 Stable Cascade,重新修改了diffusion架构,并且速度比原来的sdxl更快。不过目前huggingface下的模型,我仍建议使用 20GB以上的VRAM,而X 平台用户 @GozukaraFurkan 发文表示它只需要大约 9GB 的 GPU 内存,且速度依旧能保持得较好,具体优化需等GitHub发布了。
  • Apple 开售 Vision Pro,继 Meta Quest 3 之后又一位元宇宙的重量级选手。虽然Pico和黑鲨暂时退热了, 但是硅谷依旧热情高涨,值得向往学习。

部署

javascript 复制代码
#install `diffusers` from this branch while the PR is WIP
pip install git+https://github.com/kashif/diffusers.git@wuerstchen-v3

官方最新的有问题,会提示 If you want to instead overwrite randomly initialized weights, please make sure to pass both low_cpu_mem_usage=False and ignore_mismatched_sizes=True.

perl 复制代码
# 参考 https://github.com/kijai/ComfyUI-DiffusersStableCascade/issues/13
pip install --force-reinstall --no-deps git+https://github.com/huggingface/diffusers.git@a3dc21385b7386beb3dab3a9845962ede6765887

代码

ini 复制代码
import torch
from diffusers import StableCascadeDecoderPipeline, StableCascadePriorPipeline

device = "cuda"
dtype = torch.bfloat16
num_images_per_prompt = 2

prior = StableCascadePriorPipeline.from_pretrained("stabilityai/stable-cascade-prior", torch_dtype=dtype).to(device)
decoder = StableCascadeDecoderPipeline.from_pretrained("stabilityai/stable-cascade",  torch_dtype=dtype).to(device)

prompt = "Anthropomorphic cat dressed as a pilot"
negative_prompt = ""

with torch.cuda.amp.autocast(dtype=dtype):
    prior_output = prior(
        prompt=prompt,
        height=1024,
        width=1024,
        negative_prompt=negative_prompt,
        guidance_scale=4.0,
        num_images_per_prompt=num_images_per_prompt,
    )
    decoder_output = decoder(
        image_embeddings=prior_output.image_embeddings,
        prompt=prompt,
        negative_prompt=negative_prompt,
        guidance_scale=0.0,
        output_type="pil",
    ).images

代码

ini 复制代码
import torch
from diffusers import StableCascadeDecoderPipeline, StableCascadePriorPipeline

device = "cuda"
num_images_per_prompt = 2

prior = StableCascadePriorPipeline.from_pretrained("stabilityai/stable-cascade-prior", torch_dtype=torch.bfloat16).to(device)
decoder = StableCascadeDecoderPipeline.from_pretrained("stabilityai/stable-cascade",  torch_dtype=torch.float16).to(device)

prompt = "Anthropomorphic cat dressed as a pilot"
negative_prompt = ""

prior_output = prior(
    prompt=prompt,
    height=1024,
    width=1024,
    negative_prompt=negative_prompt,
    guidance_scale=4.0,
    num_images_per_prompt=num_images_per_prompt,
    num_inference_steps=20
)
decoder_output = decoder(
    image_embeddings=prior_output.image_embeddings.half(),
    prompt=prompt,
    negative_prompt=negative_prompt,
    guidance_scale=0.0,
    output_type="pil",
    num_inference_steps=10
).images

#Now decoder_output is a list with your PIL images
相关推荐
春末的南方城市31 分钟前
港科大&快手提出统一上下文视频编辑 UNIC,各种视频编辑任务一网打尽,还可进行多项任务组合!
人工智能·计算机视觉·stable diffusion·aigc·transformer
草梅友仁3 小时前
AI 图片文字翻译与视频字幕翻译工具推荐 | 2025 年第 23 周草梅周报
开源·github·aigc
墨风如雪10 小时前
Gemini 2.5 Pro:AI新王登基,炸裂来袭!
aigc
袁庭新10 小时前
使用扣子+飞书+DeepSeek搭建批量提取公众号文章内容并改写的智能体
人工智能·aigc·coze
小溪彼岸11 小时前
【Cursor实战】Context7 MCP为Cursor提供实时文档上下文
aigc·cursor
小溪彼岸13 小时前
【Cursor实战】DeepWiki MCP让Cursor边查项目文档边写代码
aigc·cursor
小和尚同志1 天前
通俗易懂的 MCP 概念入门
人工智能·aigc
redreamSo1 天前
AI Daily | AI日报:科学家怒揭 AI 科研黑幕; 清华:AutoMat让电镜流程大提速; AI辩论:81.7%概率让你信服
程序员·aigc·资讯
肖笙XiaoSheng1 天前
用Gemini调整我的定时任务代码
后端·aigc·ai编程
后端小肥肠1 天前
Coze实战:一分钟生成10w+独居女孩Vlog动画,零基础也能日更!
人工智能·aigc·coze