VAE scaling factor config bug
#8
by
JonnoFTW
- opened
I get this error running the latest diffusers version 0.13.0.dev0
:
/home/jonno/diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py:104: FutureWarning: The configuration file of the vae does not contain `scaling_factor`
or it is set to 0.18215, which seems highly unlikely. If your checkpoint is a fine-tuned version of `stabilityai/stable-diffusion-x4-upscaler` you should change 'scaling_factor' to 0.08333
Please make sure to update the config accordingly, as not doing so might lead to incorrect results in future versions. If you have downloaded this checkpoint from the Hugging Face Hub,
it would be very nice if you could open a Pull Request for the `vae/config.json` file
deprecate("wrong scaling_factor", "1.0.0", deprecation_message, standard_warn=False)
I ran the following code:
import sys
from PIL import Image
import torch
from diffusers import StableDiffusionUpscalePipeline
def run(image: Image, prompt, negative_prompt):
model_id = "stabilityai/stable-diffusion-x4-upscaler"
pipeline = StableDiffusionUpscalePipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipeline.enable_xformers_memory_efficient_attention()
pipeline = pipeline.to("cpu")
return pipeline(
prompt=prompt,
image=image,
negative_prompt=negative_prompt,
).images[0]
if __name__ == "__main__":
im_name = sys.argv[1]
im = Image.open(im_name)
im = run(im)
im.save(im_name + "upscaled.png", sys.argv[2], sys.argv[3])
To fix this can follow this change: https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler/discussions/9