Diffusers
Safetensors
StableDiffusionUpscalePipeline
stable-diffusion

Run this model with HF Jobs

Run stabilityai/stable-diffusion-x4-upscaler on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

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])

Sign up or log in to comment