kohya-ss / kohya-ss/sd-scripts

error when dataset config has subsets with different flip_aug settings

Open
#1,310 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.2k
Forks
1.2k
Avg merge
11m
Merged PRs (30d)
2

Description

When I try to use a dataset config with 2 subsets, one where flip_aug is enabled and one where flip_aug is disabled, I get the following error:

```
File "E:\ai_experimentation\kohya_ss\sd-scripts\library\train_util.py", line 1250, in __getitem__
target_size = (image.shape[2], image.shape[1]) if image is not None else (latents.shape[2] * 8, latents.shape[1] * 8)
AttributeError: 'NoneType' object has no attribute 'shape'
```

Both image and latents is None for some reason. The config file is as follows:

```
[[datasets]]

[[datasets.subsets]]
image_dir = 'E:\test_non_flip'
flip_aug = false

[[datasets.subsets]]
image_dir = 'E:\test_flip'
flip_aug = true
```

The problem goes away if I put them in separate datasets however:

```
[[datasets]]

[[datasets.subsets]]
image_dir = 'E:\test_non_flip'
flip_aug = false

[[datasets]]
[[datasets.subsets]]
image_dir = 'E:\test_flip'
flip_aug = true
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in library/train_util.py at line 1250 and reproduce the error with the supplied dataset configuration containing two subsets with different flip_aug settings. Compare it with the working configuration that uses separate datasets; done means the combined configuration no longer reaches the None.shape failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.