Merge branch 'main' into main

This commit is contained in:
Lincoln Stein 2023-07-19 22:43:18 -04:00 committed by GitHub
commit 82496fee14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 137 additions and 67 deletions

View File

@ -277,7 +277,7 @@ class InvokeAISettings(BaseSettings):
@classmethod @classmethod
def _excluded_from_yaml(self)->List[str]: def _excluded_from_yaml(self)->List[str]:
# combination of deprecated parameters and internal ones that shouldn't be exposed as invokeai.yaml options # combination of deprecated parameters and internal ones that shouldn't be exposed as invokeai.yaml options
return ['type','initconf', 'gpu_mem_reserved', 'max_loaded_models', 'version', 'from_file', 'model', 'restore'] return ['type','initconf', 'gpu_mem_reserved', 'max_loaded_models', 'version', 'from_file', 'model', 'restore', 'root']
class Config: class Config:
env_file_encoding = 'utf-8' env_file_encoding = 'utf-8'
@ -446,7 +446,7 @@ setting environment variables INVOKEAI_<setting>.
Path to the runtime root directory Path to the runtime root directory
''' '''
if self.root: if self.root:
return Path(self.root).expanduser() return Path(self.root).expanduser().absolute()
else: else:
return self.find_root() return self.find_root()

View File

