SDXL-Lightning by ByteDance

sdxl-lightning-4step

SDXL-Lightning by ByteDance: a fast text-to-image model that makes high-quality images

A100 80GB
Fast Inference
REST API

Model Information

Response Time~2 sec
StatusActive
Version
0.0.1
Updated28 days ago

Prerequisites

  • Create an API Key from the Eachlabs Console
  • Install the required dependencies for your chosen language (e.g., requests for Python)

API Integration Steps

1. Create a Prediction

Send a POST request to create a new prediction. This will return a prediction ID that you'll use to check the result. The request should include your model inputs and API key.

import requests
import time
API_KEY = "YOUR_API_KEY" # Replace with your API key
HEADERS = {
"X-API-Key": API_KEY,
"Content-Type": "application/json"
}
def create_prediction():
response = requests.post(
"https://api.eachlabs.ai/v1/prediction/",
headers=HEADERS,
json={
"model": "sdxl-lightning-4step",
"version": "0.0.1",
"input": {
"seed": null,
"width": "1024",
"height": "1024",
"prompt": "A superhero smiling",
"scheduler": "K_EULER",
"num_outputs": "1",
"guidance_scale": "0",
"negative_prompt": "worst quality, low quality",
"num_inference_steps": "4",
"disable_safety_checker": "true"
}
}
)
prediction = response.json()
if prediction["status"] != "success":
raise Exception(f"Prediction failed: {prediction}")
return prediction["predictionID"]

2. Get Prediction Result

Poll the prediction endpoint with the prediction ID until the result is ready. The API uses long-polling, so you'll need to repeatedly check until you receive a success status.

def get_prediction(prediction_id):
while True:
result = requests.get(
f"https://api.eachlabs.ai/v1/prediction/{prediction_id}",
headers=HEADERS
).json()
if result["status"] == "success":
return result
elif result["status"] == "error":
raise Exception(f"Prediction failed: {result}")
time.sleep(1) # Wait before polling again

3. Complete Example

Here's a complete example that puts it all together, including error handling and result processing. This shows how to create a prediction and wait for the result in a production environment.

try:
# Create prediction
prediction_id = create_prediction()
print(f"Prediction created: {prediction_id}")
# Get result
result = get_prediction(prediction_id)
print(f"Output URL: {result['output']}")
print(f"Processing time: {result['metrics']['predict_time']}s")
except Exception as e:
print(f"Error: {e}")

Additional Information

  • The API uses a two-step process: create prediction and poll for results
  • Response time: ~2 seconds
  • Rate limit: 60 requests/minute
  • Concurrent requests: 10 maximum
  • Use long-polling to check prediction status until completion

Overview

The SDXL-Lightning by ByteDance model is designed for efficient and high-quality image generation using advanced diffusion techniques. With support for customizable parameters, this model allows users to tailor their image generation process to meet specific needs, producing detailed and aesthetically pleasing results.

Technical Specifications

Architecture: The model leverages a state-of-the-art diffusion framework with multi-step denoising and adaptive guidance mechanisms.

Customization: Users can adjust image dimensions, sampling techniques, inference steps, and guidance scales to optimize the generation process.

Supported Features:

  • High-resolution output (up to 1280x1280).
  • Multiple scheduling algorithms for varied generation styles.

Key Considerations

Resource Requirements: Higher resolutions and increased inference steps may require more computational resources and longer generation times.

Prompt Clarity: Ambiguous or overly complex prompts may lead to suboptimal results. Test different variations to find the most effective phrasing.

Scheduler Selection: The choice of scheduler significantly impacts the output style. Experiment with different schedulers to achieve the desired effect.

Tips & Tricks

  • Prompt and Negative Prompt for SDXL-Lightning by ByteDance:
    • Use detailed descriptions for the main prompt to provide clear guidance to the model.
    • Employ the negative prompt to exclude unwanted elements or styles.
    • Example:
      • Prompt: "A futuristic cityscape at night, neon lights reflecting on wet streets."
      • Negative Prompt: "Blurred, low-quality, dark tones."
  • Width and Height:
    • Ensure values are between 256 and 1280 pixels.
    • Use square dimensions (e.g., 512x512) for balanced outputs or adjust for desired aspect ratios.
  • Scheduler:
    • Experiment with schedulers for stylistic variety:
      • DDIM: Faster generations with moderate quality.
      • KarrasDPM: High-quality, photorealistic results.
      • HeunDiscrete: Detailed and sharp outputs.
    • Default Recommendation: Start with KarrasDPM for most cases.
  • Num Inference Steps:
    • Set values between 1 and 10.
    • For faster generation, use 5-7 steps. For higher quality, use 8-10 steps.
  • Guidance Scale:
    • Ranges from 0 to 50.
    • Low values (e.g., 5-10) produce creative and less constrained results.
    • Higher values (e.g., 20-30) ensure outputs closely follow the prompt.
  • Seed:
    • Use specific seed values for reproducibility of results.
    • Randomize the seed for diverse outputs.
  • Disable Safety Checker:
    • Enabling this ensures safe and appropriate outputs.
    • If disabled, outputs might require manual review.

Capabilities

Generate high-resolution, visually appealing images tailored to specific themes or styles with SDXL-Lightning by ByteDance.

Supports a wide variety of artistic and photorealistic styles.

Customizable parameters for creative experimentation.

What can I use for?

Creating concept art and digital illustrations.

Prototyping ideas for design and creative projects.

Generating assets for gaming, advertising, and content creation.

Things to be aware of

Dynamic Outputs for SDXL-Lightning by ByteDance:

  • Combine different schedulers with varied inference steps to explore creative possibilities.
  • Adjust guidance scale for a mix of adherence to prompts and creative freedom.

High-Quality Details for SDXL-Lightning by ByteDance:

  • Use square dimensions with high inference steps and guidance scales.
  • Example settings: Width: 1024, Height: 1024, Steps: 10, Guidance Scale: 25.

Limitations

Resolution Limitations: While capable of generating up to 1280x1280 pixels, higher resolutions may impact performance.

Prompt Sensitivity: The model's output quality is highly dependent on the clarity and specificity of the input prompts for SDXL-Lightning by ByteDance.

Scheduler Impact: Some schedulers may produce less refined outputs depending on the selected parameters.

Output Format: PNG

Related AI Models

omni-zero

Omni Zero

omni-zero

Image to Image
flux-depth-pro

Flux Depth Pro

flux-depth-pro

Image to Image
illusion-diffusion-hq

Illusion Diffusion

illusion-diffusion-hq

Image to Image
bytedance

Style Changer by ByteDance

bytedance

Image to Image