ml-stable-diffusion icon indicating copy to clipboard operation
ml-stable-diffusion copied to clipboard

Generated Images are 512x512 using stable-diffusion-v1-4, how can I generate higher res?

Open facinick opened this issue 3 years ago • 6 comments

facinick avatar Dec 02 '22 11:12 facinick

We have super resolution running on device. Does an excellent job of enlarging - reduces noise, sharper lines while increasing resolution.

3DTOPO avatar Dec 03 '22 20:12 3DTOPO

Also SD 2 has weights trained at 768, so I suppose you could use that model and increase the output shape to 768 in the convert to coreml script. But, that means inference time and RAM requirements will double.

3DTOPO avatar Dec 03 '22 21:12 3DTOPO

Hi @3DTOPO, have you managed to use huggingface.co/stabilityai/stable-diffusion-2? I got a runtime error below.

Traceback (most recent call last):
  File "/opt/homebrew/anaconda3/envs/coreml_stable_diffusion/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/homebrew/anaconda3/envs/coreml_stable_diffusion/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/coder/hub/ml-stable-diffusion/python_coreml_stable_diffusion/pipeline.py", line 534, in <module>
    main(args)
  File "/Users/coder/hub/ml-stable-diffusion/python_coreml_stable_diffusion/pipeline.py", line 478, in main
    image = coreml_pipe(
  File "/Users/coder/hub/ml-stable-diffusion/python_coreml_stable_diffusion/pipeline.py", line 354, in __call__
    image = self.decode_latents(latents)
  File "/Users/coder/hub/ml-stable-diffusion/python_coreml_stable_diffusion/pipeline.py", line 200, in decode_latents
    image = self.vae_decoder(z=latents.astype(np.float16))["image"]
  File "/Users/coder/hub/ml-stable-diffusion/python_coreml_stable_diffusion/coreml_model.py", line 79, in __call__
    return self.model.predict(kwargs)
  File "/opt/homebrew/anaconda3/envs/coreml_stable_diffusion/lib/python3.8/site-packages/coremltools/models/model.py", line 509, in predict
    return self.__proxy__.predict(data)
RuntimeError: {
    NSLocalizedDescription = "Error computing NN outputs.";
}

dreampuf avatar Dec 08 '22 02:12 dreampuf

It is running at the moment - on my Ubuntu farm.

I was interested in possibly using it for apps in development but for my purposes I think it's a bit early so have given up on the idea for now.

3DTOPO avatar Dec 08 '22 02:12 3DTOPO

I got exactly the same error as @dreampuf trying to run SD V2 on Python 3.10.6

brunoamaral avatar Dec 08 '22 20:12 brunoamaral

I got the same error when I used a CoreML model I converted myself. When I used a pre-converted model from Apple's repo on HuggingFace, SD2base successfully ran in Python using Terminal. I don't know how to make SD2.1 work, how to increase resolution to 768, or how to upscale

blu-Fox avatar Dec 18 '22 13:12 blu-Fox