@ -39,6 +39,7 @@ class ModelProbe(object):
CLASS2TYPE = { CLASS2TYPE = {
'StableDiffusionPipeline' : ModelType.Main, 'StableDiffusionPipeline' : ModelType.Main,
'StableDiffusionInpaintPipeline' : ModelType.Main,
'StableDiffusionXLPipeline' : ModelType.Main, 'StableDiffusionXLPipeline' : ModelType.Main,
'StableDiffusionXLImg2ImgPipeline' : ModelType.Main, 'StableDiffusionXLImg2ImgPipeline' : ModelType.Main,
'AutoencoderKL' : ModelType.Vae, 'AutoencoderKL' : ModelType.Vae,
@ -401,7 +402,7 @@ class PipelineFolderProbe(FolderProbeBase):
in_channels = conf['in_channels'] in_channels = conf['in_channels']
if in_channels == 9: if in_channels == 9:
return ModelVariantType.Inpainting return ModelVariantType.Inpaint
elif in_channels == 5: elif in_channels == 5:
return ModelVariantType.Depth return ModelVariantType.Depth
elif in_channels == 4: elif in_channels == 4:

View File

@ -547,7 +547,8 @@
"saveSteps": "Save images every n steps", "saveSteps": "Save images every n steps",
"confirmOnDelete": "Confirm On Delete", "confirmOnDelete": "Confirm On Delete",
"displayHelpIcons": "Display Help Icons", "displayHelpIcons": "Display Help Icons",
"useCanvasBeta": "Use Canvas Beta Layout", "alternateCanvasLayout": "Alternate Canvas Layout",
"enableNodesEditor": "Enable Nodes Editor",
"enableImageDebugging": "Enable Image Debugging", "enableImageDebugging": "Enable Image Debugging",
"useSlidersForAll": "Use Sliders For All Options", "useSlidersForAll": "Use Sliders For All Options",
"showProgressInViewer": "Show Progress Images in Viewer", "showProgressInViewer": "Show Progress Images in Viewer",
@ -564,7 +565,9 @@
"ui": "User Interface", "ui": "User Interface",
"favoriteSchedulers": "Favorite Schedulers", "favoriteSchedulers": "Favorite Schedulers",
"favoriteSchedulersPlaceholder": "No schedulers favorited", "favoriteSchedulersPlaceholder": "No schedulers favorited",
"showAdvancedOptions": "Show Advanced Options" "showAdvancedOptions": "Show Advanced Options",
"experimental": "Experimental",
"beta": "Beta"
}, },
"toast": { "toast": {
"serverError": "Server Error", "serverError": "Server Error",

View File

@ -9,7 +9,7 @@ import {
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import { memo } from 'react'; import { memo } from 'react';
interface Props extends SwitchProps { export interface IAISwitchProps extends SwitchProps {
label?: string; label?: string;
width?: string | number; width?: string | number;
formControlProps?: FormControlProps; formControlProps?: FormControlProps;
@ -20,7 +20,7 @@ interface Props extends SwitchProps {
/** /**
* Customized Chakra FormControl + Switch multi-part component. * Customized Chakra FormControl + Switch multi-part component.
*/ */
const IAISwitch = (props: Props) => { const IAISwitch = (props: IAISwitchProps) => {
const { const {
label, label,
isDisabled = false, isDisabled = false,

View File

@ -0,0 +1,57 @@
import { Badge, BadgeProps, Flex, Text, TextProps } from '@chakra-ui/react';
import IAISwitch, { IAISwitchProps } from 'common/components/IAISwitch';
import { useTranslation } from 'react-i18next';
type SettingSwitchProps = IAISwitchProps & {
label: string;
useBadge?: boolean;
badgeLabel?: string;
textProps?: TextProps;
badgeProps?: BadgeProps;
};
export default function SettingSwitch(props: SettingSwitchProps) {
const { t } = useTranslation();
const {
label,
textProps,
useBadge = false,
badgeLabel = t('settings.experimental'),
badgeProps,
...rest
} = props;
return (
<Flex justifyContent="space-between" py={1}>
<Flex gap={2} alignItems="center">
<Text
sx={{
fontSize: 14,
_dark: {
color: 'base.300',
},
}}
{...textProps}
>
{label}
</Text>
{useBadge && (
<Badge
size="xs"
sx={{
px: 2,
color: 'base.700',
bg: 'accent.200',
_dark: { bg: 'accent.500', color: 'base.200' },
}}
{...badgeProps}
>
{badgeLabel}
</Badge>
)}
</Flex>
<IAISwitch {...rest} />
</Flex>
);
}

View File

@ -11,13 +11,12 @@ import {
Text, Text,
useDisclosure, useDisclosure,
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import { createSelector, current } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import { VALID_LOG_LEVELS } from 'app/logging/useLogger'; import { VALID_LOG_LEVELS } from 'app/logging/useLogger';
import { LOCALSTORAGE_KEYS, LOCALSTORAGE_PREFIX } from 'app/store/constants'; import { LOCALSTORAGE_KEYS, LOCALSTORAGE_PREFIX } from 'app/store/constants';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import IAIButton from 'common/components/IAIButton'; import IAIButton from 'common/components/IAIButton';
import IAIMantineSelect from 'common/components/IAIMantineSelect'; import IAIMantineSelect from 'common/components/IAIMantineSelect';
import IAISwitch from 'common/components/IAISwitch';
import { systemSelector } from 'features/system/store/systemSelectors'; import { systemSelector } from 'features/system/store/systemSelectors';
import { import {
SystemState, SystemState,
@ -48,8 +47,9 @@ import {
} from 'react'; } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { LogLevelName } from 'roarr'; import { LogLevelName } from 'roarr';
import SettingsSchedulers from './SettingsSchedulers'; import SettingSwitch from './SettingSwitch';
import SettingsClearIntermediates from './SettingsClearIntermediates'; import SettingsClearIntermediates from './SettingsClearIntermediates';
import SettingsSchedulers from './SettingsSchedulers';
const selector = createSelector( const selector = createSelector(
[systemSelector, uiSelector], [systemSelector, uiSelector],
@ -206,7 +206,7 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
<Flex sx={{ gap: 4, flexDirection: 'column' }}> <Flex sx={{ gap: 4, flexDirection: 'column' }}>
<StyledFlex> <StyledFlex>
<Heading size="sm">{t('settings.general')}</Heading> <Heading size="sm">{t('settings.general')}</Heading>
<IAISwitch <SettingSwitch
label={t('settings.confirmOnDelete')} label={t('settings.confirmOnDelete')}
isChecked={shouldConfirmOnDelete} isChecked={shouldConfirmOnDelete}
onChange={(e: ChangeEvent<HTMLInputElement>) => onChange={(e: ChangeEvent<HTMLInputElement>) =>
@ -214,7 +214,7 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
} }
/> />
{shouldShowAdvancedOptionsSettings && ( {shouldShowAdvancedOptionsSettings && (
<IAISwitch <SettingSwitch
label={t('settings.showAdvancedOptions')} label={t('settings.showAdvancedOptions')}
isChecked={shouldShowAdvancedOptions} isChecked={shouldShowAdvancedOptions}
onChange={(e: ChangeEvent<HTMLInputElement>) => onChange={(e: ChangeEvent<HTMLInputElement>) =>
@ -231,37 +231,29 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
<StyledFlex> <StyledFlex>
<Heading size="sm">{t('settings.ui')}</Heading> <Heading size="sm">{t('settings.ui')}</Heading>
<IAISwitch <SettingSwitch
label={t('settings.displayHelpIcons')} label={t('settings.displayHelpIcons')}
isChecked={shouldDisplayGuides} isChecked={shouldDisplayGuides}
onChange={(e: ChangeEvent<HTMLInputElement>) => onChange={(e: ChangeEvent<HTMLInputElement>) =>
dispatch(setShouldDisplayGuides(e.target.checked)) dispatch(setShouldDisplayGuides(e.target.checked))
} }
/> />
{shouldShowBetaLayout && (
<IAISwitch <SettingSwitch
label={t('settings.useCanvasBeta')}
isChecked={shouldUseCanvasBetaLayout}
onChange={(e: ChangeEvent<HTMLInputElement>) =>
dispatch(setShouldUseCanvasBetaLayout(e.target.checked))
}
/>
)}
<IAISwitch
label={t('settings.useSlidersForAll')} label={t('settings.useSlidersForAll')}
isChecked={shouldUseSliders} isChecked={shouldUseSliders}
onChange={(e: ChangeEvent<HTMLInputElement>) => onChange={(e: ChangeEvent<HTMLInputElement>) =>
dispatch(setShouldUseSliders(e.target.checked)) dispatch(setShouldUseSliders(e.target.checked))
} }
/> />
<IAISwitch <SettingSwitch
label={t('settings.showProgressInViewer')} label={t('settings.showProgressInViewer')}
isChecked={shouldShowProgressInViewer} isChecked={shouldShowProgressInViewer}
onChange={(e: ChangeEvent<HTMLInputElement>) => onChange={(e: ChangeEvent<HTMLInputElement>) =>
dispatch(setShouldShowProgressInViewer(e.target.checked)) dispatch(setShouldShowProgressInViewer(e.target.checked))
} }
/> />
<IAISwitch <SettingSwitch
label={t('settings.antialiasProgressImages')} label={t('settings.antialiasProgressImages')}
isChecked={shouldAntialiasProgressImage} isChecked={shouldAntialiasProgressImage}
onChange={(e: ChangeEvent<HTMLInputElement>) => onChange={(e: ChangeEvent<HTMLInputElement>) =>
@ -270,9 +262,21 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
) )
} }
/> />
{shouldShowBetaLayout && (
<SettingSwitch
label={t('settings.alternateCanvasLayout')}
useBadge
badgeLabel={t('settings.beta')}
isChecked={shouldUseCanvasBetaLayout}
onChange={(e: ChangeEvent<HTMLInputElement>) =>
dispatch(setShouldUseCanvasBetaLayout(e.target.checked))
}
/>
)}
{shouldShowNodesToggle && ( {shouldShowNodesToggle && (
<IAISwitch <SettingSwitch
label="Enable Nodes Editor (Experimental)" label={t('settings.enableNodesEditor')}
useBadge
isChecked={isNodesEnabled} isChecked={isNodesEnabled}
onChange={handleToggleNodes} onChange={handleToggleNodes}
/> />
@ -282,7 +286,7 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
{shouldShowDeveloperSettings && ( {shouldShowDeveloperSettings && (
<StyledFlex> <StyledFlex>
<Heading size="sm">{t('settings.developer')}</Heading> <Heading size="sm">{t('settings.developer')}</Heading>
<IAISwitch <SettingSwitch
label={t('settings.shouldLogToConsole')} label={t('settings.shouldLogToConsole')}
isChecked={shouldLogToConsole} isChecked={shouldLogToConsole}
onChange={handleLogToConsoleChanged} onChange={handleLogToConsoleChanged}
@ -294,7 +298,7 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
value={consoleLogLevel} value={consoleLogLevel}
data={VALID_LOG_LEVELS.concat()} data={VALID_LOG_LEVELS.concat()}
/> />
<IAISwitch <SettingSwitch
label={t('settings.enableImageDebugging')} label={t('settings.enableImageDebugging')}
isChecked={enableImageDebugging} isChecked={enableImageDebugging}
onChange={(e: ChangeEvent<HTMLInputElement>) => onChange={(e: ChangeEvent<HTMLInputElement>) =>

View File

@ -75,42 +75,49 @@ const ModelList = (props: ModelListProps) => {
labelPos="side" labelPos="side"
/> />
{['images', 'diffusers'].includes(modelFormatFilter) && <Flex
filteredDiffusersModels.length > 0 && ( flexDirection="column"
<StyledModelContainer> gap={4}
<Flex sx={{ gap: 2, flexDir: 'column' }}> maxHeight={window.innerHeight - 280}
<Text variant="subtext" fontSize="sm"> overflow="scroll"
Diffusers >
</Text> {['images', 'diffusers'].includes(modelFormatFilter) &&
{filteredDiffusersModels.map((model) => ( filteredDiffusersModels.length > 0 && (
<ModelListItem <StyledModelContainer>
key={model.id} <Flex sx={{ gap: 2, flexDir: 'column' }}>
model={model} <Text variant="subtext" fontSize="sm">
isSelected={selectedModelId === model.id} Diffusers
setSelectedModelId={setSelectedModelId} </Text>
/> {filteredDiffusersModels.map((model) => (
))} <ModelListItem
</Flex> key={model.id}
</StyledModelContainer> model={model}
)} isSelected={selectedModelId === model.id}
{['images', 'checkpoint'].includes(modelFormatFilter) && setSelectedModelId={setSelectedModelId}
filteredCheckpointModels.length > 0 && ( />
<StyledModelContainer> ))}
<Flex sx={{ gap: 2, flexDir: 'column' }}> </Flex>
<Text variant="subtext" fontSize="sm"> </StyledModelContainer>
Checkpoint )}
</Text> {['images', 'checkpoint'].includes(modelFormatFilter) &&
{filteredCheckpointModels.map((model) => ( filteredCheckpointModels.length > 0 && (
<ModelListItem <StyledModelContainer>
key={model.id} <Flex sx={{ gap: 2, flexDir: 'column' }}>
model={model} <Text variant="subtext" fontSize="sm">
isSelected={selectedModelId === model.id} Checkpoints
setSelectedModelId={setSelectedModelId} </Text>
/> {filteredCheckpointModels.map((model) => (
))} <ModelListItem
</Flex> key={model.id}
</StyledModelContainer> model={model}
)} isSelected={selectedModelId === model.id}
setSelectedModelId={setSelectedModelId}
/>
))}
</Flex>
</StyledModelContainer>
)}
</Flex>
</Flex> </Flex>
</Flex> </Flex>
); );
@ -146,8 +153,6 @@ const StyledModelContainer = (props: PropsWithChildren) => {
return ( return (
<Flex <Flex
flexDirection="column" flexDirection="column"
maxHeight={window.innerHeight - 280}
overflow="scroll"
gap={4} gap={4}
borderRadius={4} borderRadius={4}
p={4} p={4}