Merge branch 'main' into bugfix/save-intermediates

This commit is contained in:
Lincoln Stein 2023-02-20 12:51:53 -05:00 committed by GitHub
commit cf53bba99e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 200 additions and 87 deletions

59
.github/CODEOWNERS vendored
View File

@ -1,50 +1,51 @@
# continuous integration # continuous integration
/.github/workflows/ @mauwii /.github/workflows/ @mauwii @lstein @blessedcoolant
# documentation # documentation
/docs/ @lstein @mauwii @tildebyte /docs/ @lstein @mauwii @tildebyte @blessedcoolant
mkdocs.yml @lstein @mauwii mkdocs.yml @lstein @mauwii @blessedcoolant
# installation and configuration # installation and configuration
/pyproject.toml @mauwii @lstein @ebr /pyproject.toml @mauwii @lstein @ebr @blessedcoolant
/docker/ @mauwii /docker/ @mauwii @lstein @blessedcoolant
/scripts/ @ebr @lstein /scripts/ @ebr @lstein @blessedcoolant
/installer/ @ebr @lstein @tildebyte /installer/ @ebr @lstein @tildebyte @blessedcoolant
ldm/invoke/config @lstein @ebr ldm/invoke/config @lstein @ebr @blessedcoolant
invokeai/assets @lstein @ebr invokeai/assets @lstein @ebr @blessedcoolant
invokeai/configs @lstein @ebr invokeai/configs @lstein @ebr @blessedcoolant
/ldm/invoke/_version.py @lstein @blessedcoolant /ldm/invoke/_version.py @lstein @blessedcoolant
# web ui # web ui
/invokeai/frontend @blessedcoolant @psychedelicious /invokeai/frontend @blessedcoolant @psychedelicious @lstein
/invokeai/backend @blessedcoolant @psychedelicious /invokeai/backend @blessedcoolant @psychedelicious @lstein
# generation and model management # generation and model management
/ldm/*.py @lstein /ldm/*.py @lstein @blessedcoolant
/ldm/generate.py @lstein @keturn /ldm/generate.py @lstein @keturn @blessedcoolant
/ldm/invoke/args.py @lstein @blessedcoolant /ldm/invoke/args.py @lstein @blessedcoolant
/ldm/invoke/ckpt* @lstein /ldm/invoke/ckpt* @lstein @blessedcoolant
/ldm/invoke/ckpt_generator @lstein /ldm/invoke/ckpt_generator @lstein @blessedcoolant
/ldm/invoke/CLI.py @lstein /ldm/invoke/CLI.py @lstein @blessedcoolant
/ldm/invoke/config @lstein @ebr @mauwii /ldm/invoke/config @lstein @ebr @mauwii @blessedcoolant
/ldm/invoke/generator @keturn @damian0815 /ldm/invoke/generator @keturn @damian0815 @blessedcoolant
/ldm/invoke/globals.py @lstein @blessedcoolant /ldm/invoke/globals.py @lstein @blessedcoolant
/ldm/invoke/merge_diffusers.py @lstein /ldm/invoke/merge_diffusers.py @lstein @blessedcoolant
/ldm/invoke/model_manager.py @lstein @blessedcoolant /ldm/invoke/model_manager.py @lstein @blessedcoolant
/ldm/invoke/txt2mask.py @lstein /ldm/invoke/txt2mask.py @lstein @blessedcoolant
/ldm/invoke/patchmatch.py @Kyle0654 /ldm/invoke/patchmatch.py @Kyle0654 @blessedcoolant @lstein
/ldm/invoke/restoration @lstein @blessedcoolant /ldm/invoke/restoration @lstein @blessedcoolant
# attention, textual inversion, model configuration # attention, textual inversion, model configuration
/ldm/models @damian0815 @keturn /ldm/models @damian0815 @keturn @lstein @blessedcoolant
/ldm/modules @damian0815 @keturn /ldm/modules @damian0815 @keturn @lstein @blessedcoolant
# Nodes # Nodes
apps/ @Kyle0654 apps/ @Kyle0654 @lstein @blessedcoolant
# legacy REST API # legacy REST API
# is CapableWeb still engaged? # is CapableWeb still engaged?
/ldm/invoke/pngwriter.py @CapableWeb /ldm/invoke/pngwriter.py @CapableWeb @lstein @blessedcoolant
/ldm/invoke/server_legacy.py @CapableWeb /ldm/invoke/server_legacy.py @CapableWeb @lstein @blessedcoolant
/scripts/legacy_api.py @CapableWeb /scripts/legacy_api.py @CapableWeb @lstein @blessedcoolant
/tests/legacy_tests.sh @CapableWeb /tests/legacy_tests.sh @CapableWeb @lstein @blessedcoolant

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>InvokeAI - A Stable Diffusion Toolkit</title> <title>InvokeAI - A Stable Diffusion Toolkit</title>
<link rel="shortcut icon" type="icon" href="./assets/favicon-0d253ced.ico" /> <link rel="shortcut icon" type="icon" href="./assets/favicon-0d253ced.ico" />
<script type="module" crossorigin src="./assets/index-53ecf883.js"></script> <script type="module" crossorigin src="./assets/index-7d7a19f3.js"></script>
<link rel="stylesheet" href="./assets/index-14cb2922.css"> <link rel="stylesheet" href="./assets/index-14cb2922.css">
</head> </head>

View File

@ -441,6 +441,8 @@
"infillScalingHeader": "Infill and Scaling", "infillScalingHeader": "Infill and Scaling",
"img2imgStrength": "Image To Image Strength", "img2imgStrength": "Image To Image Strength",
"toggleLoopback": "Toggle Loopback", "toggleLoopback": "Toggle Loopback",
"hSymmetryStep": "H Symmetry Step",
"vSymmetryStep": "V Symmetry Step",
"invoke": "Invoke", "invoke": "Invoke",
"cancel": { "cancel": {
"immediate": "Cancel immediately", "immediate": "Cancel immediately",

View File

@ -441,6 +441,8 @@
"infillScalingHeader": "Infill and Scaling", "infillScalingHeader": "Infill and Scaling",
"img2imgStrength": "Image To Image Strength", "img2imgStrength": "Image To Image Strength",
"toggleLoopback": "Toggle Loopback", "toggleLoopback": "Toggle Loopback",
"hSymmetryStep": "H Symmetry Step",
"vSymmetryStep": "V Symmetry Step",
"invoke": "Invoke", "invoke": "Invoke",
"cancel": { "cancel": {
"immediate": "Cancel immediately", "immediate": "Cancel immediately",

View File

@ -65,6 +65,8 @@ export type BackendGenerationParameters = {
with_variations?: Array<Array<number>>; with_variations?: Array<Array<number>>;
variation_amount?: number; variation_amount?: number;
enable_image_debugging?: boolean; enable_image_debugging?: boolean;
h_symmetry_time_pct: number;
v_symmetry_time_pct: number;
}; };
export type BackendEsrGanParameters = { export type BackendEsrGanParameters = {
@ -141,6 +143,8 @@ export const frontendToBackendParameters = (
tileSize, tileSize,
variationAmount, variationAmount,
width, width,
horizontalSymmetryTimePercentage,
verticalSymmetryTimePercentage,
} = generationState; } = generationState;
const { const {
@ -165,13 +169,22 @@ export const frontendToBackendParameters = (
save_intermediates: saveIntermediatesInterval, save_intermediates: saveIntermediatesInterval,
generation_mode: generationMode, generation_mode: generationMode,
init_mask: '', init_mask: '',
h_symmetry_time_pct: horizontalSymmetryTimePercentage,
v_symmetry_time_pct: verticalSymmetryTimePercentage,
}; };
let esrganParameters: false | BackendEsrGanParameters = false; let esrganParameters: false | BackendEsrGanParameters = false;
let facetoolParameters: false | BackendFacetoolParameters = false; let facetoolParameters: false | BackendFacetoolParameters = false;
// Multiplying it by 10000 so the Slider can have values between 0 and 1 which makes more sense generationParameters.h_symmetry_time_pct = Math.max(
generationParameters.threshold = threshold * 1000; 0,
Math.min(1, horizontalSymmetryTimePercentage / steps)
);
generationParameters.v_symmetry_time_pct = Math.max(
0,
Math.min(1, verticalSymmetryTimePercentage / steps)
);
if (negativePrompt !== '') { if (negativePrompt !== '') {
generationParameters.prompt = `${prompt} [${negativePrompt}]`; generationParameters.prompt = `${prompt} [${negativePrompt}]`;

View File

@ -1,10 +1,12 @@
import { Flex } from '@chakra-ui/react'; import { Flex } from '@chakra-ui/react';
import SeamlessSettings from './SeamlessSettings'; import SeamlessSettings from './SeamlessSettings';
import SymmetrySettings from './SymmetrySettings';
const ImageToImageOutputSettings = () => { const ImageToImageOutputSettings = () => {
return ( return (
<Flex gap={2} direction="column"> <Flex gap={2} direction="column">
<SeamlessSettings /> <SeamlessSettings />
<SymmetrySettings />
</Flex> </Flex>
); );
}; };

View File

@ -1,12 +1,14 @@
import { Flex } from '@chakra-ui/react'; import { Flex } from '@chakra-ui/react';
import HiresSettings from './HiresSettings'; import HiresSettings from './HiresSettings';
import SeamlessSettings from './SeamlessSettings'; import SeamlessSettings from './SeamlessSettings';
import SymmetrySettings from './SymmetrySettings';
const OutputSettings = () => { const OutputSettings = () => {
return ( return (
<Flex gap={2} direction="column"> <Flex gap={2} direction="column">
<SeamlessSettings /> <SeamlessSettings />
<HiresSettings /> <HiresSettings />
<SymmetrySettings />
</Flex> </Flex>
); );
}; };

View File

@ -0,0 +1,57 @@
import { RootState } from 'app/store';
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
import IAISlider from 'common/components/IAISlider';
import {
setHorizontalSymmetryTimePercentage,
setVerticalSymmetryTimePercentage,
} from 'features/parameters/store/generationSlice';
import { useTranslation } from 'react-i18next';
export default function SymmetrySettings() {
const horizontalSymmetryTimePercentage = useAppSelector(
(state: RootState) => state.generation.horizontalSymmetryTimePercentage
);
const verticalSymmetryTimePercentage = useAppSelector(
(state: RootState) => state.generation.verticalSymmetryTimePercentage
);
const steps = useAppSelector((state: RootState) => state.generation.steps);
const dispatch = useAppDispatch();
const { t } = useTranslation();
return (
<>
<IAISlider
label={t('parameters.hSymmetryStep')}
value={horizontalSymmetryTimePercentage}
onChange={(v) => dispatch(setHorizontalSymmetryTimePercentage(v))}
min={0}
max={steps}
step={1}
withInput
inputWidth="6.5rem"
withSliderMarks
withReset
handleReset={() => dispatch(setHorizontalSymmetryTimePercentage(0))}
sliderMarkRightOffset={-6}
></IAISlider>
<IAISlider
label={t('parameters.vSymmetryStep')}
value={verticalSymmetryTimePercentage}
onChange={(v) => dispatch(setVerticalSymmetryTimePercentage(v))}
min={0}
max={steps}
step={1}
withInput
inputWidth="6.5rem"
withSliderMarks
withReset
handleReset={() => dispatch(setVerticalSymmetryTimePercentage(0))}
sliderMarkRightOffset={-6}
></IAISlider>
</>
);
}

View File

@ -15,8 +15,8 @@ export default function Threshold() {
<IAISlider <IAISlider
label={t('parameters.noiseThreshold')} label={t('parameters.noiseThreshold')}
min={0} min={0}
max={1} max={20}
step={0.005} step={0.1}
onChange={(v) => dispatch(setThreshold(v))} onChange={(v) => dispatch(setThreshold(v))}
handleReset={() => dispatch(setThreshold(0))} handleReset={() => dispatch(setThreshold(0))}
value={threshold} value={threshold}

View File

@ -32,6 +32,8 @@ export interface GenerationState {
tileSize: number; tileSize: number;
variationAmount: number; variationAmount: number;
width: number; width: number;
horizontalSymmetryTimePercentage: number;
verticalSymmetryTimePercentage: number;
} }
const initialGenerationState: GenerationState = { const initialGenerationState: GenerationState = {
@ -60,6 +62,8 @@ const initialGenerationState: GenerationState = {
tileSize: 32, tileSize: 32,
variationAmount: 0.1, variationAmount: 0.1,
width: 512, width: 512,
horizontalSymmetryTimePercentage: 0,
verticalSymmetryTimePercentage: 0,
}; };
const initialState: GenerationState = initialGenerationState; const initialState: GenerationState = initialGenerationState;
@ -325,6 +329,18 @@ export const generationSlice = createSlice({
setInfillMethod: (state, action: PayloadAction<string>) => { setInfillMethod: (state, action: PayloadAction<string>) => {
state.infillMethod = action.payload; state.infillMethod = action.payload;
}, },
setHorizontalSymmetryTimePercentage: (
state,
action: PayloadAction<number>
) => {
state.horizontalSymmetryTimePercentage = action.payload;
},
setVerticalSymmetryTimePercentage: (
state,
action: PayloadAction<number>
) => {
state.verticalSymmetryTimePercentage = action.payload;
},
}, },
}); });
@ -362,6 +378,8 @@ export const {
setTileSize, setTileSize,
setVariationAmount, setVariationAmount,
setWidth, setWidth,
setHorizontalSymmetryTimePercentage,
setVerticalSymmetryTimePercentage,
} = generationSlice.actions; } = generationSlice.actions;
export default generationSlice.reducer; export default generationSlice.reducer;

View File

@ -0,0 +1,5 @@
import SymmetrySettings from 'features/parameters/components/AdvancedParameters/Output/SymmetrySettings';
export default function UnifiedCanvasOtherSettings() {
return <SymmetrySettings />;
}

View File

@ -15,6 +15,7 @@ import NegativePromptInput from 'features/parameters/components/PromptInput/Nega
import PromptInput from 'features/parameters/components/PromptInput/PromptInput'; import PromptInput from 'features/parameters/components/PromptInput/PromptInput';
import InvokeOptionsPanel from 'features/ui/components/InvokeParametersPanel'; import InvokeOptionsPanel from 'features/ui/components/InvokeParametersPanel';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import UnifiedCanvasOtherSettings from './UnifiedCanvasOtherSettings';
export default function UnifiedCanvasPanel() { export default function UnifiedCanvasPanel() {
const { t } = useTranslation(); const { t } = useTranslation();
@ -46,6 +47,10 @@ export default function UnifiedCanvasPanel() {
content: <VariationsSettings />, content: <VariationsSettings />,
additionalHeaderComponents: <GenerateVariationsToggle />, additionalHeaderComponents: <GenerateVariationsToggle />,
}, },
output: {
header: `${t('parameters.otherOptions')}`,
content: <UnifiedCanvasOtherSettings />,
},
}; };
const unifiedCanvasImg2ImgAccordion = { const unifiedCanvasImg2ImgAccordion = {

File diff suppressed because one or more lines are too long

View File

@ -1391,3 +1391,7 @@ def check_internet() -> bool:
return True return True
except: except:
return False return False
if __name__ == '__main__':
main()

View File

@ -584,7 +584,9 @@ class SlicedSwapCrossAttnProcesser(SlicedAttnProcessor):
# print(f"SwapCrossAttnContext for {attention_type} active") # print(f"SwapCrossAttnContext for {attention_type} active")
batch_size, sequence_length, _ = hidden_states.shape batch_size, sequence_length, _ = hidden_states.shape
attention_mask = attn.prepare_attention_mask(attention_mask, sequence_length) attention_mask = attn.prepare_attention_mask(
attention_mask=attention_mask, target_length=sequence_length,
batch_size=batch_size)
query = attn.to_q(hidden_states) query = attn.to_q(hidden_states)
dim = query.shape[-1] dim = query.shape[-1]

View File

@ -84,7 +84,7 @@ class TextualInversionManager:
return return
elif ( elif (
self.text_encoder.get_input_embeddings().weight.data[0].shape[0] self.text_encoder.get_input_embeddings().weight.data[0].shape[0]
!= embedding_info["embedding"].shape[0] != embedding_info['token_dim']
): ):
print( print(
f"** Notice: {ckpt_path.parents[0].name}/{ckpt_path.name} was trained on a model with a different token dimension. It can't be used with this model." f"** Notice: {ckpt_path.parents[0].name}/{ckpt_path.name} was trained on a model with a different token dimension. It can't be used with this model."