Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    8 of 610 committers (1.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.0%) to scientific vocabulary

Keywords from Contributors

cryptocurrencies trading-bot trade telegram-bot freqtrade algorithmic-trading test-generation voice-conversion text-to-speech spoken-language-understanding

Scientific Fields

Artificial Intelligence and Machine Learning Computer Science - 87% confidence
Computer Science Computer Science - 63% confidence
Last synced: 6 months ago · JSON representation ·

Repository

Basic Info
  • Host: GitHub
  • Owner: lllyasviel
  • License: agpl-3.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 45.3 MB
Statistics
  • Stars: 11,291
  • Watchers: 110
  • Forks: 1,223
  • Open Issues: 1,076
  • Releases: 2
Created about 2 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog License Citation Codeowners

README.md

Stable Diffusion WebUI Forge

Stable Diffusion WebUI Forge is a platform on top of Stable Diffusion WebUI (based on Gradio ) to make development easier, optimize resource management, speed up inference, and study experimental features.

The name "Forge" is inspired from "Minecraft Forge". This project is aimed at becoming SD WebUI's Forge.

Forge is currently based on SD-WebUI 1.10.1 at this commit. (Because original SD-WebUI is almost static now, Forge will sync with original WebUI every 90 days, or when important fixes.)

News are moved to this link: Click here to see the News section

Quick List

Gradio 4 UI Must Read (TLDR: You need to use RIGHT MOUSE BUTTON to move canvas!)

Flux Tutorial (BitsandBytes Models, NF4, "GPU Weight", "Offload Location", "Offload Method", etc)

Flux Tutorial 2 (Seperated Full Models, GGUF, Technically Correct Comparison between GGUF and NF4, etc)

Forge Extension List and Extension Replacement List (Temporary)

How to make LoRAs more precise on low-bit models; How to Skip" Patching LoRAs"; How to only load LoRA one time rather than each generation; How to report LoRAs that do not work

Report Flux Performance Problems (TLDR: DO NOT set "GPU Weight" too high! Lower "GPU Weight" solves 99% problems!)

How to solve "Connection errored out" / "Press anykey to continue ..." / etc

(Save Flux BitsandBytes UNet/Checkpoint)

LayerDiffuse Transparent Image Editing

Tell us what is missing in ControlNet Integrated

(Policy) Soft Advertisement Removal Policy

(Flux BNB NF4 / GGUF Q80/Q50/Q51/Q40/Q41 are all natively supported with GPU weight slider and Quene/Async Swap toggle and swap location toggle. All Flux BNB NF4 / GGUF Q80/Q50/Q40 have LoRA support.)

Installing Forge

Just use this one-click installation package (with git and python included).

>>> Click Here to Download One-Click Package (CUDA 12.1 + Pytorch 2.3.1) <<<

Some other CUDA/Torch Versions:

Forge with CUDA 12.1 + Pytorch 2.3.1 <- Recommended

Forge with CUDA 12.4 + Pytorch 2.4 <- Fastest, but MSVC may be broken, xformers may not work

Forge with CUDA 12.1 + Pytorch 2.1 <- the previously used old environments

After you download, you uncompress, use update.bat to update, and use run.bat to run.

Note that running update.bat is important, otherwise you may be using a previous version with potential bugs unfixed.

image

Advanced Install

If you are proficient in Git and you want to install Forge as another branch of SD-WebUI, please see here. In this way, you can reuse all SD checkpoints and all extensions you installed previously in your OG SD-WebUI, but you should know what you are doing.

