yoavhacohen / MegaEdit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MegaEdit

A collection of works on inversion and diffusion image editing via feature/attention injection.

barack2 (5) copy land

NOTE: this is not compatible with Xformers, but it does support sliced attention if you are experiencing memory issues

This repo was originally based off of prompt2prompt but contains a number of improvements and implementations of other papers + some of my own stuff

This includes:

My own addons include:

  • injecting an interpolation of original and proposed features, which is on a schedule. This allows us to have influence from the original features much further into the generation without fully taking over the generation. This gradual approach may confer similar benefits to (https://github.com/pix2pixzero/pix2pix-zero)
  • split guidance scale. This allows to do inversion without classifier free guidance for stability, but do editing at a different guidance scale
  • Gaussian Smoothed attention. the original intention behind this was to allow attention to cover more ground before amplifying it. Instead, I am noticing less erratic details and less of a photobashed look. See the examples below.
  • (WIP) An attempt at gradient-free attend and excite by locally amplifying attention in a region of the image. This isn't optimal as original method optimizes latents, but hope that giving special care to certain tokens can help give a simiilar effect without adding too much time/VRAM
  • Some other QoL improvements for easy deployment and demystifying some of the parameters

Usage:

  1. set up torch environment of choice
  2. git clone this repo
  3. pip install -r requirements.txt
  4. run the notebook!

Smoothing example: Screen Shot 2023-02-21 at 5 47 16 PM

Other editing examples

david edits

david refines

superhero

download (25)

link edits

Me

Usefulness of attention reweighing, an alternative to how automatic1111 does it which is at the text encoder level, and better solution for when SD isn't listening to your prompt.

Screen Shot 2023-02-03 at 2 24 24 PM

About


Languages

Language:Python 97.2%Language:Jupyter Notebook 2.8%