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

61
.github/CODEOWNERS vendored
View File

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

View File

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

View File

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

View File

@ -65,6 +65,8 @@ export type BackendGenerationParameters = {
with_variations?: Array<Array<number>>;
variation_amount?: number;
enable_image_debugging?: boolean;
h_symmetry_time_pct: number;
v_symmetry_time_pct: number;
};
export type BackendEsrGanParameters = {
@ -141,6 +143,8 @@ export const frontendToBackendParameters = (
tileSize,
variationAmount,
width,
horizontalSymmetryTimePercentage,
verticalSymmetryTimePercentage,
} = generationState;
const {
@ -165,13 +169,22 @@ export const frontendToBackendParameters = (
save_intermediates: saveIntermediatesInterval,
generation_mode: generationMode,
init_mask: '',
h_symmetry_time_pct: horizontalSymmetryTimePercentage,
v_symmetry_time_pct: verticalSymmetryTimePercentage,
};
let esrganParameters: false | BackendEsrGanParameters = 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.threshold = threshold * 1000;
generationParameters.h_symmetry_time_pct = Math.max(
0,
Math.min(1, horizontalSymmetryTimePercentage / steps)
);
generationParameters.v_symmetry_time_pct = Math.max(
0,
Math.min(1, verticalSymmetryTimePercentage / steps)
);
if (negativePrompt !== '') {
generationParameters.prompt = `${prompt} [${negativePrompt}]`;

View File

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

View File

@ -1,12 +1,14 @@
import { Flex } from '@chakra-ui/react';
import HiresSettings from './HiresSettings';
import SeamlessSettings from './SeamlessSettings';
import SymmetrySettings from './SymmetrySettings';
const OutputSettings = () => {
return (
<Flex gap={2} direction="column">
<SeamlessSettings />
<HiresSettings />
<SymmetrySettings />
</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
label={t('parameters.noiseThreshold')}
min={0}
max={1}
step={0.005}
max={20}
step={0.1}
onChange={(v) => dispatch(setThreshold(v))}
handleReset={() => dispatch(setThreshold(0))}
value={threshold}

View File

@ -32,6 +32,8 @@ export interface GenerationState {
tileSize: number;
variationAmount: number;
width: number;
horizontalSymmetryTimePercentage: number;
verticalSymmetryTimePercentage: number;
}
const initialGenerationState: GenerationState = {
@ -60,6 +62,8 @@ const initialGenerationState: GenerationState = {
tileSize: 32,
variationAmount: 0.1,
width: 512,
horizontalSymmetryTimePercentage: 0,
verticalSymmetryTimePercentage: 0,
};
const initialState: GenerationState = initialGenerationState;
@ -325,6 +329,18 @@ export const generationSlice = createSlice({
setInfillMethod: (state, action: PayloadAction<string>) => {
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,
setVariationAmount,
setWidth,
setHorizontalSymmetryTimePercentage,
setVerticalSymmetryTimePercentage,
} = generationSlice.actions;
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 InvokeOptionsPanel from 'features/ui/components/InvokeParametersPanel';
import { useTranslation } from 'react-i18next';
import UnifiedCanvasOtherSettings from './UnifiedCanvasOtherSettings';
export default function UnifiedCanvasPanel() {
const { t } = useTranslation();
@ -46,6 +47,10 @@ export default function UnifiedCanvasPanel() {
content: <VariationsSettings />,
additionalHeaderComponents: <GenerateVariationsToggle />,
},
output: {
header: `${t('parameters.otherOptions')}`,
content: <UnifiedCanvasOtherSettings />,
},
};
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
except:
return False
if __name__ == '__main__':
main()

View File

@ -584,7 +584,9 @@ class SlicedSwapCrossAttnProcesser(SlicedAttnProcessor):
# print(f"SwapCrossAttnContext for {attention_type} active")
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)
dim = query.shape[-1]

View File

@ -84,7 +84,7 @@ class TextualInversionManager:
return
elif (
self.text_encoder.get_input_embeddings().weight.data[0].shape[0]
!= embedding_info["embedding"].shape[0]
!= embedding_info['token_dim']
):
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."