Merge branch 'main' into feat/batch-graphs

This commit is contained in:
Brandon 2023-09-06 11:03:54 -04:00 committed by GitHub
commit ed7deee8f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 70 additions and 23 deletions

View File

@ -507,7 +507,7 @@ Use cursor arrows to make a checkbox selection, and space to toggle.
scroll_exit=True, scroll_exit=True,
) )
else: else:
self.vram_cache_size = DummyWidgetValue.zero self.vram = DummyWidgetValue.zero
self.nextrely += 1 self.nextrely += 1
self.outdir = self.add_widget_intelligent( self.outdir = self.add_widget_intelligent(
FileBox, FileBox,
@ -605,6 +605,7 @@ https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/LICENS
"vram", "vram",
"outdir", "outdir",
]: ]:
if hasattr(self, attr):
setattr(new_opts, attr, getattr(self, attr).value) setattr(new_opts, attr, getattr(self, attr).value)
for attr in self.autoimport_dirs: for attr in self.autoimport_dirs:

View File

@ -54,13 +54,15 @@ def welcome(versions: dict):
def text(): def text():
yield f"InvokeAI Version: [bold yellow]{__version__}" yield f"InvokeAI Version: [bold yellow]{__version__}"
yield "" yield ""
yield "This script will update InvokeAI to the latest release, or to a development version of your choice." yield "This script will update InvokeAI to the latest release, or to the development version of your choice."
yield ""
yield "When updating to an arbitrary tag or branch, be aware that the front end may be mismatched to the backend,"
yield "making the web frontend unusable. Please downgrade to the latest release if this happens."
yield "" yield ""
yield "[bold yellow]Options:" yield "[bold yellow]Options:"
yield f"""[1] Update to the latest official release ([italic]{versions[0]['tag_name']}[/italic]) yield f"""[1] Update to the latest official release ([italic]{versions[0]['tag_name']}[/italic])
[2] Update to the bleeding-edge development version ([italic]main[/italic]) [2] Manually enter the [bold]tag name[/bold] for the version you wish to update to
[3] Manually enter the [bold]tag name[/bold] for the version you wish to update to [3] Manually enter the [bold]branch name[/bold] for the version you wish to update to"""
[4] Manually enter the [bold]branch name[/bold] for the version you wish to update to"""
console.rule() console.rule()
print( print(
@ -104,10 +106,10 @@ def main():
if choice == "1": if choice == "1":
release = versions[0]["tag_name"] release = versions[0]["tag_name"]
elif choice == "2": elif choice == "2":
release = "main" while not tag:
elif choice == "3":
tag = Prompt.ask("Enter an InvokeAI tag name") tag = Prompt.ask("Enter an InvokeAI tag name")
elif choice == "4": elif choice == "3":
while not branch:
branch = Prompt.ask("Enter an InvokeAI branch name") branch = Prompt.ask("Enter an InvokeAI branch name")
extras = get_extras() extras = get_extras()

View File

@ -235,10 +235,18 @@ export const canvasSlice = createSlice({
state.boundingBoxDimensions.width, state.boundingBoxDimensions.width,
state.boundingBoxDimensions.height, state.boundingBoxDimensions.height,
]; ];
const [currScaledWidth, currScaledHeight] = [
state.scaledBoundingBoxDimensions.width,
state.scaledBoundingBoxDimensions.height,
];
state.boundingBoxDimensions = { state.boundingBoxDimensions = {
width: currHeight, width: currHeight,
height: currWidth, height: currWidth,
}; };
state.scaledBoundingBoxDimensions = {
width: currScaledHeight,
height: currScaledWidth,
};
}, },
setBoundingBoxCoordinates: (state, action: PayloadAction<Vector2d>) => { setBoundingBoxCoordinates: (state, action: PayloadAction<Vector2d>) => {
state.boundingBoxCoordinates = floorCoordinates(action.payload); state.boundingBoxCoordinates = floorCoordinates(action.payload);
@ -788,6 +796,10 @@ export const canvasSlice = createSlice({
state.boundingBoxDimensions.width / ratio, state.boundingBoxDimensions.width / ratio,
64 64
); );
state.scaledBoundingBoxDimensions.height = roundToMultiple(
state.scaledBoundingBoxDimensions.width / ratio,
64
);
} }
}); });
}, },

View File

