onnx text-to-image region:us
---
pipeline_tag: text-to-image
---
# SDXL Lightning - Onnx Olive DirectML Optimized 

## Original Model
https://huggingface.co/ByteDance/SDXL-Lightning

## C# Inference Demo
https://github.com/saddam213/OnnxStack

```csharp
// Create Pipeline
var pipeline = StableDiffusionXLPipeline.CreatePipeline("D:\\Repositories\\SDXL-Lightning-onnx");

// Prompt
var promptOptions = new PromptOptions
{
    Prompt = "Craft an image of a galaxy far, far away, with swirling nebulae and distant stars painting the cosmic canvas"
};

// Scheduler Options
var schedulerOptions = pipeline.DefaultSchedulerOptions with
{
    SchedulerType = SchedulerType.Euler,
    InferenceSteps = 8,
    GuidanceScale = 0,
    BetaSchedule = BetaScheduleType.Linear
};

// Run pipeline
var result = await pipeline.GenerateImageAsync(promptOptions, schedulerOptions);

// Save Image Result
await result.SaveAsync("Result.png");
```
## Inference Result
![Intro Image](Sample.png)