mirror of
https://github.com/kohya-ss/sd-scripts.git
synced 2026-04-08 22:35:09 +00:00
update help and README
This commit is contained in:
@@ -11,6 +11,10 @@ The command to install PyTorch is as follows:
|
|||||||
|
|
||||||
### Recent Updates
|
### Recent Updates
|
||||||
|
|
||||||
|
Sep 1, 2024:
|
||||||
|
- `--timestamp_sampling` has `flux_shift` option. Thanks to sdbds!
|
||||||
|
- This is the same shift as FLUX.1 dev inference, adjusting the timestep sampling depending on the resolution. `--discrete_flow_shift` is ignored when `flux_shift` is specified. It is not verified which is better, `shift` or `flux_shift`.
|
||||||
|
|
||||||
Aug 29, 2024:
|
Aug 29, 2024:
|
||||||
Please update `safetensors` to `0.4.4` to fix the error when using `--resume`. `requirements.txt` is updated.
|
Please update `safetensors` to `0.4.4` to fix the error when using `--resume`. `requirements.txt` is updated.
|
||||||
|
|
||||||
@@ -73,6 +77,7 @@ There are many unknown points in FLUX.1 training, so some settings can be specif
|
|||||||
- `uniform`: uniform random
|
- `uniform`: uniform random
|
||||||
- `sigmoid`: sigmoid of random normal, same as x-flux, AI-toolkit etc.
|
- `sigmoid`: sigmoid of random normal, same as x-flux, AI-toolkit etc.
|
||||||
- `shift`: shifts the value of sigmoid of normal distribution random number
|
- `shift`: shifts the value of sigmoid of normal distribution random number
|
||||||
|
- `flux_shift`: shifts the value of sigmoid of normal distribution random number, depending on the resolution (same as FLUX.1 dev inference). `--discrete_flow_shift` is ignored when `flux_shift` is specified.
|
||||||
- `--sigmoid_scale` is the scale factor for sigmoid timestep sampling (only used when timestep-sampling is "sigmoid"). The default is 1.0. Larger values will make the sampling more uniform.
|
- `--sigmoid_scale` is the scale factor for sigmoid timestep sampling (only used when timestep-sampling is "sigmoid"). The default is 1.0. Larger values will make the sampling more uniform.
|
||||||
- This option is effective even when`--timestep_sampling shift` is specified.
|
- This option is effective even when`--timestep_sampling shift` is specified.
|
||||||
- Normally, leave it at 1.0. Larger values make the value before shift closer to a uniform distribution.
|
- Normally, leave it at 1.0. Larger values make the value before shift closer to a uniform distribution.
|
||||||
|
|||||||
@@ -371,7 +371,7 @@ def compute_loss_weighting_for_sd3(weighting_scheme: str, sigmas=None):
|
|||||||
def get_noisy_model_input_and_timesteps(
|
def get_noisy_model_input_and_timesteps(
|
||||||
args, noise_scheduler, latents, noise, device, dtype
|
args, noise_scheduler, latents, noise, device, dtype
|
||||||
) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
||||||
bsz, _, H, W = latents.shape
|
bsz, _, h, w = latents.shape
|
||||||
sigmas = None
|
sigmas = None
|
||||||
|
|
||||||
if args.timestep_sampling == "uniform" or args.timestep_sampling == "sigmoid":
|
if args.timestep_sampling == "uniform" or args.timestep_sampling == "sigmoid":
|
||||||
@@ -399,7 +399,7 @@ def get_noisy_model_input_and_timesteps(
|
|||||||
logits_norm = torch.randn(bsz, device=device)
|
logits_norm = torch.randn(bsz, device=device)
|
||||||
logits_norm = logits_norm * args.sigmoid_scale # larger scale for more uniform sampling
|
logits_norm = logits_norm * args.sigmoid_scale # larger scale for more uniform sampling
|
||||||
timesteps = logits_norm.sigmoid()
|
timesteps = logits_norm.sigmoid()
|
||||||
mu=get_lin_function(y1=0.5, y2=1.15)((H//2) * (W//2))
|
mu = get_lin_function(y1=0.5, y2=1.15)((h // 2) * (w // 2))
|
||||||
timesteps = time_shift(mu, 1.0, timesteps)
|
timesteps = time_shift(mu, 1.0, timesteps)
|
||||||
|
|
||||||
t = timesteps.view(-1, 1, 1, 1)
|
t = timesteps.view(-1, 1, 1, 1)
|
||||||
@@ -583,8 +583,8 @@ def add_flux_train_arguments(parser: argparse.ArgumentParser):
|
|||||||
"--timestep_sampling",
|
"--timestep_sampling",
|
||||||
choices=["sigma", "uniform", "sigmoid", "shift", "flux_shift"],
|
choices=["sigma", "uniform", "sigmoid", "shift", "flux_shift"],
|
||||||
default="sigma",
|
default="sigma",
|
||||||
help="Method to sample timesteps: sigma-based, uniform random, sigmoid of random normal and shift of sigmoid."
|
help="Method to sample timesteps: sigma-based, uniform random, sigmoid of random normal, shift of sigmoid and FLUX.1 shifting."
|
||||||
" / タイムステップをサンプリングする方法:sigma、random uniform、random normalのsigmoid、sigmoidのシフト。",
|
" / タイムステップをサンプリングする方法:sigma、random uniform、random normalのsigmoid、sigmoidのシフト、FLUX.1のシフト。",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--sigmoid_scale",
|
"--sigmoid_scale",
|
||||||
|
|||||||
Reference in New Issue
Block a user