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

Add Timestep Sampling Function from SD3 Branch to SD #1668

Closed
wants to merge 278 commits into from

Conversation

gesen2egee
Copy link
Contributor

This PR introduces the timestep_sampling feature from SD3 Branch into the original SD model. The new timestep sampling options offer a more concentrated probability distribution compared to the default uniform sampling, which helps the model focus on specific aspects of learning. The new options can be used via the --timestep_sampling argument.

  • Default (uniform): Keeps the original uniform timestep sampling, which evenly distributes the learning steps.
  • Sigmoid: Behaves similarly to shift by default --discrete_flow_shift = 1.
  • Shift: Skews the timestep distribution, helping the model concentrate on style learning or specific objects.
  • Flux Shift: This option shift with the image size, similar to how FLUX behaves in larger images

Additional Parameters:

  • --discrete_flow_shift: By default set to 1, uses random normal distribution to sample timesteps. A rightward shift helps the model focus more on style, while a leftward shift aids in learning specific objects. The default value is 1, providing a balanced form.
  • --sigmoid_scale: Adjusts the shape of the sigmoid function.
    image

While flux_shift maintains the distortion effects of FLUX, its application may vary in SD due to differences in model nature and training at fixed resolutions.

It is recommended to use the --timestep_sampling sigmoid option, combined with --soft_min_snr_gamma = 1
By rockerBOO #1068
#1068
for better results, as these settings seem to significantly improve model performance.

Suggested to merge this PR along with the soft min snr gamma PR.

aria1th and others added 30 commits May 7, 2024 18:21
Add "--disable_mmap_load_safetensors" parameter
removed unnecessary `torch` import on line 115
Fix caption_separator missing in subset schema
Add caption_separator to output for subset
Accelerate: fix get_trainable_params in controlnet-llite training
@gesen2egee gesen2egee closed this Oct 4, 2024
@gesen2egee gesen2egee reopened this Oct 4, 2024
@kohya-ss
Copy link
Owner

kohya-ss commented Oct 4, 2024

It looks like this PR is trying to merge all the changes from the sd3 branch into main, please make any fixes within the sd3 branch.

@gesen2egee
Copy link
Contributor Author

I got it, open #1671 and close this.

@gesen2egee gesen2egee closed this Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.