Skip to content

Instantly share code, notes, and snippets.

@Marcus-Arcadius
Marcus-Arcadius / Windows command line gui access.md
Created January 11, 2023 05:06 — forked from shoodidagen/Windows command line gui access.md
Common windows functions via rundll user32 and control panel

Rundll32 commands

OS: Windows 10/8/7

Add/Remove Programs

  • RunDll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,0

Content Advisor

  • RunDll32.exe msrating.dll,RatingSetupUI

Control Panel

@Marcus-Arcadius
Marcus-Arcadius / imagenet1000_clsidx_to_labels.txt
Created December 20, 2022 09:40 — forked from yrevar/imagenet1000_clsidx_to_labels.txt
text: imagenet 1000 class idx to human readable labels (Fox, E., & Guestrin, C. (n.d.). Coursera Machine Learning Specialization.)
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',
@Marcus-Arcadius
Marcus-Arcadius / convert_to_safe.py
Created December 11, 2022 06:10 — forked from zer0TF/convert_to_safe.py
Convert all CKPT files to SAFETENSOR files in a directory
# Got a bunch of .ckpt files to convert?
# Here's a handy script to take care of all that for you!
# Original .ckpt files are not touched!
# Make sure you have enough disk space! You are going to DOUBLE the size of your models folder!
#
# First, run:
# pip install torch torchsde==0.2.5 safetensors==0.2.5
#
# Place this file in the **SAME DIRECTORY** as all of your .ckpt files, open a command prompt for that folder, and run:
# python convert_to_safe.py

Waifu Diffusion 1.4 Overview

An image generated at resolution 512x512 then upscaled to 1024x1024 with Waifu Diffusion 1.3 Epoch 7.

Goals

  • Improving image generation at different aspect ratios using conditional masking during training. This will allow for the entire image to be seen during training instead of center cropped images, which will allow for better results when generating full body images, portraits, and improving the composition.
  • Expanded the input context from 77 tokens to 231 tokens or perhaps to an unlimited amount of tokens. Out of 77 tokens for input, only 75 are useable. This does not give nearly enough room for complex prompting that requires a lot of detail.
import math
import os
import sys
import traceback
import modules.scripts as scripts
import gradio as gr
from modules.processing import Processed, process_images
@Marcus-Arcadius
Marcus-Arcadius / alternate_sampler_noise_schedules.py
Created October 17, 2022 00:24 — forked from dfaker/alternate_sampler_noise_schedules.py
Alternate sampler noise schedules for stable-diffusion-webui
import inspect
from modules.processing import Processed, process_images
import gradio as gr
import modules.scripts as scripts
import k_diffusion.sampling
import torch
class Script(scripts.Script):
@Marcus-Arcadius
Marcus-Arcadius / convert_diffusers_to_sd_colab.py
Created October 2, 2022 23:53 — forked from jachiam/convert_diffusers_to_sd_colab.py
Copy and paste this into a colab cell to use the model conversion script
# Script for converting a HF Diffusers saved pipeline to a Stable Diffusion checkpoint.
# *Only* converts the UNet, VAE, and Text Encoder.
# Does not convert optimizer state or any other thing.
import os
import os.path as osp
import torch
# =================#
# UNet Conversion #
@Marcus-Arcadius
Marcus-Arcadius / git-updater
Created September 26, 2022 08:06 — forked from adilbaig/git-updater
A bash script to update your git repos in the background. It also pops up a user notification when a repo is synced
#!/bin/bash
# This is required for `notify-send` to work from within a cron.
# http://askubuntu.com/questions/298608/notify-send-doesnt-work-from-crontab/346580#346580
eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";
# syncAndWink
#
# Syncs all remotely-tracked branches on a git repo passed as first argument ($1). It also pulls any new branches
# and tags attached to the repo.
@Marcus-Arcadius
Marcus-Arcadius / bnb_example.py
Created September 21, 2022 15:58 — forked from younesbelkada/bnb_example.py
A minimal script to run `bitsandbytes` int8 inference
import torch
import torch.nn as nn
from bitsandbytes.nn import Linear8bitLt
# Utility function
def get_model_memory_footprint(model):
r"""
Partially copied and inspired from: https://discuss.pytorch.org/t/gpu-memory-that-model-uses/56822/2
import numpy as np
from numba import jit
@jit(nopython=True)
def golden_dp_impl(num_layers, num_devices, num_microbatches, submesh_choices,
num_autosharding_configs, compute_cost, max_n_succ_stages,
max_stage_cost):
"""The core implementation of the DP algorithm."""
# For f, layer ID start from 0