Diffusers Samplers

DIsplay sampler list based on the active model.
This commit is contained in:
blessedcoolant 2023-02-07 18:26:06 +13:00
parent f121dfe120
commit fcffcf5602
2 changed files with 21 additions and 2 deletions

View File

@ -16,6 +16,20 @@ export const SAMPLERS: Array<string> = [
'k_heun',
];
// Valid Diffusers Samplers
export const DIFFUSERS_SAMPLERS: Array<string> = [
'ddim',
'plms',
'k_lms',
'dpmpp_2',
'k_dpm_2',
'k_dpm_2_a',
'k_dpmpp_2',
'k_euler',
'k_euler_a',
'k_heun',
];
// Valid image widths
export const WIDTHS: Array<number> = [
64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960,

View File

@ -1,13 +1,16 @@
import React, { ChangeEvent } from 'react';
import { SAMPLERS } from 'app/constants';
import { DIFFUSERS_SAMPLERS, SAMPLERS } from 'app/constants';
import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAISelect from 'common/components/IAISelect';
import { setSampler } from 'features/options/store/optionsSlice';
import { useTranslation } from 'react-i18next';
import _ from 'lodash';
import { activeModelSelector } from 'features/system/store/systemSelectors';
export default function MainSampler() {
const sampler = useAppSelector((state: RootState) => state.options.sampler);
const activeModel = useAppSelector(activeModelSelector);
const dispatch = useAppDispatch();
const { t } = useTranslation();
@ -19,7 +22,9 @@ export default function MainSampler() {
label={t('options:sampler')}
value={sampler}
onChange={handleChangeSampler}
validValues={SAMPLERS}
validValues={
activeModel.format === 'diffusers' ? DIFFUSERS_SAMPLERS : SAMPLERS
}
styleClass="main-option-block"
/>
);