Compare commits

...

5 Commits

Author SHA1 Message Date
Kohya S
6b1520a46b Merge pull request #1187 from kohya-ss/fix-timeemb
fix sdxl timestep embedding
2024-03-15 21:17:13 +09:00
Kohya S
f811b115ba fix sdxl timestep embedding 2024-03-15 21:05:00 +09:00
Kohya S
2d7389185c Merge pull request #1094 from kohya-ss/dependabot/github_actions/crate-ci/typos-1.17.2
Bump crate-ci/typos from 1.16.26 to 1.17.2
2024-02-27 18:23:41 +09:00
Kohya S
fccbee2727 revert logging #1137 2024-02-25 10:43:14 +09:00
dependabot[bot]
716a92cbed Bump crate-ci/typos from 1.16.26 to 1.17.2
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.16.26 to 1.17.2.
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.16.26...v1.17.2)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-01 01:57:52 +00:00
4 changed files with 19 additions and 12 deletions

View File

@@ -18,4 +18,4 @@ jobs:
- uses: actions/checkout@v4
- name: typos-action
uses: crate-ci/typos@v1.16.26
uses: crate-ci/typos@v1.17.2

View File

@@ -249,6 +249,16 @@ ControlNet-LLLite, a novel method for ControlNet with SDXL, is added. See [docum
## Change History
### Mar 15, 2024 / 2024/3/15: v0.8.5
- Fixed a bug that the value of timestep embedding during SDXL training was incorrect.
- The inference with the generation script is also fixed.
- The impact is unknown, but please update for SDXL training.
- SDXL 学習時の timestep embedding の値が誤っていたのを修正しました。
- 生成スクリプトでの推論時についてもあわせて修正しました。
- 影響の度合いは不明ですが、SDXL の学習時にはアップデートをお願いいたします。
### Feb 24, 2024 / 2024/2/24: v0.8.4
- The log output has been improved. PR [#905](https://github.com/kohya-ss/sd-scripts/pull/905) Thanks to shirayu!

View File

@@ -3,11 +3,6 @@ import gc
import torch
from .utils import setup_logging
setup_logging()
import logging
logger = logging.getLogger(__name__)
try:
HAS_CUDA = torch.cuda.is_available()
except Exception:
@@ -64,7 +59,7 @@ def get_preferred_device() -> torch.device:
device = torch.device("mps")
else:
device = torch.device("cpu")
logger.info(f"get_preferred_device() -> {device}")
print(f"get_preferred_device() -> {device}")
return device
@@ -82,8 +77,8 @@ def init_ipex():
is_initialized, error_message = ipex_init()
if not is_initialized:
logger.error("failed to initialize ipex: {error_message}")
print("failed to initialize ipex:", error_message)
else:
return
except Exception as e:
logger.error("failed to initialize ipex: {e}")
print("failed to initialize ipex:", e)

View File

@@ -31,8 +31,10 @@ from torch import nn
from torch.nn import functional as F
from einops import rearrange
from .utils import setup_logging
setup_logging()
import logging
logger = logging.getLogger(__name__)
IN_CHANNELS: int = 4
@@ -1074,7 +1076,7 @@ class SdxlUNet2DConditionModel(nn.Module):
timesteps = timesteps.expand(x.shape[0])
hs = []
t_emb = get_timestep_embedding(timesteps, self.model_channels) # , repeat_only=False)
t_emb = get_timestep_embedding(timesteps, self.model_channels, downscale_freq_shift=0) # , repeat_only=False)
t_emb = t_emb.to(x.dtype)
emb = self.time_embed(t_emb)
@@ -1132,7 +1134,7 @@ class InferSdxlUNet2DConditionModel:
# call original model's methods
def __getattr__(self, name):
return getattr(self.delegate, name)
def __call__(self, *args, **kwargs):
return self.delegate(*args, **kwargs)
@@ -1164,7 +1166,7 @@ class InferSdxlUNet2DConditionModel:
timesteps = timesteps.expand(x.shape[0])
hs = []
t_emb = get_timestep_embedding(timesteps, _self.model_channels) # , repeat_only=False)
t_emb = get_timestep_embedding(timesteps, _self.model_channels, downscale_freq_shift=0) # , repeat_only=False)
t_emb = t_emb.to(x.dtype)
emb = _self.time_embed(t_emb)