Giter Club home page Giter Club logo

merge_unet's Introduction

merge_unet_block

a python script to merge stable diffusion's Unet blocks.
you should run the script with Python3 env.

Install

pip install safetensors
# pip install pytorch

For example

full Unet layer with index and alpha

the alpha value is for "xxx2.safetensors".

python merge_unet_blocks.py xxx1.safetensors xxx2.safetensors \
        --input_blocks "0:0.5, 1:0.5, 2:0.5, 3:0.6, 4:0.5, 5:0.5, 6:0.5, 7:0.5, 8:0.5, 9:0.5, 10:0.5, 11:0.5" \
        --middle_blocks "0:0.5, 1:0.5, 2:0.6" \
        --output_blocks "0:0.5, 1:0.5, 2:0.5, 3:0.6, 4:0.5, 5:0.5, 6:0.5, 7:0.5, 8:0.5, 9:0.5, 10:0.5, 11:0.5" \
        --out "0:0.5, 2:0.3" \
        --time_embed "0:0.5, 2:0.3" \
        --dump_path ./merged.safetensors

or (same as above):

python merge_unet_blocks.py xxx1.safetensors xxx2.ckpt \
        --base_alpha 0.5 \
        --input_blocks "3:0.6" \
        --middle_blocks "2:0.6" \
        --output_blocks "3:0.6," \
        --out "2:0.3" \
        --time_embed "2:0.3" \
        --dump_path ./merged.safetensors

or just (merge all blocks with base_alpha):

python merge_unet_blocks.py xxx1.ckpt xxx2.ckpt \
        --base_alpha 0.5 \
        --dump_path ./merged.ckpt

merge_unet's People

Contributors

themoongodyue avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.