diffusion-optimal-perf

Configure SGLang-Diffusion CLI flags and environment variables for inference speedups.

31.6k|7.8k|Updated Jan 8, 2024
One-click install
npx skills add https://github.com/sgl-project/sglang --skill diffusion-optimal-perf-sgl-project
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: diffusion-optimal-perf
Source: https://github.com/sgl-project/sglang/tree/main/python/sglang/multimodal_gen/.claude/skills/diffusion-optimal-perf
Command: npx skills add https://github.com/sgl-project/sglang --skill diffusion-optimal-perf-sgl-project

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the need to optimize Stable Diffusion models for maximum inference speed, reduced latency, and lower VRAM usage, crucial for production deployments.

Core Features & Use Cases

  • Lossless Optimizations: Techniques like torch.compile, warm-up, and multi-GPU parallelism (SP, CFG Parallel) that don't sacrifice output quality.
  • Lossy Optimizations: Methods such as approximate attention, quantized models, and fewer inference steps that trade minor quality for significant speed or VRAM gains.
  • Use Case: A user wants to deploy a diffusion model for real-time image generation but is hitting performance bottlenecks. This Skill provides a comprehensive guide to tune the model for their specific hardware and quality requirements.

Quick Start

Use the diffusion-optimal-perf skill to achieve maximum speed for a video diffusion model on 8 GPUs using lossless optimizations.

Frequently Asked Questions about diffusion-optimal-perf

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize Stable Diffusion inference speed and reduce latency for production?

To optimize Stable Diffusion inference, you can apply lossless techniques like torch.compile and multi-GPU parallelism, or use lossy methods like approximate attention and quantized models to significantly reduce latency and VRAM usage.

What is the difference between lossless and lossy diffusion model optimizations?

Lossless diffusion model optimizations, such as torch.compile and warm-up, improve speed without altering output quality. Lossy optimizations, like approximate attention and quantized models, trade minor image fidelity for significant speed and VRAM reductions.

How can I lower VRAM usage when running diffusion models?

You can lower VRAM usage by enabling layerwise offload, utilizing approximate attention, or deploying quantized models. These lossy optimization techniques significantly reduce memory consumption during diffusion model inference.

Can I use multi-GPU parallelism to speed up video diffusion model inference?

Yes, you can use multi-GPU parallelism to speed up video diffusion inference. Techniques like sequence parallelism and CFG parallelism maximize performance across multiple GPUs without sacrificing output quality.

What CLI flags and environment variables are needed for SGLang-Diffusion performance tuning?

SGLang-Diffusion performance tuning requires specific CLI flags and environment variables to control techniques like torch.compile, multi-GPU parallelism, layerwise offload, and quantized models for optimal production deployment.

When should I use approximate attention instead of torch.compile for diffusion inference?

Use approximate attention when you need significant VRAM reductions and faster inference, accepting minor quality loss. Choose torch.compile for lossless speedups that maintain exact output fidelity during diffusion model inference.