Skip to content

Instantly share code, notes, and snippets.

@madebyollin
madebyollin / Mamba_Diffusion_IADB_Colab.ipynb
Created December 6, 2023 04:47
Mamba Diffusion (IADB)
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 April 17, 2024 07:39
notes_on_sd_vae

Notes / Links about Stable Diffusion VAE

Stable Diffusion's VAE is a neural network that encodes and decodes images into a compressed "latent" format. 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.

VAE Versions & Lineage

  • CompVis

Variational Autoencoders Will Never Work

So you want to generate images with neural networks. You're in luck! VAEs are here to save the day. They're simple to implement, they generate images in one inference step (unlike those awful slow autoregressive models) and (most importantly) VAEs are 🚀🎉🎂🥳 theoretically grounded 🚀🎉🎂🥳 (unlike those scary GANs - don't look at the GANs)!

The idea

The idea of VAE is so simple, even an AI chatbot could explain it:

  1. Your goal is to train a "decoder" neural network that consumes blobs of random noise from a fixed distribution (like torch.randn(1024)), interprets that noise as decisions about what to generate, and produces corresponding real-looking images. You want to train this network with nice simple image-space MSE loss against your dataset of real images.

Reinforcement Learning for Language Models

Yoav Goldberg, April 2023.

Why RL?

With the release of the ChatGPT model and followup large language models (LLMs), there was a lot of discussion of the importance of "RLHF training", that is, "reinforcement learning from human feedback". I was puzzled for a while as to why RL (Reinforcement Learning) is better than learning from demonstrations (a.k.a supervised learning) for training language models. Shouldn't learning from demonstrations (or, in language model terminology "instruction fine tuning", learning to immitate human written answers) be sufficient? I came up with a theoretical argument that was somewhat convincing. But I came to realize there is an additional argumment which not only supports the case of RL training, but also requires it, in particular for models like ChatGPT. This additional argument is spelled out in (the first half of) a talk by John Schulman from OpenAI. This post pretty much

@madebyollin
madebyollin / list_of_good_image_generator_training_logs.md
Last active February 10, 2024 02:25
List of good image generator training logs

List of good image generator training logs

A list of public training logs from neural network image generation models, since I think they're interesting.

The Criteria

  • Publicly accessible link
  • Losses plotted every so often
  • Samples generated every so often
  • Nontrivial dataset (i.e. not MNIST - 64x64 output RGB or better)
function svg2png(svgContent, width, height, callback) {
// svgContent should be in base64
let svgData = svgContent;
let canvas = document.createElement("canvas");
let context = canvas.getContext("2d");
canvas.width = width;
canvas.height = height;
let image = new Image();
@ssrihari
ssrihari / clojure-learning-list.md
Last active April 15, 2024 14:54
An opinionated list of excellent Clojure learning materials

An opinionated list of excellent Clojure learning materials

These resources (articles, books, and videos) are useful when you're starting to learn the language, or when you're learning a specific part of the language. This an opinionated list, no doubt. I've compiled this list from writing and teaching Clojure over the last 10 years.

  • 🔴 Mandatory (for both beginners and intermediates)
  • 🟩 For beginners
  • 🟨 For intermediates

Table of contents

  1. Getting into the language
@madebyollin
madebyollin / stable_diffusion_m1.py
Last active February 10, 2024 02:25
Stable Diffusion on Apple Silicon GPUs via CoreML; 2s / step on M1 Pro
# ------------------------------------------------------------------
# EDIT: I eventually found a faster way to run SD on macOS, via MPSGraph (~0.8s / step on M1 Pro):
# https://github.com/madebyollin/maple-diffusion
# The original CoreML-related code & discussion is preserved below :)
# ------------------------------------------------------------------
# you too can run stable diffusion on the apple silicon GPU (no ANE sadly)
#
# quick test portraits (each took 50 steps x 2s / step ~= 100s on my M1 Pro):
# * https://i.imgur.com/5ywISvm.png
@aerdely
aerdely / ArturoCovid.jl
Created June 21, 2022 17:12
Procesar datos COVID-19
### Procesar datos SSalud para modelo compartimental
using CSV, DataFrames, Dates
## Cargar datos
@time begin
fechaDate = Date(2022,6,16)
archivo = "220616COVID19MEXICO.csv"
@dienhoa
dienhoa / docment-notes.md
Last active February 19, 2022 05:20
It's my note about useful commands I use during the docment sprint https://github.com/muellerzr/fastai-docment-sprint

Run 3 commands below when you prepare your PR

nbdev_build_lib 

nbdev_build_docs —fname {path the to file}

nbdev_clean_nbs