Downloads · 30 days
0
Jingya/lcm-sdxl-neuronx
lcm-sdxl-neuronx is a machine learning model from Jingya. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as openrail++.
latent-consistency/lcm-sdxl compiled on an AWS Inf2 instance. INF2/TRN1 ONLY
Downloads · 30 days
0
Access
Public
Updated Nov 23, 2023
Repo size
22.7 GB
Likes
0
Public
Click a slice to open those files.
.neuron7.6 GB · 100%
From the Hugging Face model README
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 🤗!