Changing a model
At the time of writing this chapter, there are numerous models available, fine-tuned based on the V1.5 Stable Diffusion model, contributed by the thriving user community. If the model file is hosted on Hugging Face, you can easily switch to a different model by changing its identifier, as shown in the following code snippet:
# Change model to "stablediffusionapi/deliberate-v2" from diffusers import StableDiffusionPipeline text2img_pipe = StableDiffusionPipeline.from_pretrained( "stablediffusionapi/deliberate-v2", torch_dtype = torch.float16 ).to("cuda:0") prompt ="high resolution, a photograph of an astronaut riding a horse" image = text2img_pipe( prompt = prompt ).images[0] display(image)
Additionally, you can also use a ckpt/safetensors
model downloaded from civitai.com (http://civitai.com). Here, we demonstrate loading the deliberate-v2
model using...