Skip to content

u/Doggettx

In this archive from Nov 2011 to Nov 2026

6
posts
84
comments
4
media
820
score

Top posts

Top comments

Fork is here

Only makes changes to single function in attention.py, so should be easy to copy over to other forks. It's based on a change I proposed yesterday to neonsecret's fork

It uses automatic splitting of work into blocks that fit into your GPU's memory. Allows for rendering higher than 2048x2048 on a 3090 while not affecting speed when running lower resolutions. Does assume rendering at half precision, will post a fix later to also support full precision.

Realistically though, you can't go higher than 2048x1536 (or 3MP) without breaking other parts of the model. I might fix those too but not sure if it's worth it, rendering at 3MP is already pretty slow (about 2 minutes for 25 steps on a 3090).

Provided example image prompt is (from libraire.ai):

pebble beach waterfall, extremely detailed oil painting, unreal 5 render, rhads, sargent and leyendecker, savrasov levitan polenov, bruce pennington, studio ghibli, tim hildebrandt, digital art, landscape painting, octane render, beautiful composition, trending on artstation, award winning photograph, masterpiece

Edit (5 sept):
I just checked in some changes to model.py as well, this should allow people to go higher who are crashing after rendering is done 100% (might still happen at even higher resolutions, but shouldn't happen as fast now)**

Rendered this with a 3090 at 4096x1024 going much higher increases memory usage exponentially, so probably not very feasible

Edit2 (6 sept):
Just checked in another update to fix the available memory calculation, should fix some crashes people were having at unexpected resolutions. Also added an error that is thrown when you don't have enough VRAM available to run the batch. Also gives an approximation of your maximum possible resolution at current free VRAM levels.

32 points

Simple implementation of promp2prompt by using prompt swapping, got the idea after reading the post from /u/bloc97

Github branch for changes is here:https://github.com/Doggettx/stable-diffusion/tree/prompt2prompt

or specific commit:
https://github.com/CompVis/stable-diffusion/commit/3b5c504bb0c11a882252c0eb2b1955474913313a

Changes for existing files is minor, should be easy to implement in existing forks.

Prompts work the same way as before but you can swap out text during rendering.Replacing concepts is done by:

[old concept:new concept:step]

where step is a step # or a percentage of all steps when < 1(so at 50 steps, .5 and 25 are the same), inserting new concepts:

[new concept:step]

removing concepts:

[old concept::step]

Only modified the ddim sampler in the example code, but can be added to any sampler with just a few lines of code. Doesn't increase render time, just slightly higher initialization time due to having to process multiple prompts.

See post image for example prompts on how to replace parts of an image

P.S. this is a much simpeler method than using the attention map editing, but it still seems to give good results while not sacrificing performance

Edit: updated version at https://github.com/Doggettx/stable-diffusion/tree/prompt2prompt-v2 or check in at https://github.com/CompVis/stable-diffusion/commit/ccb17b55f2e7acbd1a112b55fb8f8415b4862521 comes with negative prompts and ability to change guidance scale through prompt, also much easier to add to existing forks.

22 points

I made the GUI, it calls a custom implementation of SD that runs as a flask API. I'll probably release it later after I clean up everything and figure out a way to make the install easier. Currently it requires a lot of manual installing of all the components.

It's a bit hacky at the moment as I never used Python before, but works a lot easier than the CLI.. Got k-diffusion/ESRGAN/GFPGAN and custom masks added to the original code so I can do all the extra stuff. With some drawing tools so I can quickly create masks/overlays to test out things.

Best part is though that when saving an image it also saves the prompt and all the settings in the image file, so you can reload it from a previous image if you want to try different prompts or settings.

19 points

It's not in there by default, but it's pretty easy to add, you can just add a mask param and x0 param to the decode function and then do

        if mask is not None:
            x_dec = x_dec * mask + (1. - mask) * x0

before p_sample_ddim is called, a code example for creating masks is already in there since txt2img already can take a mask.

Strangely enough, the masks work really bad in txt2img but pretty good in img2img.

Example 1
Example 2

15 points

Subreddits

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.