Blazing Fast Images with SDXL Lightning on OctoAI
In this article
Presenting the groundbreaking SDXL Lighting checkpoint on OctoAI, revolutionizing the generation of high-quality SDXL images from text in mere seconds, all at the most competitive prices. This latest addition to OctoAI's suite of media generation solutions empowers users to effortlessly produce top-tier SDXL output with just 4-8 simple steps, boasting latency of less than one second. This stands in stark contrast to generating images using SDXL model, which typically demands 30-40 steps to produce a good quality image in 3-3.5 seconds, and even more when incorporating custom assets like LoRAs.
Accessible through OctoAI’s SDXL API, the SDXL Lighting checkpoint seamlessly integrates with SDXL models, effortlessly adapting to style presets and LoRAs, thus enhancing its versatility and practicality.
To fully harness the power of SDXL lighting, adhere to these recommendations:
Opt for 4-8 steps, with 8 steps being the recommended choice.
Maintain a low CFG Scale, ideally ranging from 1.4 to 4.0, with 3.0 as the optimal value.
Utilize any sampler, textual inversion, or style preset.
Note that additional LoRAs and VAEs will result in increased inference time.
In this post, we'll provide a walkthrough on leveraging the SDXL lighting functionality within the OctoAI SDXL ImageGen API.
Let’s say you are an e-commerce merchant selling glass orbs for the holiday season. Using OctoAI SDXL with default settings — base style and 30 steps, you can generate the following image within 2.8 seconds:
import os
from octoai.clients.image_gen import Engine, ImageGenerator
if __name__ == "__main__":
image_gen = ImageGenerator(token=os.environ.get("OCTOAI_TOKEN"))
image_gen_response = image_gen.generate(
engine=Engine.SDXL,
prompt="glass orb with snowy christmas scene in it ",
negative_prompt="Blurry, low-res, poor quality",
width=1024,
height=1024,
num_images=1,
sampler="DDIM",
steps=30,
cfg_scale=12,
seed=746479101,
use_refiner=False,
style_preset="base",
)
images = image_gen_response.images
for i, image in enumerate(images):
image.to_file(f"result{i}.jpg")
Now, if you use SDXL Lighting, you can generate a similarly high-quality image in only 8 steps and 989 milliseconds.
import os
from octoai.clients.image_gen import Engine, ImageGenerator
if __name__ == "__main__":
image_gen = ImageGenerator(token=os.environ.get("OCTOAI_TOKEN"))
image_gen_response = image_gen.generate(
engine=Engine.SDXL,
prompt="((glass orb)) with snowy christmas scene in it ",
negative_prompt="ornament, Blurry, low-res, poor quality",
checkpoint="octoai:lightning_sdxl",
width=1024,
height=1024,
num_images=1,
sampler="DDIM",
steps=8,
cfg_scale=3,
seed=3327823665,
use_refiner=False,
style_preset="base",
)
images = image_gen_response.images
for i, image in enumerate(images):
image.to_file(f"result{i}.jpg")
In conclusion, by embracing the SDXL lighting functionality within the OctoAI SDXL ImageGen API, you can unlock unprecedented efficiency and quality in image generation. As illustrated through the example of crafting holiday-themed glass orbs, the transition from traditional methods to SDXL Lighting not only accelerates the process but also ensures that the output maintains the highest standards of visual appeal. With significantly reduced steps and latency, the integration of SDXL lighting presents a transformative opportunity for businesses to streamline their workflows and deliver captivating imagery to their customers with unparalleled speed and precision.
Try on OctoAI today
To learn more, review our documentation. Give us a try by signing up today— you’ll get $10 of free credit upon signup!