Skip to content

Instantly share code, notes, and snippets.

View madebyollin's full-sized avatar

Ollin Boer Bohan madebyollin

View GitHub Profile
@madebyollin
madebyollin / mysterious_bugs.md
Created October 18, 2024 15:11
mysterious_bugs.md

mysterious software bugs I encounter, like, daily

  • if I add/destroy enough video tags (i.e. in periodic output display from a long-running jupyter notebook) Safari will eventually stop rendering all video tags across all pages until I reboot the browser
  • if I interleave autocast and no_grad scopes in the wrong way (I think - autocast with no_grad inside followed by not-no-grad stuff?) pytorch will silently disable grad for the entire autocast scope
  • if I edit colab notebooks (specific ones? on a specific connection? idk), I intermittently get "this notebook has been modified" conflict-resolution dialogs despite being the only editor of the notebook
  • if I don't manually disable the collaborative extension on jupyterlab, it will intermittently teleport my cursor focus back to the first cell in the notebook

need to eventually find repro instructions and chase all of these down to fix

@madebyollin
madebyollin / stable_notebook_diffusers_model_previewing_hacks.py
Created August 31, 2024 13:53
Hacks for stable (non-flickery) preview demo of diffusers FLUX.1 model in jupyter notebooks
from IPython.display import HTML
def get_pred_original_sample(sched, model_output, timestep, sample):
return sample - sched.sigmas[(sched.timesteps == timestep).nonzero().item()] * model_output
# TODO: fix awful globals
prev_img_str = None
def pil_to_html(pil_img, h=IM_HEIGHT, w=IM_WIDTH):
global prev_img_str

Objective

Informal (vibes-based) evaluation of the following vision-language-model captioners:

  • Florence-2-base-ft
  • CogVLM2
  • BLIP-2
  • MoonDream2
  • Share-Captioner
  • Florence-2-SD3-Captioner
@madebyollin
madebyollin / sd3_gradio_demo_with_taesd_preview.py
Created June 15, 2024 23:19
A quick hacked version of the sd3 gradio UI that has live previews (via TAESD3)
#!/usr/bin/env python3
import gradio as gr
import numpy as np
import random
import torch
from diffusers import (
StableDiffusion3Pipeline,
SD3Transformer2DModel,
FlowMatchEulerDiscreteScheduler,
AutoencoderTiny,
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@madebyollin
madebyollin / automatic_profiling_markers.py
Created February 27, 2024 02:57
Add human-readable profiling markers to a pytorch module
def add_profiling_markers(model):
"""Monkey-patch profiling markers into an nn.Module.
Args:
model: an nn.Module
Effect:
all model.named_module() forward calls get wrapped in their
own profiling scope, making traces easier to understand.
"""
@madebyollin
madebyollin / Mamba_Diffusion_IADB_Colab.ipynb
Created December 6, 2023 04:47
Mamba Diffusion (IADB)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@madebyollin
madebyollin / notes_on_sd_vae.md
Last active December 3, 2024 15:30
notes_on_sd_vae

Notes / Links about Stable Diffusion VAE

Stable Diffusion's VAE is a neural network that encodes images into a compressed "latent" format and decodes them back. The encoder performs 48x lossy compression, and the decoder generates new detail to fill in the gaps.

(Calling this model a "VAE" is sort of a misnomer - it's an encoder with some very slight KL regularization, and a conditional GAN decoder)

This document is a big pile of various links with more info.

@madebyollin
madebyollin / README.md
Last active April 2, 2024 13:50 — forked from mrsteyk/README.md
dalle_runner_api.model_infra.modules.public_diff_vae
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.