bmaltais / kohya_ss

Apache License 2.0
9.27k stars 1.2k forks source link

any way to disable scheduled huber loss #2637

Open DarkViewAI opened 1 month ago

DarkViewAI commented 1 month ago

is there any way to remove it or disable it from using?

bmaltais commented 1 month ago

My understanding from the code is that unless you set it to something else than snr it won't be used:

    parser.add_argument(
        "--loss_type",
        type=str,
        default="l2",
        choices=["l2", "huber", "smooth_l1"],
        help="The type of loss function to use (L2, Huber, or smooth L1), default is L2 / 使用する損失関数の種類(L2、Huber、またはsmooth L1)、デフォルトはL2",
    )
    parser.add_argument(
        "--huber_schedule",
        type=str,
        default="snr",
        choices=["constant", "exponential", "snr"],
        help="The scheduling method for Huber loss (constant, exponential, or SNR-based). Only used when loss_type is 'huber' or 'smooth_l1'. default is snr"
        + " / Huber損失のスケジューリング方法(constant、exponential、またはSNRベース)。loss_typeが'huber'または'smooth_l1'の場合に有効、デフォルトは snr",
    )
DarkViewAI commented 1 month ago

seems like even when i pick something else the trainings come out bad, i used older version of kohya without it, and my results are good.

bmaltais commented 1 month ago

The codebase has undergone numerous changes over time, making it challenging to pinpoint the exact source of differences in output. These variations could stem from multiple places within the sd-scripts, not to mention the required updates to Python modules and other dependencies. If you're aware of a specific version that previously produced the desired results, it may be best to use that one. While it might have fewer features, it will likely fulfill your needs more effectively. After all, a new tool with numerous bells and whistles is of little value if it doesn't accomplish your primary objectives.

DarkViewAI commented 1 month ago

@bmaltais thanks! i figured out some good settings with huber loss, actually getting better results now.