GithubHelp home page GithubHelp logo

faildes / apply-lora-block-weight Goto Github PK

View Code? Open in Web Editor NEW

This project forked from terracottahaniwa/apply-lora-block-weight

0.0 0.0 0.0 89 KB

This is a utility to apply LoRA Block Weight (lbw) to LoRA for sd1.5 and export to a new safetensors.

License: GNU Affero General Public License v3.0

Python 100.00%

apply-lora-block-weight's Introduction

apply-lora-block-weight

[English] [日本語]

What is this?

This is a utility to apply LoRA Block Weight (lbw) to LoRA for sd1.5 and export to a new safetensors.
Currently only 17 or 26 layers are supported.

※This is a standalone utility, not an extension of StableDiffusion's functionalities.
a1111 webui supported. You can install from "Extensions > Install from URL" tab.
Select "Apply LBW" from Script in txt2img/img2img tab.

Install as a standalone utility.

  1. Download the zip file and extract it to a location of your choice.
  2. Launch PowerShell.
  3. Execute the following command.
> cd {extract folder}
> python -m venv venv
> venv\Sctipt\activate
> pip install -r requirements.txt

Troubleshooting

Error with venv\Scripts\activate

Please launch PowerShell as an administrator and execute the following command

> Set-ExecutionPolicy RemoteSigned

It will ask whether to change the policy, so input [Y].

Error Occurs with pip install

Please install the libraries listed in requirements.txt individually.

> pip install numpy
> pip install torch
> pip install safetensors

How to use

> python apply_lora_block_weight.py {input} {output} {block weight}

Example 1

  • input file: e:¥foo.safetensor
  • output file: e:¥foo_lbw.safetensor (Name is optional)
  • BlockWeight: 0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1
> python apply_lora_block_weight.py e:¥foo.safetensor e:¥foo_lbw.safetensor 0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1

Example 2

If you want to make the BASE value negative, please insert -- before BlockWeight.

> python apply_lora_block_weight.py e:¥foo.safetensor e:¥foo_lbw.safetensor -- -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1

License

stable-diffusion-webui: AGPL-3.0 license
sd-webui-lora-block-weight: ?
ss-scripts: Apache-2.0 license

apply-lora-block-weight's People

Contributors

terracottahaniwa avatar faildes 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.