mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Merge branch 'development' of github.com:pbaylies/stable-diffusion into pbaylies-development
This commit is contained in:
commit
0f9bff66bc
@ -799,9 +799,6 @@ class InvokeAIWebServer:
|
|||||||
rfc_dict['init_image_path'] = parameters[
|
rfc_dict['init_image_path'] = parameters[
|
||||||
'init_img'
|
'init_img'
|
||||||
] # TODO: Noncompliant
|
] # TODO: Noncompliant
|
||||||
rfc_dict[
|
|
||||||
'sampler'
|
|
||||||
] = 'ddim' # TODO: FIX ME WHEN IMG2IMG SUPPORTS ALL SAMPLERS
|
|
||||||
if 'init_mask' in parameters:
|
if 'init_mask' in parameters:
|
||||||
rfc_dict['mask_hash'] = calculate_init_img_hash(
|
rfc_dict['mask_hash'] = calculate_init_img_hash(
|
||||||
self.get_image_path_from_url(parameters['init_mask'])
|
self.get_image_path_from_url(parameters['init_mask'])
|
||||||
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
@ -2,24 +2,22 @@
|
|||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
- `python backend/server.py` serves both frontend and backend at http://localhost:9090
|
- `python scripts/dream.py --web` serves both frontend and backend at
|
||||||
|
http://localhost:9090
|
||||||
|
|
||||||
## Evironment
|
## Evironment
|
||||||
|
|
||||||
Install [node](https://nodejs.org/en/download/) (includes npm) and optionally
|
Install [node](https://nodejs.org/en/download/) (includes npm) and optionally
|
||||||
[yarn](https://yarnpkg.com/getting-started/install).
|
[yarn](https://yarnpkg.com/getting-started/install).
|
||||||
|
|
||||||
From `frontend/` run `npm install` / `yarn install` to install the frontend packages.
|
From `frontend/` run `npm install` / `yarn install` to install the frontend
|
||||||
|
packages.
|
||||||
|
|
||||||
## Dev
|
## Dev
|
||||||
|
|
||||||
1. From `frontend/`, run `npm dev` / `yarn dev` to start the dev server.
|
1. From `frontend/`, run `npm dev` / `yarn dev` to start the dev server.
|
||||||
2. Note the address it starts up on (probably `http://localhost:5173/`).
|
2. Run `python scripts/dream.py --web`.
|
||||||
3. Edit `backend/server.py`'s `additional_allowed_origins` to include this address, e.g.
|
3. Navigate to the dev server address e.g. `http://localhost:5173/`.
|
||||||
`additional_allowed_origins = ['http://localhost:5173']`.
|
|
||||||
4. Leaving the dev server running, open a new terminal and go to the project root.
|
|
||||||
5. Run `python backend/server.py`.
|
|
||||||
6. Navigate to the dev server address e.g. `http://localhost:5173/`.
|
|
||||||
|
|
||||||
To build for dev: `npm build-dev` / `yarn build-dev`
|
To build for dev: `npm build-dev` / `yarn build-dev`
|
||||||
|
|
||||||
@ -28,10 +26,3 @@ To build for production: `npm build` / `yarn build`
|
|||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- Search repo for "TODO"
|
- Search repo for "TODO"
|
||||||
- My one gripe with Chakra: no way to disable all animations right now and drop the dependence on
|
|
||||||
`framer-motion`. I would prefer to save the ~30kb on bundle and have zero animations. This is on
|
|
||||||
the Chakra roadmap. See https://github.com/chakra-ui/chakra-ui/pull/6368 for last discussion on
|
|
||||||
this. Need to check in on this issue periodically.
|
|
||||||
- Mobile friendly layout
|
|
||||||
- Proper image gallery/viewer/manager
|
|
||||||
- Help tooltips and such
|
|
||||||
|
File diff suppressed because one or more lines are too long
2
frontend/dist/index.html
vendored
2
frontend/dist/index.html
vendored
@ -6,7 +6,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.045a5291.js"></script>
|
<script type="module" crossorigin src="/assets/index.d9916e7a.js"></script>
|
||||||
<link rel="stylesheet" href="/assets/index.853a336f.css">
|
<link rel="stylesheet" href="/assets/index.853a336f.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
@ -7,8 +7,6 @@ export const SAMPLERS: Array<string> = [
|
|||||||
'k_lms',
|
'k_lms',
|
||||||
'k_dpm_2',
|
'k_dpm_2',
|
||||||
'k_dpm_2_a',
|
'k_dpm_2_a',
|
||||||
'k_dpm_fast',
|
|
||||||
'k_dpm_adaptive',
|
|
||||||
'k_euler',
|
'k_euler',
|
||||||
'k_euler_a',
|
'k_euler_a',
|
||||||
'k_heun',
|
'k_heun',
|
||||||
|
@ -189,7 +189,6 @@ class Args(object):
|
|||||||
switches.append(f'--perlin {a["perlin"]}')
|
switches.append(f'--perlin {a["perlin"]}')
|
||||||
if a['threshold'] > 0:
|
if a['threshold'] > 0:
|
||||||
switches.append(f'--threshold {a["threshold"]}')
|
switches.append(f'--threshold {a["threshold"]}')
|
||||||
|
|
||||||
if a['grid']:
|
if a['grid']:
|
||||||
switches.append('--grid')
|
switches.append('--grid')
|
||||||
if a['seamless']:
|
if a['seamless']:
|
||||||
|
@ -32,7 +32,7 @@ class Txt2Img(Generator):
|
|||||||
if self.free_gpu_mem and self.model.model.device != self.model.device:
|
if self.free_gpu_mem and self.model.model.device != self.model.device:
|
||||||
self.model.model.to(self.model.device)
|
self.model.model.to(self.model.device)
|
||||||
|
|
||||||
sampler.make_schedule(ddim_num_steps=steps, ddim_eta=ddim_eta, verbose=True)
|
sampler.make_schedule(ddim_num_steps=steps, ddim_eta=ddim_eta, verbose=False)
|
||||||
|
|
||||||
samples, _ = sampler.sample(
|
samples, _ = sampler.sample(
|
||||||
batch_size = 1,
|
batch_size = 1,
|
||||||
|
@ -79,17 +79,9 @@ class KSampler(Sampler):
|
|||||||
ddim_eta=0.0,
|
ddim_eta=0.0,
|
||||||
verbose=False,
|
verbose=False,
|
||||||
)
|
)
|
||||||
self.model = outer_model
|
self.model = outer_model
|
||||||
self.ddim_num_steps = ddim_num_steps
|
self.ddim_num_steps = ddim_num_steps
|
||||||
sigmas = K.sampling.get_sigmas_karras(
|
sigmas = self.model.get_sigmas(ddim_num_steps)
|
||||||
n=ddim_num_steps,
|
|
||||||
sigma_min=self.model.sigmas[0].item(),
|
|
||||||
sigma_max=self.model.sigmas[-1].item(),
|
|
||||||
rho=7.,
|
|
||||||
device=self.device,
|
|
||||||
# Birch-san recommends this, but it doesn't match the call signature in his branch of k-diffusion
|
|
||||||
# concat_zero=False
|
|
||||||
)
|
|
||||||
self.sigmas = sigmas
|
self.sigmas = sigmas
|
||||||
|
|
||||||
# ALERT: We are completely overriding the sample() method in the base class, which
|
# ALERT: We are completely overriding the sample() method in the base class, which
|
||||||
@ -133,7 +125,8 @@ class KSampler(Sampler):
|
|||||||
|
|
||||||
# sigmas = self.model.get_sigmas(S)
|
# sigmas = self.model.get_sigmas(S)
|
||||||
# sigmas are now set up in make_schedule - we take the last steps items
|
# sigmas are now set up in make_schedule - we take the last steps items
|
||||||
sigmas = self.sigmas[-S:]
|
sigmas = self.sigmas[-S-1:]
|
||||||
|
|
||||||
if x_T is not None:
|
if x_T is not None:
|
||||||
x = x_T * sigmas[0]
|
x = x_T * sigmas[0]
|
||||||
else:
|
else:
|
||||||
@ -147,7 +140,7 @@ class KSampler(Sampler):
|
|||||||
'uncond': unconditional_conditioning,
|
'uncond': unconditional_conditioning,
|
||||||
'cond_scale': unconditional_guidance_scale,
|
'cond_scale': unconditional_guidance_scale,
|
||||||
}
|
}
|
||||||
print(f'>> Sampling with k__{self.schedule}')
|
print(f'>> Sampling with k_{self.schedule}')
|
||||||
return (
|
return (
|
||||||
K.sampling.__dict__[f'sample_{self.schedule}'](
|
K.sampling.__dict__[f'sample_{self.schedule}'](
|
||||||
model_wrap_cfg, x, sigmas, extra_args=extra_args,
|
model_wrap_cfg, x, sigmas, extra_args=extra_args,
|
||||||
|
@ -218,7 +218,7 @@ def rand_perlin_2d(shape, res, fade = lambda t: 6*t**5 - 15*t**4 + 10*t**3):
|
|||||||
delta = (res[0] / shape[0], res[1] / shape[1])
|
delta = (res[0] / shape[0], res[1] / shape[1])
|
||||||
d = (shape[0] // res[0], shape[1] // res[1])
|
d = (shape[0] // res[0], shape[1] // res[1])
|
||||||
|
|
||||||
grid = torch.stack(torch.meshgrid(torch.arange(0, res[0], delta[0]), torch.arange(0, res[1], delta[1])), dim = -1) % 1
|
grid = torch.stack(torch.meshgrid(torch.arange(0, res[0], delta[0]), torch.arange(0, res[1], delta[1]), indexing='ij'), dim = -1) % 1
|
||||||
angles = 2*math.pi*torch.rand(res[0]+1, res[1]+1)
|
angles = 2*math.pi*torch.rand(res[0]+1, res[1]+1)
|
||||||
gradients = torch.stack((torch.cos(angles), torch.sin(angles)), dim = -1)
|
gradients = torch.stack((torch.cos(angles), torch.sin(angles)), dim = -1)
|
||||||
|
|
||||||
@ -230,4 +230,4 @@ def rand_perlin_2d(shape, res, fade = lambda t: 6*t**5 - 15*t**4 + 10*t**3):
|
|||||||
n01 = dot(tile_grads([0, -1],[1, None]), [0, -1])
|
n01 = dot(tile_grads([0, -1],[1, None]), [0, -1])
|
||||||
n11 = dot(tile_grads([1, None], [1, None]), [-1,-1])
|
n11 = dot(tile_grads([1, None], [1, None]), [-1,-1])
|
||||||
t = fade(grid[:shape[0], :shape[1]])
|
t = fade(grid[:shape[0], :shape[1]])
|
||||||
return math.sqrt(2) * torch.lerp(torch.lerp(n00, n10, t[..., 0]), torch.lerp(n01, n11, t[..., 0]), t[..., 1])
|
return math.sqrt(2) * torch.lerp(torch.lerp(n00, n10, t[..., 0]), torch.lerp(n01, n11, t[..., 0]), t[..., 1])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user