--- id: k-diffusion version: "0.1.1.post1" license: MIT license_treatment: permissive maintenance: aging --- # k-diffusion — Karras et al. (2022) diffusion models for PyTorch License: permissive · Maintenance: aging · Downloads: 120.1K/mo ## What it is and what it does k-diffusion is a research-oriented PyTorch library that implements the diffusion model design space from Karras et al. (2022). It provides training and sampling infrastructure for diffusion-based generative models, with particular emphasis on improved sampling algorithms like DPM-Solver and support for transformer-based architectures. The library includes wrappers to use models from other frameworks with its own samplers, plus features like CLIP-guided sampling, FID and KID evaluation during training, and log-likelihood calculation. The package is designed primarily for research and experimentation rather than production deployment. Installation via PyPI gives you the library code for use as a dependency, while full training and inference scripts require cloning the repository. The 17 runtime dependencies—including torch, torchvision, accelerate, and various image and math libraries—mean this is a heavyweight addition to any environment, intended for GPU-based machine learning workflows. Use it for: - Train diffusion models on custom datasets with multi-GPU support via accelerate - Experiment with transformer-based diffusion architectures as an alternative to convolutional designs - Sample from diffusion models using DPM-Solver with adaptive step control for quality at low step counts - Perform CLIP-guided generation from unconditional diffusion models - Evaluate model quality during training using FID and KID metrics - Wrap and sample from models trained with other frameworks using k-diffusion's samplers ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. k-diffusion is a PyTorch library implementing diffusion-based generative models from Karras et al. (2022), with improved sampling algorithms, transformer-based model support, and compatibility wrappers for other diffusion frameworks. Yes, if you are actively researching diffusion models or need a flexible PyTorch-native training framework with advanced sampling algorithms. The aging maintenance status (no releases since 2023-12-07) and substantial dependency footprint make it less suitable for production systems or lightweight prototyping. No known security vulnerabilities. Best suited for GPU-equipped research environments. ## Install pip install k-diffusion uv add k-diffusion poetry add k-diffusion ## Installing k-diffusion Before you install: Low install friction with a pure-Python wheel, but 17 runtime dependencies including torch, torchvision, and accelerate create a substantial environment footprint. Maintenance status is aging—last release was 2023-12-07, though the repository remains unarchived. License in practice: MIT license is permissive, allowing commercial and private use with minimal restrictions beyond attribution. Quickstart: pip install k-diffusion import k_diffusion # For full training/inference scripts, clone the repository and run: pip install -e . Requires torch and torchvision; GPU strongly recommended for practical use. Full training scripts require repository clone, not available via PyPI install alone. Verify before relying: - Whether the package's transformer diffusion enhancements are production-ready or experimental - Current state of latent diffusion support (listed as 'To do' in the description) - Compatibility with recent PyTorch and torchvision versions given the aging maintenance status ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: aging - Downloads: 120.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags diffusion model pytorch, generative model training, karras diffusion implementation, dpm-solver sampling, transformer diffusion models, clip guided sampling, diffusion model library, diffusion-models, generative-ai, research [View on SkillFed](https://skillfed.io/packages/k-diffusion) · [View on PyPI](https://pypi.org/project/k-diffusion/)