LoRA Block Weight
custom script for AUTOMATIC1111's stable-diffusion-webui
When applying Lora, strength can be set block by block.
AUTOMATIC1111's stable-diffusion-webui çšã®ã¹ã¯ãªããã§ã
Loraãé©çšããéã匷ããéå±€ããšã«èšå®ã§ããŸã
If you have an error :
ValueError: could not convert string to float
use new syntax<lora:"lora name":1:lbw=IN02>
Updates/æŽæ°æ å ±
2024.04.06.0000(JST)
- add new UI: make weights
- ãŠã§ã€ããäœæããæ°ããUIã远å
2023.11.22.2000(JST)
- bugfix
- added new feature:start in steps
- æ©èœè¿œå :LoRAã®éäžéå§
2023.11.21.1930(JST)
- added new feature:stop in steps
- æ©èœè¿œå :LoRAã®éäžåæ¢
By specifying<lora:"lora name":lbw=ALL:stop=10>, you can disable the effect of LoRA at the specified step. In the case of character or composition LoRA, a sufficient effect is achieved in about 10 steps, and by cutting it off at this point, it is possible to minimize the impact on the style of the painting<lora:"lora name":lbw=ALL:stop=10>ãšæå®ããããšã§æå®ããstepã§LoRAã®å¹æãç¡ãããŸãããã£ã©ã¯ã¿ãŒãæ§å³LoRAã®å Žåã«ã¯10 stepçšåºŠã§ååãªå¹æããããããã§åãããšã§ç»é¢šãžã®åœ±é¿ãæããããšãå¯èœã§ãã
Overview
Lora is a powerful tool, but it is sometimes difficult to use and can affect areas that you do not want it to affect. This script allows you to set the weights block-by-block. Using this script, you may be able to get the image you want.
Usage
Place lora_block_weight.py in the script folder.
Or you can install from Extentions tab in web-ui. When installing, please restart web-ui.bat.
Active
Check this box to activate it.
Prompt
In the prompt box, enter the Lora you wish to use as usual. Enter the weight or identifier by typing ":" after the strength value. The identifier can be edited in the Weights setting.
<lora:"lora name":1:0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0>.
<lora:"lora name":1:0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>. (a1111-sd-webui-locon, etc.)
<lyco:"lora name":1:1:lbw=IN02> (a1111-sd-webui-lycoris, web-ui 1.5 or later)
<lyco:"lora name":1:1:lbw=1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0> (a1111-sd-webui-lycoris, web-ui 1.5 or later)
For LyCORIS using a1111-sd-webui-lycoris, syntax is different.
lbw=IN02 is used and follow lycoirs syntax for others such as unet or else.
a1111-sd-webui-lycoris is under under development, so this syntax might be changed.
Lora strength is in effect and applies to the entire Blocks.
It is case-sensitive.
For LyCORIS, full-model blobks used,so you need to input 26 weights.
You can use weight for LoRA, in this case, the weight of blocks not in LoRA is set to 0.ãã
If the above format is not used, the preset will treat it as a comment line.
start, stop step
By specifying <lora:"lora name":lbw=ALL:start=10>, the effect of LoRA appears from the designated step. By specifying <lora:"lora name":lbw=ALL:stop=10>, the effect of LoRA is eliminated at the specified step. In the case of character or composition LoRA, a significant effect is achieved in about 10 steps, and by cutting it off at this point, it is possible to minimize the influence on the style of the painting. By specifying <lora:"lora name":lbw=ALL:step=5-10>, LoRA is activated only between steps 5-10."
Weights Setting
Enter the identifier and weights. Unlike the full model, Lora is divided into 17 blocks, including the encoder. Therefore, enter 17 values. BASE, IN, OUT, etc. are the blocks equivalent to the full model. Due to various formats such as Full Model and LyCORIS and SDXL, script currently accept weights for 12, 17, 20, and 26. Generally, even if weights in incompatible formats are inputted, the system will still function. However, any layers not provided will be treated as having a weight of 0.
LoRA(17)
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| BASE | IN01 | IN02 | IN04 | IN05 | IN07 | IN08 | MID | OUT03 | OUT04 | OUT05 | OUT06 | OUT07 | OUT08 | OUT09 | OUT10 | OUT11 |
LyCORIS, etc. (26)
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| BASE | IN00 | IN01 | IN02 | IN03 | IN04 | IN05 | IN06 | IN07 | IN08 | IN09 | IN10 | IN11 | MID | OUT00 | OUT01 | OUT02 | OUT03 | OUT04 | OUT05 | OUT06 | OUT07 | OUT08 | OUT09 | OUT10 | OUT11 |
SDXL LoRA(12)
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| BASE | IN04 | IN05 | IN07 | IN08 | MID | OUT0 | OUT1 | OUT2 | OUT3 | OUT4 | OUT05 |
SDXL - LyCORIS/LoCon(20)
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| BASE | IN00 | IN01 | IN02 | IN03 | IN04 | IN05 | IN06 | IN07 | IN08 | MID | OUT00 | OUT01 | OUT02 | OUT03 | OUT04 | OUT05 | OUT06 | OUT07 |
Special Values (Random)
Basically, a numerical value must be entered to work correctly, but by entering R and U, a random value will be entered.
R : Numerical value with 3 decimal places from 0~1
U : 3 decimal places from -1.5 to 1.5
For example, if ROUT:1,1,1,1,1,1,1,1,R,R,R,R,R,R,R,R,R
Only the OUT blocks is randomized.
The randomized values will be displayed on the command prompt screen when the image is generated.
Special Values (Dynamic)
The special value X may also be included to use a dynamic weight specified in the LoRA syntax. This is activated by including an additional weight value after the specified Original Weight.
For example, if ROUT:X,1,1,1,1,1,1,1,1,1,1,1,X,X,X,X,X and you had a prompt containing <lora:my_lore:0.5:ROUT:0.7>. The X weights in ROUT would be replaced with 0.7 at runtime.
NOTE: If you select an
Original Weighttag that has a dynamic weight (X) and you do not specify a value in the LoRA syntax, it will default to1.
Save Presets
The "Save Presets" button saves the text in the current text box. It is better to use a text editor, so use the "Open TextEditor" button to open a text editor, edit the text, and reload it.
The text box above the Weights setting is a list of currently available identifiers, useful for copying and pasting into an XY plot. 17 identifiers are required to appear in the list.
Fun Usage
Used in conjunction with the XY plot, it is possible to examine the impact of each level of the hierarchy.
The setting values are as follows.
NOT:0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
ALL:1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
INS:1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
IND:1,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0
INALL:1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0
MIDD:1,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0
OUTD:1,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0
OUTS:1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1
OUTALL:1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1
XYZ Plotting Function
The optimal value can be searched by changing the value of each layer individually.
Usage
Check "Active" to activate the function. If Script (such as XYZ plot in Automatic1111) is enabled, it will take precedence.
Hires. fix is not supported. batch size is fixed to 1. batch count should be set to 1.
Enter XYZ as the identifier of the LoRA that you want to change. It will work even if you do not enter a value corresponding to XYZ in the preset. If a value corresponding to XYZ is entered, that value will be used as the initial value.
Inputting ZYX, inverted value will be automatically inputted.
This feature enables to match weights of two LoRAs.
Inputing XYZ for LoRA1 and ZYX for LoRA2, you get,
LoRA1 1,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0
LoRA2 0,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1
Axis type
values
Sets the weight of the hierarchy to be changed. Enter the values separated by commas. 0,0.25,0.5,0.75,1", etc.
Block ID
If a block ID is entered, only that block will change to the value specified by value. As with the other types, use commas to separate them. Multiple blocks can be changed at the same time by separating them with a space or hyphen. The initial NOT will invert the change, so NOT IN09-OUT02 will change all blocks except IN09-OUT02.
seed
Seed changes, and is intended to be specified on the Z-axis.
Original Weights
Specify the initial value to change the weight of each block. If Original Weight is enabled, the value entered for XYZ is ignored.
Input example
X : value, value : 1,0.25,0.5,0.75,1
Y : Block ID, value : BASE,IN01-IN08,IN05-OUT05,OUT03-OUT11,NOT OUT03-OUT11
Z : Original Weights, Value : NONE,ALL0.5,ALL
In this case, an XY plot is created corresponding to the initial values NONE,ALL0.5,ALL. If you select Seed for Z and enter -1,-1,-1, the XY plot will be created 3 times with different seeds.
Original Weights Combined XY Plot
If both X and Y are set to Original Weights then an XY plot is made by combining the weights. If both X and Y have a weight in the same block then the Y case is set to zero before adding the arrays, this value will be used during the YX case where X's value is then set to zero. The intended usage is without overlapping blocks.
Given these names and values in the "Weights setting":
INS:1,1,1,0,0,0,0,0,0,0,0,0
MID:1,0,0,0,0,1,0,0,0,0,0,0
OUTD:1,0,0,0,0,0,1,1,1,0,0,0
With:
X : Original Weights, value: INS,MID,OUTD
Y : Original Weights, value: INS,MID,OUTD
Z : none
An XY plot is made with 9 elements. The diagonal is the X values: INS,MID,OUTD unchanged. So we have for the first row:
INS+INS = 1,1,1,0,0,0,0,0,0,0,0,0 (Just INS unchanged, first image on the diagonal)
MID+INS = 1,1,1,0,0,1,0,0,0,0,0,0 (second column of first row)
OUTD+INS = 1,1,1,0,0,0,1,1,1,0,0,0 (third column of first row)
Then the next row is INS+MID, MID+MID, OUTD+MID, and so on. Example image here
Effective Block Analyzer
This function check which layers are working well. The effect of the block is visualized and quantified by setting the intensity of the other bocks to 1, decreasing the intensity of the block you want to examine, and taking the difference.
Range
If you enter 0.5, 1, all initial values are set to 1, and only the target block is calculated as 0.5. Normally, 0.5 will make a difference, but some LoRAs may have difficulty making a difference, in which case, set 0.5 to 0 or a negative value.
settings
diff color
Specify the background color of the diff file.
chnage X-Y
Swaps the X and Y axes. By default, Block is assigned to the Y axis.
Threshold
Sets the threshold at which a change is recognized when calculating the difference. Basically, the default value is fine, but if you want to detect subtle differences in color, etc., lower the value.
Blocks
Enter the blocks to be examined, using the same format as for XYZ plots.
Here is the English translation in Markdown format:
Guide for API users
Regular Usage
By default, Active is checked in the initial settings, so you can use it simply by installing it. You can use it by entering the format as instructed in the prompt. If executed, the phrase "LoRA Block Weight" will appear on the command prompt screen. If for some reason Active is not enabled, you can make it active by entering a value in the API for "alwayson_scripts".
When you enable API mode and use the UI, two extensions will appear. Please use the one on the bottom.
The default presets can be used for presets. If you want to use your own presets, you can either edit the preset file or use the following format for the data passed to the API.
The code that can be used when passing to the API in json format is as follows. The presets you enter here will become available. If you want to use multiple presets, please separate them with \n.
"prompt": "myprompt, <lora:mylora:1:MYSETS>",
"alwayson_scripts": {
"LoRA Block Weight": {
"args": ["MYSETS:1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nYOURSETS:0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1", true, 1 ,"","","","","","","","","","","","","",""]
}
}
XYZ Plot
Please use the format below. Please delete "alwayson_scripts" as it will cause an error.
"prompt": "myprompt, <lora:mylora:1:XYZ>",
"script_name":"LoRA Block Weight",
"script_args": ["XYZ:1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1", true, 1 ,"seed","-1,-1","","","","","","","","","","","",""]
In this case, the six following True,1 correspond to xtype,xvalues,ytype,yvalues,ztype,zvalues. It will be ignored if left blank. Please follow the instructions in the XYZ plot section for entering values. Even numbers should be enclosed in "".
The following types are available.
"none","Block ID","values","seed","Original Weights","elements"
Effective Block Analyzer
It can be used by using the following format.
"prompt": "myprompt, <lora:mylora:1:XYZ>",
"script_name":"LoRA Block Weight",
"script_args": ["XYZ:1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1", true, 2 ,"","","","","","","0,1","17ALL",1,"white",20,true,"",""]
For "0,1", specify the weight. If you specify "17ALL", it will examine all the layers of the normal LoRA. If you want to specify individually, please write like "BASE,IN00,IN01,IN02". Specify whether to reverse XY for True in the "1" for the number of times you want to check (if it is 2 or more, multiple seeds will be set), and white for the background color.
Make Weights
In "make weights," you can create a weight list from a slider. When you press the "add to preset" button, the weight specified by the identifier is added to the end of the preset. If a preset with the same name already exists, it will be overwritten. The "add to preset and save" button allows you to save the preset simultaneously.
æŠèŠ
Loraã¯åŒ·åãªããŒã«ã§ãããæã«æ±ããé£ããã圱é¿ããŠã»ãããªããšããã«ãŸã§åœ±é¿ãã§ããããŸãããã®ã¹ã¯ãªããã§ã¯Loraãé©çšããéãé©çšåºŠåããU-Netã®éå±€ããšã«èšå®ããããšãã§ããŸããããã䜿çšããããšã§æ±ããç»åã«è¿ã¥ããããšãã§ãããããããŸããã
äœ¿ãæ¹
ã€ã³ã¹ããŒã«æã¯Web-ui.batãåèµ·åãããŠãã ããã
Active
ããã«ãã§ãã¯ãå ¥ããããšã§åäœããŸãã
ããã³ãã
ããã³ããç»é¢ã§ã¯éåžžéã䜿çšãããLoraãèšå ¥ããŠãã ããããã®éã匷ãã®å€ã®æ¬¡ã«ã:ããå ¥åããŠã§ã€ããèå¥åãå ¥åããŸããèå¥åã¯Weights setting ã§ç·šéããŸãã
<lora:"lora name":1:0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0>.
<lora:"lora name":1:0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>. (a1111-sd-webui-locon, etc.)
<lora:"lora name":1:1:lbw=IN02> (a1111-sd-webui-lycoris, web-ui 1.5 or later)
<lora:"lora name":1:1:lbw=1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0> (a1111-sd-webui-lycoris, web-ui 1.5 or later)
<lora:"lora name":1:1:lbw=IN02:stop=10>
Loraã®åŒ·ãã¯æå¹ã§ãéå±€å
šäœã«ããããŸãã倧æåãšå°æåã¯åºå¥ãããŸãã
LyCORISã«å¯ŸããŠLoRAã®ããªã»ããã䜿çšã§ããŸããããã®å ŽåLoRAã§äœ¿ãããŠããªãéå±€ã®ãŠã§ã€ãã¯0ã«èšå®ãããŸãã
äžèšã®åœ¢åŒã«ãªã£ãŠããªãå Žåããªã»ããã§ã¯ã³ã¡ã³ãè¡ãšããŠæ±ãããŸãã
a1111-sd-webui-lycorisçã®LyCORISããver1.5以éã®web-uiã䜿çšããå Žåæ§æãç°ãªããŸããlbw=IN02ã䜿ã£ãŠäžãããé çªã¯åããŸããããã®ä»ã®æžåŒã¯lycorisã®æžåŒã«ãããã£ãŠäžããã詳ããã¯LyCORISã®ããã¥ã¡ã³ããåç
§ããŠäžãããèå¥åãå
¥åããŠäžãããa1111-sd-webui-lycorisçã¯éçºéäžã®ãããã®æ§æã¯å€æŽãããå¯èœæ§ããããŸãã
start, stop step
<lora:"lora name":lbw=ALL:start=10>ãšæå®ãããšãæå®ããstepããLoRAã®å¹æãçŸããŸãã<lora:"lora name":lbw=ALL:stop=10>ãšæå®ããããšã§æå®ããstepã§LoRAã®å¹æãç¡ãããŸãããã£ã©ã¯ã¿ãŒãæ§å³LoRAã®å Žåã«ã¯10 stepçšåºŠã§ååãªå¹æããããããã§åãããšã§ç»é¢šãžã®åœ±é¿ãæããããšãå¯èœã§ãã<lora:"lora name":lbw=ALL:step=5-10>ãšæå®ãããšstep 5-10ã®éã®ã¿LoRAãæå¹åããŸãã
Weights setting
èå¥åãšãŠã§ã€ããå ¥åããŸãã ãã«ã¢ãã«ãšç°ãªããLoraã§ã¯ãšã³ã³ãŒããŒãå«ã17ã®ãããã¯ã«åãããŠããŸãããã£ãŠã17åã®æ°å€ãå ¥åããŠãã ããã BASE,IN,OUTãªã©ã¯ãã«ã¢ãã«çžåœã®éå±€ã§ãã ãã«ã¢ãã«ãLyCORISãSDXLãªã©æ§ã ãªåœ¢åŒããããããçŸç¶ã§ã¯12,17,20,26ã®ãŠã§ã€ããåãä»ããŸããåºæ¬çã«åœ¢åŒãåããªããŠã§ã€ããå ¥åããŠãåäœããŸãããæªå ¥åã®å±€ã¯0ãšããŠæ±ãããŸãã
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| BASE | IN01 | IN02 | IN04 | IN05 | IN07 | IN08 | MID | OUT03 | OUT04 | OUT05 | OUT06 | OUT07 | OUT08 | OUT09 | OUT10 | OUT11 |
LyCORISãªã©ã®å Žå(26)
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| BASE | IN00 | IN01 | IN02 | IN03 | IN04 | IN05 | IN06 | IN07 | IN08 | IN09 | IN10 | IN11 | MID | OUT00 | OUT01 | OUT02 | OUT03 | OUT04 | OUT05 | OUT06 | OUT07 | OUT08 | OUT09 | OUT10 | OUT11 |
SDXL LoRAã®å Žå(12)
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| BASE | IN04 | IN05 | IN07 | IN08 | MID | OUT0 | OUT1 | OUT2 | OUT3 | OUT4 | OUT05 |
SDXL - LyCORISã®å Žå(20)
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| BASE | IN00 | IN01 | IN02 | IN03 | IN04 | IN05 | IN06 | IN07 | IN08 | MID | OUT00 | OUT01 | OUT02 | OUT03 | OUT04 | OUT05 | OUT06 | OUT07 |
ç¹å¥ãªå€
åºæ¬çã«ã¯æ°å€ãå
¥ããªããšæ£ããåããŸããã R ããã³ U ãå
¥åããããšã§ã©ã³ãã ãªæ°å€ãå
¥åãããŸãã
R : 0~1ãŸã§ã®å°æ°ç¹3æ¡ã®æ°å€
U : -1.5ïœ1.5ãŸã§ã®å°æ°ç¹3æ¡ã®æ°å€
äŸãã°ãROUT:1,1,1,1,1,1,1,1,R,R,R,R,R,R,R,R,R ãšãããš
OUTå±€ã®ã¿ãã³ãã åãããŸã
ã©ã³ãã åãããæ°å€ã¯ç»åçææã«ã³ãã³ãããã³ããç»é¢ã«è¡šç€ºãããŸã
saveãã¿ã³ã§çŸåšã®ããã¹ãããã¯ã¹ã®ããã¹ããä¿åã§ããŸããããã¹ããšãã£ã¿ã䜿ã£ãæ¹ãããã®ã§ãopen Texteditorãã¿ã³ã§ããã¹ããšãã£ã¿éããç·šéåŸreloadããŠãã ããã
Weights settingã®äžã«ããããã¹ãããã¯ã¹ã¯çŸåšäœ¿çšã§ããèå¥åã®äžèЧã§ããXYããããã«ã³ããããã®ã«äŸ¿å©ã§ãã17åãªããšäžèЧã«è¡šç€ºãããŸããã
楜ããäœ¿ãæ¹
XY plotãšäœµçšããããšã§åéå±€ã®åœ±é¿ã調ã¹ãããšãå¯èœã«ãªããŸãã
èšå®å€ã¯ä»¥äžã®éãã§ãã
NOT:0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
ALL:1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
INS:1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0
IND:1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0
INALL:1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0
MIDD:1,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0
OUTD:1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0
OUTS:1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1
OUTALL:1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1
XYZ ããããæ©èœ
åå±€ã®å€ãåå¥ã«å€åãããããšã§æé©å€ãç·åœããã«æ¢ããŸãã
äœ¿ãæ¹
Activeããã§ãã¯ããããšã§åäœããŸãã Script(Automatic1111æ¬äœã®XYZãããããªã©)ãæå¹ã«ãªã£ãŠããå Žåãã¡ããåªå
ãããŸããnoneãéžæããŠãã ããã
Hires. fixã«ã¯å¯Ÿå¿ããŠããŸãããBatch sizeã¯1ã«åºå®ãããŸããBatch countã¯1ã«èšå®ããŠãã ããã
å€åããããLoRAã®èå¥åã«XYZãšå
¥åããŸã<lora:"loraå":1:XYZ>ã ããªã»ããã«XYZã«å¯Ÿå¿ããå€ãå
¥åããŠããªããŠãåäœããŸãããã®å Žåãã¹ãŠã®ãŠã§ã€ãã0ã®ç¶æ
ããã¹ã¿ãŒãããŸããXYZã«å¯Ÿå¿ããå€ãå
¥åãããŠããå Žåã¯ãã®å€ãåæå€ã«ãªããŸãã
ZYXãšå
¥åãããšXYZãšã¯å察ã®å€ãå
¥åãããŸããããã¯ãµãã€ã®LoRAã®ãŠã§ã€ããåãããéã«æå¹ã§ãã
äŸãã°LoRA1ã«XYZ,LoRA2ã«ZYXãšå
¥åãããšã
LoRA1 1,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0
LoRA2 0,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1
ãšãªããŸãã
軞ã¿ã€ã
values
å€åãããéå±€ã®ãŠã§ã€ããèšå®ããŸããã«ã³ãåºåãã§å ¥åããŠãã ãããã0,0.25,0.5,0.75,1ããªã©ã
Block ID
ãããã¯IDãå ¥åãããšããã®ãããã¯ã®ã¿valueã§æå®ããå€ã«å€ãããŸããä»ã®ã¿ã€ããšåæ§ã«ã«ã³ãã§åºåããŸããã¹ããŒã¹ãŸãã¯ãã€ãã³ã§åºåãããšã§è€æ°ã®ãããã¯ãåæã«å€åãããããšãã§ããŸããæåã«NOTãã€ããããšã§å€å察象ãå転ããŸããNOT IN09-OUT02ãšãããšãIN09-OUT02以å€ãå€åããŸããNOTã¯æåã«å ¥åããªããšå¹æããããŸãããIN08-M00-OUT03ã¯ç¹ãã£ãŠããŸãã
Seed
ã·ãŒããå€ãããŸããZè»žã«æå®ããããšãæ³å®ããŠããŸãã
Original Weights
åãããã¯ã®ãŠã§ã€ããå€åãããåæå€ãæå®ããŸããããªã»ããã«ç»é²ãããŠããèå¥åãå ¥åããŠãã ãããOriginal Weightãæå¹ã«ãªã£ãŠããå ŽåXYZã«å ¥åãããå€ã¯ç¡èŠãããŸãã
Original Weightsã®åç®
ããXãšYãäž¡æ¹ãšãOriginal Weightsã«èšå®ãããŠããå Žåããã®éã¿ãçµã¿åãããŠXYãããããäœæãããŸããXãšYã®äž¡æ¹ãåããããã¯ã«éã¿ãããå Žåãé åãå ç®ããåã«Yã±ãŒã¹ã¯ãŒãã«èšå®ãããŸãããã®å€ã¯ãXã®å€ããŒãã«èšå®ãããYXã±ãŒã¹ã§äœ¿çšãããŸããæå³ãããŠããäœ¿çšæ¹æ³ã¯ãéè€ãããããã¯ãªãã§ã®ãã®ã§ãã
"Weights setting"ã«ä»¥äžã®ååãšå€ãäžããããŠãããšããŸãïŒ
INS:1,1,1,0,0,0,0,0,0,0,0,0
MID:1,0,0,0,0,1,0,0,0,0,0,0
OUTD:1,0,0,0,0,0,1,1,1,0,0,0
以äžã®èšå®ã§ïŒ
X : Original Weights, å€: INS,MID,OUTD
Y : Original Weights, å€: INS,MID,OUTD
Z : ãªã
9ã€ã®èŠçŽ ãæã€XYãããããäœæãããŸãã察è§ç·äžã¯ã倿ŽãããŠããªãXã®å€ïŒINS,MID,OUTDã§ãããããã£ãŠãæåã®è¡ã¯ä»¥äžã®ããã«ãªããŸãïŒ
INS+INS = 1,1,1,0,0,0,0,0,0,0,0,0 (倿ŽãããŠããªãINSã ãã察è§ç·äžã®æåã®ç»å)
MID+INS = 1,1,1,0,0,1,0,0,0,0,0,0 (æåã®è¡ã®ç¬¬2å)
OUTD+INS = 1,1,1,0,0,0,1,1,1,0,0,0 (æåã®è¡ã®ç¬¬3å)
次ã®è¡ã¯ãINS+MIDãMID+MIDãOUTD+MIDãªã©ã§ããäŸã®ç»åã¯ãã¡ãã§ãã
å ¥åäŸ
X : value, å€ : 1,0.25,0.5,0.75,1
Y : Block ID, å€ : BASE,IN01-IN08,IN05-OUT05,OUT03-OUT11,NOT OUT03-OUT11
Z : Original Weights, å€ : NONE,ALL0.5,ALL
ãã®å Žåãåæå€NONE,ALL0.5,ALLã«å¯Ÿå¿ããXY plotãäœè£œãããŸãã Zã«Seedãéžã³ã-1,-1,-1ãå ¥åãããšãç°ãªãseedã§XY plotã3åäœè£œããŸãã
Effective Block Analyzer
ã©ã®éå±€ãè¯ãå¹ããŠããããå€å¥ããæ©èœã§ãã察象ã®é局以å€ã®åŒ·åºŠã1ã«ããŠã調ã¹ããéå±€ã®åŒ·åºŠãäžããå·®åãåãããšã§éå±€ã®å¹æãå¯èŠåã»æ°å€åããŸãã
Range
0.5, 1ããšå ¥åããå Žåãåæå€ããã¹ãŠ1ã«ãªãã察象ã®ãããã¯ã®ã¿0.5ãšããŠèšç®ãè¡ãããŸããæ®éã¯0.5ã§å·®ãã§ãŸãããLoRAã«ãã£ãŠã¯å·®ãåºã«ããå Žåãããã®ã§ããã®å Žåã¯0.5ã0ãããã¯ãã€ãã¹ã®å€ã«èšå®ããŠãã ããã
èšå®
diff color
å·®åãã¡ã€ã«ã®èæ¯ã«ã©ãŒãæå®ããŸãã
chnage X-Y
X軞ãšY軞ãå ¥ãæ¿ããŸããããã©ã«ãã§ã¯Y軞ã«Blockãå²ãåœãŠãããŠããŸãã
Threshold
å·®åãèšç®ããéã®å€åãããšèªèãããéŸå€ãèšå®ããŸããåºæ¬çã«ã¯ããã©ã«ãå€ã§åé¡ãããŸãããã埮åŠãªè²ã®éããªã©ãæ€åºãããå Žåã¯å€ãäžããŠäžããã
Blocks
調ã¹ããéå±€ãå ¥åããŸããXYZãããããšåãæžåŒã䜿çšå¯èœã§ãã
éå±€å¥ããŒãžã«ã€ããŠã¯äžèšãåç §ããŠãã ãã
elemental
詳现ã¯ãã¡ããåç §ããŠäžããã
äœ¿ãæ¹
Elementaã¿ãã«ãŠéå±€æå®ãšåãããã«èå¥åãèšå®ããŸããèå¥åã¯éå±€ã®èå¥åã®åŸã«å ¥åããŸãã <lora:"loraå":1:IN04:ATTNON> ATTNON:
æžåŒã¯
èå¥å:éå±€æå®:èŠçŽ æå®:ãŠã§ã€ã
ã®ããã«æå®ããŸããèŠçŽ ã¯éšåäžèŽã§å€å®ãããŸããattn1ãªãattn1ã®ã¿ãattnãªãattn1åã³attn2ãåå¿ããŸããéå±€ãèŠçŽ å
±ã«ç©ºçœã§åºåããšè€æ°æå®ã§ããŸãã
print changeããªã³ã«ãããšåå¿ããèŠçŽ ãã³ãã³ãããã³ããäžã«è¡šç€ºãããŸãã
ALL0:::0
ã¯ãã¹ãŠã®èŠçŽ ã®ãŠã§ã€ãããŒãã«èšå®ããŸãã
IN1:IN00-IN11::1
ã¯INã®ãã¹ãŠã®èŠçŽ ã1ã«ããŸã
ATTNON::attn:1
ã¯ãã¹ãŠã®éå±€ã®attnã1ã«ããŸãã
XYZãããã
XYZããããã®elementsã®é
ã§ã¯ã«ã³ãåºåãã§XYZãããããå¯èœã«ãªããŸãã
ãã®å Žåã¯
<lora:"loraå":1:XYZ:XYZ>
ãšæå®ããŠäžããã
elements
ã®é
ã«
IN05-OUT05:attn:0,IN05-OUT05:attn:0.5,IN05-OUT05:attn:1
ãšå
¥åããŠèµ°ããããšIN05ããOUT05ãŸã§ã®attnã®ã¿ãå€åãããããšãã§ããŸãã
ãã®éãXYZã®å€ã倿Žããããšã§åæå€ã倿Žã§ããŸããããã©ã«ãã§ã¯elementalã®XYZã¯XYZ:::1ãšãªã£ãŠãããããã¯å
šéå±€ãå
šèŠçŽ ã1ã«ããŸããããããXYZ:encoder::1ãšãããšããã¹ããšã³ã³ãŒããŒã®ã¿ãæå¹ã«ããç¶æ
ã§è©äŸ¡ãã§ããŸãã
ãŠã§ã€ãã®äœæ
make weightsã§ã¯ã¹ã©ã€ããŒãããŠã§ã€ããªã¹ããäœæã§ããŸãã
add to presetãã¿ã³ãæŒããšãidentiferã§æå®ããããŠã§ã€ããããªã»ããã®æ«å°Ÿã«è¿œå ãããŸãã
ãã§ã«åãååã®ããªã»ãããååšããå ŽåãäžæžããããŸãã
add to preset and saveãã¿ã³ã§ã¯åæã«ããªã»ããã®ä¿åãè¡ãããŸãã
APIãéããŠã®å©çšã«ã€ããŠ
éåžžå©çš
åæèšå®ã§Activeã¯ãã§ãã¯ãããŠããã®ã§ã€ã³ã¹ããŒã«ããã ãã§å©çšå¯èœã«ãªããŸãã
ããã³ããã«æžåŒéãã«å
¥åããããšã§å©çšã§ããŸããå®è¡ãããå Žåã«ã¯ã³ãã³ãããã³ããç»é¢ã«ãLoRA Block Weightãã®æåãçŸããŸãã
äœããã®çç±ã§Activeã«ãªã£ãŠããªãå Žåã«ã¯APIã«æããå€ã®ãã¡ã"alwayson_scripts"ã«å€ãå
¥åããããšã§Activeã«ã§ããŸãã
APIã¢ãŒããæå¹ã«ããŠUIã䜿ããšããæ¡åŒµããµãã€è¡šç€ºãããŸããäžã®æ¹ã䜿ã£ãŠäžããã
ããªã»ããã¯ããã©ã«ãã®ããªã»ãããå©çšã§ããŸããç¬èªã®ããªã»ãããå©çšãããå Žåã«ã¯ããªã»ãããã¡ã€ã«ãç·šéããããAPIã«åãæž¡ãããŒã¿ã«å¯ŸããŠäžèšã®æžåŒãå©çšããŠäžããã
json圢åŒã§APIã«åãæž¡ããšãã«äœ¿çšã§ããã³ãŒãã§ããããã§å
¥åããããªã»ãããå©çšå¯èœã«ãªããŸããè€æ°ã®ããªã»ãããå©çšãããå Žåã«ã¯\nã§åºåã£ãŠäžããã
"prompt": "myprompt, <lora:mylora:1:MYSETS>",
"alwayson_scripts": {
"LoRA Block Weight": {
"args": ["MYSETS:1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nYOURSETS:0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1", True, 1 ,"","","","","","","","","","","","","",""]
}
}
XYZ plot
äžèšã®æžåŒãå©çšããŠäžããã"alwayson_scripts"ã¯æ¶ããŠäžãããšã©ãŒã«ãªããŸãã
"prompt": "myprompt, <lora:mylora:1:XYZ>",
"script_name":"LoRA Block Weight",
"script_args": ["XYZ:1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1", True, 1 ,"seed","-1,-1","","","","","","","","","","","",""]
ãã®éãTrue,1ã«ç¶ã6åãxtype,xvalues,ytype,yvalues,ztype,zvaluesã«å¯Ÿå¿ããŸãã空çœã ãšç¡èŠãããŸããå
¥åããå€ãªã©ã¯XYZ plotã®é
ã«åŸã£ãŠäžãããæ°åã§ããã¹ãŠ""ã§å²ã£ãŠäžããã
䜿çšã§ããã¿ã€ãã¯æ¬¡ã®éãã§ãã
"none","Block ID","values","seed","Original Weights","elements"
Effective Block Analyzer
äžèšã®ãããªæžåŒã䜿ãããšã§äœ¿çšã§ããŸãã
"prompt": "myprompt, <lora:mylora:1:XYZ>",
"script_name":"LoRA Block Weight",
"script_args": ["XYZ:1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1", True, 2 ,"","","","","","","0,1","17ALL",1,"white",20,True,"",""]
"0,1"ã«ã¯ãŠã§ã€ãã"17ALL"ãæå®ãããšæ®éã®LoRAãã¹ãŠã®éå±€ã調ã¹ãŸããåå¥ã«æå®ãããå Žåã¯"BASE,IN00,IN01,IN02"ã®ããã«èšè¿°ããŠäžããã1ã«ã¯èª¿ã¹ããåæ°(2以äžã ãšè€æ°ã®ã·ãŒããèšå®ããŸã),whiteã«ã¯èæ¯è²,Trueã«ã¯XYãå転ãããã©ãããæå®ããŠäžããã
updates/æŽæ°æ å ±
2023.10.26.2000(JST)
- bugfix:Effective block checker does not work correctly.
- bugfix:Does not work correctly when lora in memory is set to a value other than 0.
2023.10.04.2000(JST)
XYZ plotã«æ°ããªæ©èœã远å ãããŸãããsometimesacoderæ°ã«æè¬ããŸãã
A new feature was added to the XYZ plot. Many thanks to sometimesacoder.
2023.07.22.0030(JST)
- support SDXL
- support web-ui 1.5
- support no buildin-LoRA system(lycoris required)
to use with web-ui 1.5/web-ui1.5ã§äœ¿ããšãã¯
<lora:"lora name":1:1:lbw=IN02>
<lora:"lora name":1:1:lbw=1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0>
2023.07.14.2000(JST)
- APIã§XYZãããããå©çšå¯èœã«ãªããŸãã
- APIã®å©ç𿹿³ã远èšããŸãã
- XYZ plot can be used in API
- Added guide for API users
2023.5.24.2000(JST)
- changed directory for presets(extentions/sd-webui-lora-block-weight/scripts/)
- ããªã»ããã®ä¿åãã©ã«ããextentions/sd-webui-lora-block-weight/scripts/ã«å€æŽã«ãªããŸããã
2023.5.12.2100(JST)
- changed syntax of lycoris
- lycorisã®æžåŒã倿ŽããŸãã
2023.04.14.2000(JST)
- support LyCORIS(a1111-sd-webui-lycoris)
- LyCORIS(a1111-sd-webui-lycoris)ã«å¯Ÿå¿
2023.03.20.2030(JST)
- Comment lines can now be added to presets
- ããªã»ããã«ã³ã¡ã³ãè¡ã远å ã§ããããã«ãªããŸãã
- support XYZ plot hires.fix
- XYZãããããhires.fixã«å¯Ÿå¿ããŸãã
2023.03.16.2030(JST)
å¥éLyCORIS Extentionãå¿ èŠã§ãã For use LyCORIS, Extension for LyCORIS needed.
2023.02.07 1250(JST)
- Changed behavior when XYZ plot Active (Script of the main UI is prioritized).
2023.02.06 2000(JST)
- Feature added: XYZ plotting is added.
2023.01.31 0200(JST)
- Feature added: Random feature is added
- Fixed: Weighting now works for negative values.
2023.02.16 2040(JST)
- Original Weight ãxãyã«èšå®ã§ããªãåé¡ã解決ããŸãã
- Effective Weight Analyzeréžææã«XYZã®XãYãValuesãšBlockIdã«ãªã£ãŠããªããšãšã©ãŒã«ãªãåé¡ã解決ããŸãã
2023.02.08 2120(JST)
- éå±€é©å¿ããåŸé垞䜿çšããéãéå±€é©å¿ãæ®ãåé¡ã解決ããŸãã
- 广ã®ããéå±€ãã¯ã³ã¯ãªãã¯ã§å€å¥ããæ©èœã远å ããŸãã
2023.02.08 0050(JST)
- äžéšç°å¢ã§seedãåºå®ãããªãåé¡ã解決ããŸãã
2023.02.07 2015(JST)
- ãã€ãã¹ã®ãŠã§ã€ããæ£åžžã«åããªãåé¡ãä¿®æ£ããŸãã
2023.02.07 1250(JST)
- XYZããããActiveæã®åäœã倿ŽããŸãã(æ¬äœã®Scriptãåªå ãããããã«ãªããŸã)
2023.02.06 2000(JST)
- æ©èœè¿œå ïŒXYZããããæ©èœã远å ããŸãã
2023.01.31 0200(JST)
- æ©èœè¿œå ïŒã©ã³ãã æ©èœã远å ããŸãã
- æ©èœä¿®æ£ïŒãŠã§ã€ãããã€ãã¹ã«ãå¹ãããã«ãªããŸãã