Skip to content

Commit 4a44188

Browse files
committed
Merge branch 'dev' into train_resume_step
2 parents 4dbcef4 + 3259928 commit 4a44188

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

.github/workflows/typos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ jobs:
1818
- uses: actions/checkout@v4
1919

2020
- name: typos-action
21-
uses: crate-ci/typos@v1.19.0
21+
uses: crate-ci/typos@v1.21.0

_typos.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Instruction: https://github.com/marketplace/actions/typos-action#getting-started
33

44
[default.extend-identifiers]
5+
ddPn08="ddPn08"
56

67
[default.extend-words]
78
NIN="NIN"
@@ -27,6 +28,7 @@ rik="rik"
2728
koo="koo"
2829
yos="yos"
2930
wn="wn"
31+
hime="hime"
3032

3133

3234
[files]

library/ipex/attention.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# pylint: disable=protected-access, missing-function-docstring, line-too-long
77

8-
# ARC GPUs can't allocate more than 4GB to a single block so we slice the attetion layers
8+
# ARC GPUs can't allocate more than 4GB to a single block so we slice the attention layers
99

1010
sdpa_slice_trigger_rate = float(os.environ.get('IPEX_SDPA_SLICE_TRIGGER_RATE', 4))
1111
attention_slice_rate = float(os.environ.get('IPEX_ATTENTION_SLICE_RATE', 4))

networks/control_net_lllite_for_train.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
import torch
88
from library import sdxl_original_unet
99
from library.utils import setup_logging
10+
1011
setup_logging()
1112
import logging
13+
1214
logger = logging.getLogger(__name__)
1315

1416
# input_blocksに適用するかどうか / if True, input_blocks are not applied
@@ -103,19 +105,15 @@ def set_lllite(self, depth, cond_emb_dim, name, mlp_dim, dropout=None, multiplie
103105
add_lllite_modules(self, in_dim, depth, cond_emb_dim, mlp_dim)
104106

105107
self.cond_image = None
106-
self.cond_emb = None
107108

108109
def set_cond_image(self, cond_image):
109110
self.cond_image = cond_image
110-
self.cond_emb = None
111111

112112
def forward(self, x):
113113
if not self.enabled:
114114
return super().forward(x)
115115

116-
if self.cond_emb is None:
117-
self.cond_emb = self.lllite_conditioning1(self.cond_image)
118-
cx = self.cond_emb
116+
cx = self.lllite_conditioning1(self.cond_image) # make forward and backward compatible
119117

120118
# reshape / b,c,h,w -> b,h*w,c
121119
n, c, h, w = cx.shape
@@ -159,9 +157,7 @@ def forward(self, x): # , cond_image=None):
159157
if not self.enabled:
160158
return super().forward(x)
161159

162-
if self.cond_emb is None:
163-
self.cond_emb = self.lllite_conditioning1(self.cond_image)
164-
cx = self.cond_emb
160+
cx = self.lllite_conditioning1(self.cond_image)
165161

166162
cx = torch.cat([cx, self.down(x)], dim=1)
167163
cx = self.mid(cx)

sdxl_train_control_net_lllite.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ def train(args):
289289
# acceleratorがなんかよろしくやってくれるらしい
290290
unet, optimizer, train_dataloader, lr_scheduler = accelerator.prepare(unet, optimizer, train_dataloader, lr_scheduler)
291291

292+
if isinstance(unet, DDP):
293+
unet._set_static_graph() # avoid error for multiple use of the parameter
294+
292295
if args.gradient_checkpointing:
293296
unet.train() # according to TI example in Diffusers, train is required -> これオリジナルのU-Netしたので本当は外せる
294297
else:

0 commit comments

Comments
 (0)