Skip to content

Commit

Permalink
Merge pull request kohya-ss#1284 from sdbds/fix_traincontrolnet
Browse files Browse the repository at this point in the history
Fix train controlnet
  • Loading branch information
kohya-ss authored May 19, 2024
2 parents c68baae + 5cb145d commit de0e0b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ easygui==0.98.3
toml==0.10.2
voluptuous==0.13.1
huggingface-hub==0.20.1
omegaconf==2.3.0
# for Image utils
imagesize==1.4.1
# for BLIP captioning
Expand Down
8 changes: 6 additions & 2 deletions train_controlnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import random
import time
from multiprocessing import Value
from types import SimpleNamespace
from omegaconf import OmegaConf
import toml

from tqdm import tqdm
Expand Down Expand Up @@ -148,8 +148,10 @@ def train(args):
"in_channels": 4,
"layers_per_block": 2,
"mid_block_scale_factor": 1,
"mid_block_type": "UNetMidBlock2DCrossAttn",
"norm_eps": 1e-05,
"norm_num_groups": 32,
"num_attention_heads": [5, 10, 20, 20],
"num_class_embeds": None,
"only_cross_attention": False,
"out_channels": 4,
Expand Down Expand Up @@ -179,8 +181,10 @@ def train(args):
"in_channels": 4,
"layers_per_block": 2,
"mid_block_scale_factor": 1,
"mid_block_type": "UNetMidBlock2DCrossAttn",
"norm_eps": 1e-05,
"norm_num_groups": 32,
"num_attention_heads": 8,
"out_channels": 4,
"sample_size": 64,
"up_block_types": ["UpBlock2D", "CrossAttnUpBlock2D", "CrossAttnUpBlock2D", "CrossAttnUpBlock2D"],
Expand All @@ -193,7 +197,7 @@ def train(args):
"resnet_time_scale_shift": "default",
"projection_class_embeddings_input_dim": None,
}
unet.config = SimpleNamespace(**unet.config)
unet.config = OmegaConf.create(unet.config)

controlnet = ControlNetModel.from_unet(unet)

Expand Down

0 comments on commit de0e0b9

Please sign in to comment.