Gadersd / stable-diffusion-burn

Stable Diffusion v1.4 ported to Rust's burn framework
MIT License
316 stars 15 forks source link

Sample produces black image. #6

Open danielclough opened 1 year ago

danielclough commented 1 year ago

rustc 1.71.1 (eb26296b5 2023-08-03) CUDA Version: 12.2
NVIDIA System Management Interface -- v535.86.10

I'm not sure what other info could be useful.

It builds fine, runs for a good long time using Cuda, but image is just black.

aslamplr commented 1 year ago

Same here, I am getting a black img0.png, while running sample using wgpu backend.

My setup

What worked for me?

I am able to get a valid image using the following

type Backend = TchBackend<f32>;
let device = TchDevice::Cpu;

Using MPS

I also tried, let device = TchDevice::Mps; to see if I can utilize GPU; This time, I got an image that was not valid (see attachment)

img0

Run durations

All compiled using release profile; same prompt “An ancient mossy stone.”; And the power adapter connected; Note: The performance might be beyond the scope of this project; just posting this for reference purpose only;

Please note, these are not scientific benchmarks; just indicative;

Gadersd commented 1 year ago

I've encountered similar strange images when running SD XL in f16 but f32 works fine. I think the issue has something to do with floating point rounding errors or overflows. I can't test wgpu as my GPU doesn't have enough memory to handle it. Hopefully in time burn-wpu will be optimized enough for large models such as SD.