Skip to content

Instantly share code, notes, and snippets.

@Acephalia
Acephalia / enviorenmentfixes.md
Last active April 22, 2025 01:49
Quick Guide For Fixing/Installing Python, PyTorch, CUDA, Triton, Sage Attention and Flash Attention For Local AI Image Generation

Quick Guide For Fixing/Installing Python, PyTorch, CUDA, Triton, Sage Attention and Flash Attention For Local AI Image Generation

With all the new local image & video generation tools coming out I've been seeing a lot of posts and error threads being opened for various issues with cuda/pytorch/sage attantion/triton/flash attention. I was tired of digging links up so I initially made this as a cheat sheet for myself but expanded it with hopes that this will help some of you get your venvs and systems running smoothly.

In This Guide:

  1. Check Installed Python Versions
  2. Set Default Python Version by Changing PATH
  3. Installing VS Build Tools
  4. Check the Currently Active CUDA Version
@Acephalia
Acephalia / visualstudioinstall.md
Created April 19, 2025 23:45
Visual Studio Build Tools Installation Guide for Local AI Image Generation

Visual Studio Build Tools Installation Guide for AI Image Generation

Visual Studio Build Tools are essential for running ComfyUI, Stable Diffusion, Flux, Forge, and similar AI image generation tools locally on Windows. These tools provide the necessary C++ compiler and build environment required by many Python packages and CUDA-based applications. This guide will help you install the appropriate Visual Studio Build Tools to resolve common dependency issues.

1. Understanding VS Build Tools Versions

Visual Studio Build Tools come in several versions, with VS Build Tools 2022 being the latest as of April 2025. For most AI image generation tools, you'll need the C++ build tools component which provides the necessary compiler and libraries.

  • VS Build Tools 2022 – Latest version, recommended for newer applications
  • VS Build Tools 2019 – Still widely compatible with most AI tools
@Acephalia
Acephalia / versioncheck.py
Created April 18, 2025 22:41
PyTorch Environment Version Check: Python, Torch, CUDA, Torchvision, Torchaudio, Flash-Attention, Triton, and SageAttention Dependencies
import sys
import torch
import torchvision
import torchaudio
print("python version:", sys.version)
print("python version info:", sys.version_info)
print("torch version:", torch.__version__)
print("cuda version (torch):", torch.version.cuda)
print("torchvision version:", torchvision.__version__)
@Acephalia
Acephalia / wcgd.php
Last active January 7, 2025 09:50
WooCommerce Dynamic Shop Wide Global Discount
/*
* @snippet WooCommerce Shope Wide Global Discount
* @author https://gist.github.com/Acephalia
* @caffeinate https://buymeacoffee.com/acephaliax
* @Usage Activate via code snippets and change discount amount at line 11.
*/
class WC_Dynamic_Global_Discount {
// CHANGE DISCOUNT PERCENTAGE HERE
@Acephalia
Acephalia / wpssc.php
Created December 12, 2024 10:57
WordPress Spoiler Shortcode
/*
* @snippet WordPress Spoiler Shortcode
* @author https://gist.github.com/Acephalia
* @caffeinate https://buymeacoffee.com/acephaliax
* @Usage [spoiler]Your hidden content here[/spoiler]
*/
function spoiler_shortcode($atts, $content = null) {
// Unique ID to ensure multiple spoilers work correctly
static $spoiler_count = 0;
@Acephalia
Acephalia / ddisou.php
Created September 11, 2024 22:52
Disable Divi Image Size Generation On Upload
/*
* @snippet Disable Divi Image Size Generation On Upload
* @author https://gist.github.com/Acephalia
* @caffeinate https://buymeacoffee.com/acephaliax
*/
function disable_divi_image_sizes() {
// Remove all image sizes registered by Divi
remove_image_size('et-pb-post-main-image'); // Divi's post main image size
remove_image_size('et-pb-portfolio-image'); // Divi's portfolio image size
@Acephalia
Acephalia / wcnonop.php
Created August 19, 2024 01:13
Resend WooCommerce New Order Notification On Processing
/*
* @snippet Resend WooCommerce new order notification to admin when order status changes to processing
* @author https://gist.github.com/Acephalia
* @caffeinate https://buymeacoffee.com/acephaliax
*/
// Allow resending of New Order emails
add_filter('woocommerce_new_order_email_allows_resend', '__return_true');
// Resend New Order notification when order status changes to processing
@Acephalia
Acephalia / wcaopecc.php
Created August 12, 2024 23:38
WooCommerce Add CC Address To Order Processing Email
/*
* @snippet WooCommerce Add CC Address To Order Processing Email
* @description This snippet will allow you to send the order processing email to a secondary email as a CC
* @author u/acephaliax
* @caffeinate https://buymeacoffee.com/acephaliax
*/
add_filter('woocommerce_email_headers', 'add_cc_to_processing_order_email', 10, 3);
function add_cc_to_processing_order_email($headers, $email_id, $order) {
@Acephalia
Acephalia / wcesr.php
Created July 8, 2024 13:39
Extend WooCommerce search results to include tags, descriptions and price
/*
* @snippet Extend WooCommerce search to include tags, descriptions and price
* @author u/acephaliax
* @source https://insomniainc.com/resources/code-snippets/woocommerce/how-to-extend-woocommerce-search-results-to-show-product-tags-descriptions-sku-and-price/
* @compatibility Last tested on WooCommerce 9.0.1
* @community r/wordpress, r/woocommerce
* @caffeinate https://buymeacoffee.com/acephaliax
*/
@Acephalia
Acephalia / wcvsosp.php
Created July 4, 2024 09:54
Woocommerce Variation Selectors & Add To Cart Button For Variable Products On Shop Pages
/*
* @snippet Display Variation Selectors & Add To Cart Button For Variable Products On Woocommerce Shop Pages
* @author u/acephaliax
* @source https://insomniainc.com/resources/uncategorized/variation-selectors-add-to-cart-button-for-variable-products-on-woocommerce-shop-pages/
* @compatibility Last tested on WooCommerce 9.0.1
* @community r/wordpress, r/woocommerce
* @caffeinate https://buymeacoffee.com/acephaliax
*/
// Enqueue necessary scripts for shop and archive pages