If you know what you are doing, you can also install Forge using same method as SD-WebUI. (Install Git, Python, Git Clone the forge repo https://github.com/lllyasviel/stable-diffusion-webui-forge.git and then run webui-user.bat).

Previous Versions

You can download previous versions here.

Forge Status

Based on manual test one-by-one:

| Component | Status | Last Test | |-----------------------------------------------------|---------------------------------------------|--------------| | Basic Diffusion | Normal | 2024 Aug 26 | | GPU Memory Management System | Normal | 2024 Aug 26 | | LoRAs | Normal | 2024 Aug 26 | | All Preprocessors | Normal | 2024 Aug 26 | | All ControlNets | Normal | 2024 Aug 26 | | All IP-Adapters | Normal | 2024 Aug 26 | | All Instant-IDs | Normal | 2024 July 27 | | All Reference-only Methods | Normal | 2024 July 27 | | All Integrated Extensions | Normal | 2024 July 27 | | Popular Extensions (Adetailer, etc) | Normal | 2024 July 27 | | Gradio 4 UIs | Normal | 2024 July 27 | | Gradio 4 Forge Canvas | Normal | 2024 Aug 26 | | LoRA/Checkpoint Selection UI for Gradio 4 | Normal | 2024 July 27 | | Photopea/OpenposeEditor/etc for ControlNet | Normal | 2024 July 27 | | Wacom 128 level touch pressure support for Canvas | Normal | 2024 July 15 | | Microsoft Surface touch pressure support for Canvas | Broken, pending fix | 2024 July 29 | | ControlNets (Union) | Not implemented yet, pending implementation | 2024 Aug 26 | | ControlNets (Flux) | Not implemented yet, pending implementation | 2024 Aug 26 | | API endpoints (txt2img, img2img, etc) | Normal, but pending improved Flux support | 2024 Aug 29 | | OFT LoRAs | Broken, pending fix | 2024 Sep 9 |

Feel free to open issue if anything is broken and I will take a look every several days. If I do not update this "Forge Status" then it means I cannot reproduce any problem. In that case, fresh re-install should help most.

UnetPatcher

Below are self-supported single file of all codes to implement FreeU V2.

See also extension-builtin/sd_forge_freeu/scripts/forge_freeu.py:

```python import torch import gradio as gr

from modules import scripts

def Fourierfilter(x, threshold, scale): # FFT xfreq = torch.fft.fftn(x.float(), dim=(-2, -1)) xfreq = torch.fft.fftshift(xfreq, dim=(-2, -1))

B, C, H, W = x_freq.shape
mask = torch.ones((B, C, H, W), device=x.device)

crow, ccol = H // 2, W // 2
mask[..., crow - threshold:crow + threshold, ccol - threshold:ccol + threshold] = scale
x_freq = x_freq * mask

# IFFT
x_freq = torch.fft.ifftshift(x_freq, dim=(-2, -1))
x_filtered = torch.fft.ifftn(x_freq, dim=(-2, -1)).real

return x_filtered.to(x.dtype)

def patchfreeuv2(unetpatcher, b1, b2, s1, s2): modelchannels = unetpatcher.model.diffusionmodel.config["modelchannels"] scaledict = {modelchannels * 4: (b1, s1), modelchannels * 2: (b2, s2)} oncpudevices = {}

def output_block_patch(h, hsp, transformer_options):
    scale = scale_dict.get(h.shape[1], None)
    if scale is not None:
        hidden_mean = h.mean(1).unsqueeze(1)
        B = hidden_mean.shape[0]
        hidden_max, _ = torch.max(hidden_mean.view(B, -1), dim=-1, keepdim=True)
        hidden_min, _ = torch.min(hidden_mean.view(B, -1), dim=-1, keepdim=True)
        hidden_mean = (hidden_mean - hidden_min.unsqueeze(2).unsqueeze(3)) / (hidden_max - hidden_min).unsqueeze(2).unsqueeze(3)

        h[:, :h.shape[1] // 2] = h[:, :h.shape[1] // 2] * ((scale[0] - 1) * hidden_mean + 1)

        if hsp.device not in on_cpu_devices:
            try:
                hsp = Fourier_filter(hsp, threshold=1, scale=scale[1])
            except:
                print("Device", hsp.device, "does not support the torch.fft.")
                on_cpu_devices[hsp.device] = True
                hsp = Fourier_filter(hsp.cpu(), threshold=1, scale=scale[1]).to(hsp.device)
        else:
            hsp = Fourier_filter(hsp.cpu(), threshold=1, scale=scale[1]).to(hsp.device)

    return h, hsp

m = unet_patcher.clone()
m.set_model_output_block_patch(output_block_patch)
return m

class FreeUForForge(scripts.Script): sorting_priority = 12 # It will be the 12th item on UI.

def title(self):
    return "FreeU Integrated"

def show(self, is_img2img):
    # make this extension visible in both txt2img and img2img tab.
    return scripts.AlwaysVisible

def ui(self, *args, **kwargs):
    with gr.Accordion(open=False, label=self.title()):
        freeu_enabled = gr.Checkbox(label='Enabled', value=False)
        freeu_b1 = gr.Slider(label='B1', minimum=0, maximum=2, step=0.01, value=1.01)
        freeu_b2 = gr.Slider(label='B2', minimum=0, maximum=2, step=0.01, value=1.02)
        freeu_s1 = gr.Slider(label='S1', minimum=0, maximum=4, step=0.01, value=0.99)
        freeu_s2 = gr.Slider(label='S2', minimum=0, maximum=4, step=0.01, value=0.95)

    return freeu_enabled, freeu_b1, freeu_b2, freeu_s1, freeu_s2

def process_before_every_sampling(self, p, *script_args, **kwargs):
    # This will be called before every sampling.
    # If you use highres fix, this will be called twice.

    freeu_enabled, freeu_b1, freeu_b2, freeu_s1, freeu_s2 = script_args

    if not freeu_enabled:
        return

    unet = p.sd_model.forge_objects.unet

    unet = patch_freeu_v2(unet, freeu_b1, freeu_b2, freeu_s1, freeu_s2)

    p.sd_model.forge_objects.unet = unet

    # Below codes will add some logs to the texts below the image outputs on UI.
    # The extra_generation_params does not influence results.
    p.extra_generation_params.update(dict(
        freeu_enabled=freeu_enabled,
        freeu_b1=freeu_b1,
        freeu_b2=freeu_b2,
        freeu_s1=freeu_s1,
        freeu_s2=freeu_s2,
    ))

    return

```

See also Forge's Unet Implementation.

Under Construction

WebUI Forge is now under some constructions, and docs / UI / functionality may change with updates.

Owner

  • Login: lllyasviel
  • Kind: user

Lvmin Zhang (Lyumin Zhang)

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - given-names: AUTOMATIC1111
title: "Stable Diffusion Web UI"
date-released: 2022-08-22
url: "https://github.com/AUTOMATIC1111/stable-diffusion-webui"

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 6,766
  • Total Committers: 610
  • Avg Commits per committer: 11.092
  • Development Distribution Score (DDS): 0.736
Past Year
  • Commits: 645
  • Committers: 36
  • Avg Commits per committer: 17.917
  • Development Distribution Score (DDS): 0.285
Top Committers
Name Email Commits
AUTOMATIC 1****c@g****m 1,785
lllyasviel l****g@o****m 1,318
w-e-w 4****w 229
DepFA 3****r 164
Aarni Koskela a****x@i****i 151
catboxanon 1****n 133
Kohaku-Blueleaf 5****f 102
DenOfEquity 1****y 101
C43H66N12O12S2 3****2 81
brkirch b****h 77
missionfloyd m****d 71
Vladimir Mandic m****0@l****m 57
AngelBottomless 3****h 55
space-nuko 2****o 53
papuSpartan m****u@g****m 45
yfszzx y****x@g****m 44
Dynamic b****e@n****m 41
dtlnor d****r@h****m 41
Vladimir Repin 3****n 38
Chenlei Hu c****u@m****a 37
Danil Boldyrev d****3@g****m 36
Muhammad Rizqi Nur r****0@g****m 36
d8ahazard d****d@g****m 36
invincibledude 36
CodeHatchling s****e@c****m 34
v0xie 2****e 33
timntorres t****s@g****m 30
Jabasukuriputo Wang w****w 29
EllangoK k****7@g****m 28
Sakura-Luna 5****a 28
and 580 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 1,580
  • Total pull requests: 510
  • Average time to close issues: 20 days
  • Average time to close pull requests: 9 days
  • Total issue authors: 1,081
  • Total pull request authors: 145
  • Average comments per issue: 1.37
  • Average comments per pull request: 1.36
  • Merged pull requests: 279
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 696
  • Pull requests: 256
  • Average time to close issues: 14 days
  • Average time to close pull requests: 5 days
  • Issue authors: 530
  • Pull request authors: 62
  • Average comments per issue: 1.55
  • Average comments per pull request: 1.39
  • Merged pull requests: 143
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • andy8992 (30)
  • kalle07 (25)
  • danilomaiaweb (11)
  • psydok (10)
  • DarkViewAI (9)
  • dhp666 (9)
  • ZeroCool22 (9)
  • altoiddealer (9)
  • dermesut (8)
  • pflky (8)
  • VeteranXT (8)
  • carlmoss22 (7)
  • ClothingAI (7)
  • qw381523977 (7)
  • huchenlei (7)
Pull Request Authors
  • DenOfEquity (132)
  • lllyasviel (49)
  • huchenlei (45)
  • altoiddealer (27)
  • wonderinglostsoul44 (26)
  • catboxanon (19)
  • Haoming02 (11)
  • continue-revolution (10)
  • wcole3 (10)
  • croquelois (6)
  • spawner1145 (6)
  • Panchovix (4)
  • shinshin86 (4)
  • drhead (4)
  • psydok (4)
Top Labels
Issue Labels
enhancement (108) bug (20) Under Construction (5) High Priority (4) invalid (4) Can Not Reproduce (4) help wanted (3) User Did Not Read Document (2) extension request (2) User Mistake (2) pending upstream (1) User Did Not Update (1) AMD (1) Performance (1) Announcement (1) Official (1) documentation (1)
Pull Request Labels

Dependencies

.github/workflows/on_pull_request.yaml actions
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • actions/setup-python v4 composite
.github/workflows/run_tests.yaml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
.github/workflows/warns_merge_master.yml actions
extensions-builtin/forge_legacy_preprocessors/annotator/zoe/zoedepth/models/base_models/midas_repo/Dockerfile docker
  • nvidia/cuda 10.2-cudnn7-runtime-ubuntu18.04 build
package.json npm
  • eslint ^8.40.0 development
extensions-builtin/forge_legacy_preprocessors/annotator/oneformer/oneformer/modeling/pixel_decoder/ops/setup.py pypi
extensions-builtin/forge_legacy_preprocessors/requirements.txt pypi
  • fvcore *
  • mediapipe *
  • onnxruntime *
  • opencv-python >=4.8.0
  • svglib *
extensions-builtin/forge_preprocessor_normalbae/annotator/normalbae/models/submodules/efficientnet_repo/requirements.txt pypi
  • torch >=1.2.0
  • torchvision >=0.4.0
extensions-builtin/forge_preprocessor_normalbae/annotator/normalbae/models/submodules/efficientnet_repo/setup.py pypi
  • torch *
  • torchvision *
extensions-builtin/sd_forge_controlnet/requirements.txt pypi
  • fvcore *
  • mediapipe *
  • onnxruntime *
  • opencv-python >=4.8.0
  • svglib *
pyproject.toml pypi
requirements-test.txt pypi
  • pytest * test
  • pytest-base-url * test
  • pytest-cov * test
requirements.txt pypi
  • GitPython *
  • Pillow *
  • accelerate *
  • blendmodes *
  • clean-fid *
  • einops *
  • facexlib *
  • fastapi >=0.90.1
  • gradio ==3.41.2
  • inflection *
  • jsonmerge *
  • kornia *
  • lark *
  • numpy *
  • omegaconf *
  • open-clip-torch *
  • piexif *
  • psutil *
  • pytorch_lightning *
  • requests *
  • resize-right *
  • safetensors *
  • scikit-image >=0.19
  • tomesd *
  • torch *
  • torchdiffeq *
  • torchsde *
  • transformers ==4.30.2
requirements_npu.txt pypi
  • cloudpickle *
  • decorator *
  • synr ==0.5.0
  • tornado *
requirements_versions.txt pypi
  • GitPython ==3.1.32
  • Pillow ==9.5.0
  • accelerate ==0.21.0
  • basicsr ==1.4.2
  • blendmodes ==2022
  • clean-fid ==0.1.35
  • diffusers ==0.25.0
  • einops ==0.4.1
  • facexlib ==0.3.0
  • fastapi ==0.94.0
  • gradio ==3.41.2
  • httpcore ==0.15
  • httpx ==0.24.1
  • inflection ==0.5.1
  • jsonmerge ==1.8.0
  • kornia ==0.6.7
  • lark ==1.1.2
  • numpy ==1.26.2
  • omegaconf ==2.2.3
  • open-clip-torch ==2.20.0
  • piexif ==1.1.3
  • psutil ==5.9.5
  • pytorch_lightning ==1.9.4
  • resize-right ==0.0.2
  • safetensors ==0.4.2
  • scikit-image ==0.21.0
  • spandrel ==0.1.6
  • tomesd ==0.1.3
  • torch *
  • torchdiffeq ==0.2.3
  • torchsde ==0.2.6
  • transformers ==4.30.2
extensions-builtin/forge_legacy_preprocessors/annotator/zoe/zoedepth/models/base_models/midas_repo/environment.yaml conda
  • cudatoolkit 11.7.*
  • numpy 1.23.4.*
  • pip 22.3.1.*
  • python 3.10.8.*
  • pytorch 1.13.0.*
  • torchvision 0.14.0.*