@ -73,7 +73,7 @@ export const parseSchema = (
const title = schema.title.replace('Invocation', ''); const title = schema.title.replace('Invocation', '');
const tags = schema.tags ?? []; const tags = schema.tags ?? [];
const description = schema.description ?? ''; const description = schema.description ?? '';
const version = schema.version ?? ''; const version = schema.version;
const inputs = reduce( const inputs = reduce(
schema.properties, schema.properties,

View File

@ -2,6 +2,7 @@ import { createSelector } from '@reduxjs/toolkit';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions'; import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
import IAISlider from 'common/components/IAISlider'; import IAISlider from 'common/components/IAISlider';
import { roundToMultiple } from 'common/util/roundDownToMultiple';
import { canvasSelector } from 'features/canvas/store/canvasSelectors'; import { canvasSelector } from 'features/canvas/store/canvasSelectors';
import { setScaledBoundingBoxDimensions } from 'features/canvas/store/canvasSlice'; import { setScaledBoundingBoxDimensions } from 'features/canvas/store/canvasSlice';
import { generationSelector } from 'features/parameters/store/generationSelectors'; import { generationSelector } from 'features/parameters/store/generationSelectors';
@ -12,12 +13,13 @@ const selector = createSelector(
[generationSelector, canvasSelector], [generationSelector, canvasSelector],
(generation, canvas) => { (generation, canvas) => {
const { scaledBoundingBoxDimensions, boundingBoxScaleMethod } = canvas; const { scaledBoundingBoxDimensions, boundingBoxScaleMethod } = canvas;
const { model } = generation; const { model, aspectRatio } = generation;
return { return {
model, model,
scaledBoundingBoxDimensions, scaledBoundingBoxDimensions,
isManual: boundingBoxScaleMethod === 'manual', isManual: boundingBoxScaleMethod === 'manual',
aspectRatio,
}; };
}, },
defaultSelectorOptions defaultSelectorOptions
@ -25,7 +27,7 @@ const selector = createSelector(
const ParamScaledHeight = () => { const ParamScaledHeight = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const { model, isManual, scaledBoundingBoxDimensions } = const { model, isManual, scaledBoundingBoxDimensions, aspectRatio } =
useAppSelector(selector); useAppSelector(selector);
const initial = ['sdxl', 'sdxl-refiner'].includes(model?.base_model as string) const initial = ['sdxl', 'sdxl-refiner'].includes(model?.base_model as string)
@ -35,19 +37,33 @@ const ParamScaledHeight = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const handleChangeScaledHeight = (v: number) => { const handleChangeScaledHeight = (v: number) => {
let newWidth = scaledBoundingBoxDimensions.width;
const newHeight = Math.floor(v);
if (aspectRatio) {
newWidth = roundToMultiple(newHeight * aspectRatio, 64);
}
dispatch( dispatch(
setScaledBoundingBoxDimensions({ setScaledBoundingBoxDimensions({
...scaledBoundingBoxDimensions, width: newWidth,
height: Math.floor(v), height: newHeight,
}) })
); );
}; };
const handleResetScaledHeight = () => { const handleResetScaledHeight = () => {
let resetWidth = scaledBoundingBoxDimensions.width;
const resetHeight = Math.floor(initial);
if (aspectRatio) {
resetWidth = roundToMultiple(resetHeight * aspectRatio, 64);
}
dispatch( dispatch(
setScaledBoundingBoxDimensions({ setScaledBoundingBoxDimensions({
...scaledBoundingBoxDimensions, width: resetWidth,
height: Math.floor(initial), height: resetHeight,
}) })
); );
}; };

View File

@ -2,6 +2,7 @@ import { createSelector } from '@reduxjs/toolkit';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions'; import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
import IAISlider from 'common/components/IAISlider'; import IAISlider from 'common/components/IAISlider';
import { roundToMultiple } from 'common/util/roundDownToMultiple';
import { canvasSelector } from 'features/canvas/store/canvasSelectors'; import { canvasSelector } from 'features/canvas/store/canvasSelectors';
import { setScaledBoundingBoxDimensions } from 'features/canvas/store/canvasSlice'; import { setScaledBoundingBoxDimensions } from 'features/canvas/store/canvasSlice';
import { generationSelector } from 'features/parameters/store/generationSelectors'; import { generationSelector } from 'features/parameters/store/generationSelectors';
@ -12,11 +13,12 @@ const selector = createSelector(
[canvasSelector, generationSelector], [canvasSelector, generationSelector],
(canvas, generation) => { (canvas, generation) => {
const { boundingBoxScaleMethod, scaledBoundingBoxDimensions } = canvas; const { boundingBoxScaleMethod, scaledBoundingBoxDimensions } = canvas;
const { model } = generation; const { model, aspectRatio } = generation;
return { return {
model, model,
scaledBoundingBoxDimensions, scaledBoundingBoxDimensions,
aspectRatio,
isManual: boundingBoxScaleMethod === 'manual', isManual: boundingBoxScaleMethod === 'manual',
}; };
}, },
@ -25,7 +27,7 @@ const selector = createSelector(
const ParamScaledWidth = () => { const ParamScaledWidth = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const { model, isManual, scaledBoundingBoxDimensions } = const { model, isManual, scaledBoundingBoxDimensions, aspectRatio } =
useAppSelector(selector); useAppSelector(selector);
const initial = ['sdxl', 'sdxl-refiner'].includes(model?.base_model as string) const initial = ['sdxl', 'sdxl-refiner'].includes(model?.base_model as string)
@ -35,19 +37,33 @@ const ParamScaledWidth = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const handleChangeScaledWidth = (v: number) => { const handleChangeScaledWidth = (v: number) => {
const newWidth = Math.floor(v);
let newHeight = scaledBoundingBoxDimensions.height;
if (aspectRatio) {
newHeight = roundToMultiple(newWidth / aspectRatio, 64);
}
dispatch( dispatch(
setScaledBoundingBoxDimensions({ setScaledBoundingBoxDimensions({
...scaledBoundingBoxDimensions, width: newWidth,
width: Math.floor(v), height: newHeight,
}) })
); );
}; };
const handleResetScaledWidth = () => { const handleResetScaledWidth = () => {
const resetWidth = Math.floor(initial);
let resetHeight = scaledBoundingBoxDimensions.height;
if (aspectRatio) {
resetHeight = roundToMultiple(resetWidth / aspectRatio, 64);
}
dispatch( dispatch(
setScaledBoundingBoxDimensions({ setScaledBoundingBoxDimensions({
...scaledBoundingBoxDimensions, width: resetWidth,
width: Math.floor(initial), height: resetHeight,
}) })
); );
}; };