Skip to content

Instantly share code, notes, and snippets.

View aicrumb's full-sized avatar
😇
Casting Spells

crumb aicrumb

😇
Casting Spells
View GitHub Profile
@aicrumb
aicrumb / instruct-processor.py
Last active November 14, 2024 17:03
code generated by GPT-4 for this
def pack_bins(token_lengths, max_length):
token_lengths = [l+1 for l in token_lengths]
token_pairs = sorted([(l, i) for i, l in enumerate(token_lengths)], reverse=True)
bins = []
for length, index in token_pairs:
for bin in bins:
if sum(bin[0]) + length <= max_length:
bin[0].append(length)
bin[1].append(index)
break
@aicrumb
aicrumb / error.txt
Created July 14, 2023 20:17
bnb free tier colab error, installed with "!pip install -q -U bitsandbytes"
/usr/local/lib/python3.10/dist-packages/bitsandbytes/cuda_setup/main.py:106: UserWarning:
================================================================================
WARNING: Manual override via CUDA_VERSION env variable detected!
CUDA_VERSION=XXX can be used to load a bitsandbytes version that is different from the PyTorch CUDA version.
If this was unintended set the CUDA_VERSION variable to an empty string: export CUDA_VERSION=
If you use the manual override make sure the right libcudart.so is in your LD_LIBRARY_PATH
For example by adding the following to your .bashrc: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path_to_cuda_dir/lib64
Loading CUDA version: CUDA_VERSION=11.8.0
================================================================================
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aicrumb
aicrumb / test.md
Last active November 5, 2022 08:05

me recap (2022 code catalog)

Things I've made this year (that I can remember, not in order of complexity nor chronologically in order)

Quick Inversion, approximate textual-inversion in seconds instead of hours.

Doohickey, A diffusers-based wrapper for stable diffusion, one of (if not? someone fact check) the first public notebooks to incorporate CLIP guidance, loading of any model from the huggingface hub (diffusers or compvis style), and more.

Whatchamacallit an alternative wrapper for simplified use of Stable Diffusion with diffusers pipelines.

Experiments in Adversarial Noise for corrupting an image upon encoding of the VQGAN used in Stable Diffusion. (In response to a tweet about an

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aicrumb
aicrumb / running.txt
Created October 19, 2022 07:35
my custom dreamboth scripts that are a bit weird, copy these cells into your notebook
#@title launch training script
#@markdown say no to using deepspeed, it screws it up and uses >16gb vram for some reason if using the 8bit_adam
!accelerate config
!accelerate launch train_dreambooth.py \
--pretrained_model_name_or_path="$model_name" \
--instance_data_dir="$instance_dir" \
--class_data_dir="$control_dir" \
--output_dir=$output_dir \
--instance_prompt="$instance_prompt" \
--resolution=384 \
@aicrumb
aicrumb / test.py
Last active October 9, 2022 06:27
whatchamacallit-lite
#@title import libraries
import torch
from torch import autocast
from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline, StableDiffusionInpaintPipeline
from diffusers import LMSDiscreteScheduler, DDIMScheduler, KarrasVeScheduler, PNDMScheduler, DDPMScheduler
import torchvision.transforms.functional as f
from torch import nn
from IPython.display import display, Image, clear_output
from tqdm.auto import trange
from huggingface_hub import hf_hub_download
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aicrumb
aicrumb / modded_simple_stable.ipynb
Last active September 7, 2022 21:35
if you use these credit me / tag me so i can see
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.