Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hardcoded bucket_step overrides configurable parameter #1915

Open
iqddd opened this issue Feb 1, 2025 · 4 comments
Open

Hardcoded bucket_step overrides configurable parameter #1915

iqddd opened this issue Feb 1, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@iqddd
Copy link

iqddd commented Feb 1, 2025

Hey, just noticed that bucket_step is hardcoded to 64 here:

sd-scripts/train_network.py

Lines 127 to 130 in 0778dd9

def assert_extra_args(self, args, train_dataset_group: Union[train_util.DatasetGroup, train_util.MinimalDataset], val_dataset_group: Optional[train_util.DatasetGroup]):
train_dataset_group.verify_bucket_reso_steps(64)
if val_dataset_group is not None:
val_dataset_group.verify_bucket_reso_steps(64)

But there's already a configurable parameter for this elsewhere in the code. This kinda defeats the purpose of having it configurable in the first place.

Personally, I find 32 way more practical than 64. Any particular reason for this change? Any chance we can bring back configurability?

@iqddd
Copy link
Author

iqddd commented Feb 1, 2025

verify_bucket_reso_steps(32) is unreachable in FluxNetworkTrainer

In FluxNetworkTrainer.assert_extra_args, we call super().assert_extra_args(args, train_dataset_group, val_dataset_group) first:

class FluxNetworkTrainer(train_network.NetworkTrainer):
# ------
    def assert_extra_args(self, args, train_dataset_group: Union[train_util.DatasetGroup, train_util.MinimalDataset], val_dataset_group: Optional[train_util.DatasetGroup]):
        # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓
        super().assert_extra_args(args, train_dataset_group, val_dataset_group)
# ------
        train_dataset_group.verify_bucket_reso_steps(32)  # TODO check this

However, super().assert_extra_args (from NetworkTrainer) already calls:

class NetworkTrainer:
# ------
    def assert_extra_args(self, args, train_dataset_group: Union[train_util.DatasetGroup, train_util.MinimalDataset], val_dataset_group: Optional[train_util.DatasetGroup]):
        train_dataset_group.verify_bucket_reso_steps(64)
        if val_dataset_group is not None:
            val_dataset_group.verify_bucket_reso_steps(64)

Since verify_bucket_reso_steps(64) asserts if the value is lower than 64, the execution will never reach verify_bucket_reso_steps(32), making it effectively dead code.

Is this intentional, or should verify_bucket_reso_steps(32) be called before super().assert_extra_args?

@PercyDan54
Copy link

PercyDan54 commented Feb 3, 2025

verify_bucket_reso_steps(32) is unreachable in FluxNetworkTrainer

It is also unreachable in SdxlNetworkTrainer and Sd3NetworkTrainer.

And it seems a regression from
fe2aa32#diff-62cf7de156b588b9acd7af26941d7bb189368221946c8b5e63f69df5cda56f39

@kohya-ss
Copy link
Owner

kohya-ss commented Feb 3, 2025

Thank you for this. I will check it sooner.

@kohya-ss kohya-ss added the bug Something isn't working label Feb 3, 2025
@rockerBOO
Copy link
Contributor

https://github.com/black-forest-labs/flux/blob/main/demo_st_fill.py#L84-L105 confirming flux suggests possibly 32.

SD1.5 wants 64 (train_network.py version).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants