refactor: extract karras scheduler from sampler in ai horde

This commit is contained in:
Maiko Tan 2024-02-15 10:20:09 +08:00
parent dcfda09821
commit 061a87bc3c
No known key found for this signature in database
GPG Key ID: 0F3B49C721E5F453
2 changed files with 6 additions and 14 deletions

View File

@ -80,6 +80,9 @@ export namespace sampler {
'unipc': 'UniPC',
}
// samplers in AI horde
// https://stablehorde.net/api/
// (under Models - ModelGenerationInputStable - sampler_name)
export const horde = {
k_lms: 'LMS',
k_heun: 'Heun',
@ -93,18 +96,6 @@ export namespace sampler {
k_dpmpp_2s_a: 'DPM++ 2S a',
k_dpmpp_sde: 'DPM++ SDE',
DDIM: 'DDIM',
k_lms_ka: 'LMS Karras',
k_heun_ka: 'Heun Karras',
k_euler_ka: 'Euler Karras',
k_euler_a_ka: 'Euler a Karras',
k_dpm_2_ka: 'DPM2 Karras',
k_dpm_2_a_ka: 'DPM2 a Karras',
k_dpm_fast_ka: 'DPM fast Karras',
k_dpm_adaptive_ka: 'DPM adaptive Karras',
k_dpmpp_2m_ka: 'DPM++ 2M Karras',
k_dpmpp_2s_a_ka: 'DPM++ 2S a Karras',
k_dpmpp_sde_ka: 'DPM++ SDE Karras',
DDIM_ka: 'DDIM Karras',
}
export function createSchema(map: Dict<string>) {

View File

@ -110,6 +110,7 @@ export function apply(ctx: Context, config: Config) {
.option('smea', '-S', { hidden: () => config.model !== 'nai-v3' })
.option('smeaDyn', '-d', { hidden: () => config.model !== 'nai-v3' })
.option('scheduler', '-C <scheduler> ', { hidden: () => config.model !== 'nai-v3', type: scheduler })
.option('karras', '-K', { hidden: useBackend('stable-horde') })
.option('decrisper', '-D', { hidden: thirdParty })
.option('undesired', '-u <undesired>')
.option('noTranslator', '-T', { hidden: () => !ctx.translator || !config.translator })
@ -359,14 +360,14 @@ export function apply(ctx: Context, config: Config) {
return {
prompt: parameters.prompt,
params: {
sampler_name: options.sampler.replace('_ka', ''),
sampler_name: options.sampler,
cfg_scale: parameters.scale,
denoising_strength: parameters.strength,
seed: parameters.seed.toString(),
height: parameters.height,
width: parameters.width,
post_processing: [],
karras: options.sampler.includes('_ka'),
karras: options.karras,
hires_fix: options.hiresFix ?? config.hiresFix ?? false,
steps: parameters.steps,
n: parameters.n_samples,