Edit model card

latent-consistency/lcm-sdxl compiled on an AWS Inf2 instance. INF2/TRN1 ONLY

How to use

from optimum.neuron import NeuronStableDiffusionXLPipeline

pipe = NeuronStableDiffusionXLPipeline.from_pretrained("Jingya/lcm-sdxl-neuronx")

num_images_per_prompt = 2
prompt = ["a close-up picture of an old man standing in the rain"] * num_images_per_prompt 

images = pipe(prompt=prompt, num_inference_steps=4, guidance_scale=8.0).images

If you are using a later neuron compiler version, you can compile the checkpoint yourself with the following lines via 🤗 optimum-neuron (the compilation takes approximately an hour):

from optimum.neuron import NeuronStableDiffusionXLPipeline

model_id = "stabilityai/stable-diffusion-xl-base-1.0"
unet_id = "latent-consistency/lcm-sdxl"
num_images_per_prompt = 1
input_shapes = {"batch_size": 1, "height": 1024, "width": 1024, "num_images_per_prompt": num_images_per_prompt}
compiler_args = {"auto_cast": "matmul", "auto_cast_type": "bf16"}

stable_diffusion = NeuronStableDiffusionXLPipeline.from_pretrained(
    model_id, unet_id=unet_id, export=True, **compiler_args, **input_shapes
)
save_directory = "lcm_sdxl_neuron/"
stable_diffusion.save_pretrained(save_directory)

# Push to hub
stable_diffusion.push_to_hub(save_directory, repository_id="Jingya/lcm-sdxl-neuronx", use_auth_token=True)

And feel free to make a pull request and contribute to this repo, thx 🤗!

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference API
Unable to determine this model's library. Check the docs .