Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add k_dpmpp_2_a and k_dpmpp_2 solvers options #1383

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions backend/modules/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"ddim",
"k_dpm_2_a",
"k_dpm_2",
"k_dpmpp_2_a",
"k_dpmpp_2",
"k_euler_a",
"k_euler",
"k_heun",
Expand Down
2 changes: 1 addition & 1 deletion frontend/dist/assets/index.1fc0290b.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/dist/assets/index.4488003f.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/dist/assets/index.ae92a637.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/dist/assets/index.cc049b93.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/dist/assets/index.e2832fd4.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions frontend/src/app/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export const SAMPLERS: Array<string> = [
'k_lms',
'k_dpm_2',
'k_dpm_2_a',
'k_dpmpp_2',
'k_dpmpp_2_a',
'k_euler',
'k_euler_a',
'k_heun',
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/app/invokeai.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export declare type CommonGeneratedImageMetadata = {
| 'ddim'
| 'k_dpm_2_a'
| 'k_dpm_2'
| 'k_dpmpp_2_a'
| 'k_dpmpp_2'
| 'k_euler_a'
| 'k_euler'
| 'k_heun'
Expand Down
6 changes: 5 additions & 1 deletion ldm/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def new_func(*args, **kw):
safety_checker:bool = activate safety checker [False]

# this value is sticky and maintained between generation calls
sampler_name:str = ['ddim', 'k_dpm_2_a', 'k_dpm_2', 'k_euler_a', 'k_euler', 'k_heun', 'k_lms', 'plms'] // k_lms
sampler_name:str = ['ddim', 'k_dpm_2_a', 'k_dpm_2', 'k_dpmpp_2', 'k_dpmpp_2_a', 'k_euler_a', 'k_euler', 'k_heun', 'k_lms', 'plms'] // k_lms

# these are deprecated - use conf and model instead
weights = path to model weights ('models/ldm/stable-diffusion-v1/model.ckpt')
Expand Down Expand Up @@ -928,6 +928,10 @@ def _set_sampler(self):
self.sampler = KSampler(self.model, 'dpm_2_ancestral', device=self.device)
elif self.sampler_name == 'k_dpm_2':
self.sampler = KSampler(self.model, 'dpm_2', device=self.device)
elif self.sampler_name == 'k_dpmpp_2_a':
self.sampler = KSampler(self.model, 'dpmpp_2s_ancestral', device=self.device)
elif self.sampler_name == 'k_dpmpp_2':
self.sampler = KSampler(self.model, 'dpmpp_2m', device=self.device)
elif self.sampler_name == 'k_euler_a':
self.sampler = KSampler(self.model, 'euler_ancestral', device=self.device)
elif self.sampler_name == 'k_euler':
Expand Down
2 changes: 2 additions & 0 deletions ldm/invoke/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@
'ddim',
'k_dpm_2_a',
'k_dpm_2',
'k_dpmpp_2_a',
'k_dpmpp_2',
'k_euler_a',
'k_euler',
'k_heun',
Expand Down
2 changes: 1 addition & 1 deletion ldm/models/diffusion/ddpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,7 @@ def p_losses(self, x_start, cond, t, noise=None):
)
loss_dict.update({f'{prefix}/loss_simple': loss_simple.mean()})

logvar_t = self.logvar[t].to(self.device)
logvar_t = self.logvar[t.item()].to(self.device)
loss = loss_simple / torch.exp(logvar_t) + logvar_t
# loss = loss_simple / torch.exp(self.logvar) + self.logvar
if self.learn_logvar:
Expand Down
2 changes: 2 additions & 0 deletions scripts/legacy_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ def write_log_message(results, log_path):
'ddim',
'k_dpm_2_a',
'k_dpm_2',
'k_dpmpp_2_a',
'k_dpmpp_2',
'k_euler_a',
'k_euler',
'k_heun',
Expand Down
2 changes: 2 additions & 0 deletions static/dream_web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ <h1>Stable Diffusion Dream Server</h1>
<option value="k_lms" selected>KLMS</option>
<option value="k_dpm_2">KDPM_2</option>
<option value="k_dpm_2_a">KDPM_2A</option>
<option value="k_dpmpp_2">KDPMPP_2</option>
<option value="k_dpmpp_2_a">KDPMPP_2A</option>
<option value="k_euler">KEULER</option>
<option value="k_euler_a">KEULER_A</option>
<option value="k_heun">KHEUN</option>
Expand Down
2 changes: 2 additions & 0 deletions static/legacy_web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ <h1>Stable Diffusion Dream Server</h1>
<option value="k_lms" selected>KLMS</option>
<option value="k_dpm_2">KDPM_2</option>
<option value="k_dpm_2_a">KDPM_2A</option>
<option value="k_dpmpp_2">KDPMPP_2</option>
<option value="k_dpmpp_2_a">KDPMPP_2A</option>
<option value="k_euler">KEULER</option>
<option value="k_euler_a">KEULER_A</option>
<option value="k_heun">KHEUN</option>
Expand Down