
WSL2ใงStable Cascadeใ่ฉฆใใฆใฟใ
ใใใฎ้ฉๆฐ็ใชใใญในใใใ็ปๅใธใฎใขใใซใฏใๅ่ณชใๆ่ปๆงใๅพฎ่ชฟๆดใใใใณๅน็ๆงใฎใใใฎๆฐใใใใณใใใผใฏใ่จญๅฎใใใใผใใฆใงใขใฎใใชใขใใใใซๆ้คใใใใจใซ้็นใ็ฝฎใใใ่ๅณๆทฑใ3ๆฎต้ใฎใขใใญใผใใๅฐๅ ฅใใใใใใStable Cascadeใ่ฉฆใใฆใฟใพใใ
ไฝฟ็จใใPCใฏใในใใฉใใใฎใGALLERIA UL9C-R49ใใในใใใฏใฏ
ใปCPU: Intelยฎ Coreโข i9-13900HX Processor
ใปMem: 64 GB
ใปGPU: NVIDIAยฎ GeForce RTXโข 4090 Laptop GPU(16GB)ใปGPU: NVIDIAยฎ GeForce RTXโข 4090 (24GB)
ใปOS: Ubuntu22.04 on WSL2๏ผWindows 11๏ผ
ใงใใ
1. ๆบๅ
venv็ฐๅขใๆง็ฏใใฆใ
python3 -m venv stable-cascade
cd $_
source bin/activateHugging FaceใฎREADMEๅ ใcode exampleใซใใๅ ๅฎน๏ผstabilityai/stable-cascade๏ผใซๅพใฃใฆใใใใฑใผใธใฎใคใณในใใผใซใงใใ
pip install git+https://github.com/kashif/diffusers.git@wuerstchen-v32. ใณใผใ
ๆตใ่พผใใณใผใใฏใใกใใcode exampleใซใใๅ
ๅฎนใใใผในใซใ็ปๅใ่กจ็คบใใใใใฎใณใผใ2่กใๆๅพใซ่ฟฝๅ ใใใใญใณใใใฏ cat ใ Doraemon ใซๅคๆดใใฆใใพใใ
๏ผๆฌไบบๅใใชใใฆใใใฉใใใใฏใใฉใใใใชใใใ ใใใพใใใใ๏ผ
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 Doraemon 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
for image in decoder_output:
image.show()3. ่ฉฆใใฆใฟใ
RTX 4090 Laptop GPU(16GB)ใงใใจใใใคใ่ฆๆ ฃใใCUDA OOMใงใใ
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 768.00 MiB. GPU 0 has a total capacty of 15.99 GiB of which 0 bytes is free. Including non-PyTorch memory, this process has 17179869184.00 GiB memory in use. Of the allocated memory 14.23 GiB is allocated by PyTorch, and 460.74 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONFใงใฏใRTX 4090(24GB)ใง่ฉฆใใพใใใใใขใใซใญใผใใใ็ปๅ็ๆใซ่ณใGPUใชใฝใผในใฏใใใชๆจ็งปใงใใๆ็ต็ใซใฏ17.1GBไฝฟ็จใใฆใใพใใ

็ๆใซ่ฆใใๆ้ใฏ prior ใ3็งใdecodeใ2็งใใใใใฆ5็งใงใใ
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 20/20 [00:03<00:00, 5.36it/s]
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 10/10 [00:02<00:00, 4.81it/s]ใณใผใใๆตใ่พผใใง่กจ็คบใใใ็ปๅใใใกใใ


ใใฃใใใใใใ
ใพใจใ
VRAMใฏ17.1GBไฝฟ็จใงใใใVRAM 24GBใฎGPUใใใชใใจๅณใใใงใใญใ
็ๆใซ่ฆใใๆ้ใฏ ใใใใ5็งใงใใใ้ใใงใใญใใ
ใใฆใๅญฆ็ฟใฎใ่ฉฆใใฆใฟใใใฏๆ้ใใใใจใใซใปใปใปใhttps://github.com/Stability-AI/StableCascade