Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
f55a7e04
Commit
f55a7e04
authored
Feb 15, 2023
by
RcINS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error when batch count > 1
parent
9e27af76
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
modules/sd_samplers_kdiffusion.py
modules/sd_samplers_kdiffusion.py
+5
-4
No files found.
modules/sd_samplers_kdiffusion.py
View file @
f55a7e04
...
...
@@ -269,14 +269,15 @@ class KDiffusionSampler:
return
sigmas
def
create_noise_sampler
(
self
,
x
,
sigmas
,
seeds
):
def
create_noise_sampler
(
self
,
x
,
sigmas
,
p
):
"""For DPM++ SDE: manually create noise sampler to enable deterministic results across different batch sizes"""
if
shared
.
opts
.
no_dpmpp_sde_batch_determinism
:
return
None
from
k_diffusion.sampling
import
BrownianTreeNoiseSampler
sigma_min
,
sigma_max
=
sigmas
[
sigmas
>
0
]
.
min
(),
sigmas
.
max
()
return
BrownianTreeNoiseSampler
(
x
,
sigma_min
,
sigma_max
,
seed
=
seeds
)
current_iter_seeds
=
p
.
all_seeds
[
p
.
iteration
*
p
.
batch_size
:(
p
.
iteration
+
1
)
*
p
.
batch_size
]
return
BrownianTreeNoiseSampler
(
x
,
sigma_min
,
sigma_max
,
seed
=
current_iter_seeds
)
def
sample_img2img
(
self
,
p
,
x
,
noise
,
conditioning
,
unconditional_conditioning
,
steps
=
None
,
image_conditioning
=
None
):
steps
,
t_enc
=
sd_samplers_common
.
setup_img2img_steps
(
p
,
steps
)
...
...
@@ -302,7 +303,7 @@ class KDiffusionSampler:
extra_params_kwargs
[
'sigmas'
]
=
sigma_sched
if
self
.
funcname
==
'sample_dpmpp_sde'
:
noise_sampler
=
self
.
create_noise_sampler
(
x
,
sigmas
,
p
.
all_seeds
)
noise_sampler
=
self
.
create_noise_sampler
(
x
,
sigmas
,
p
)
extra_params_kwargs
[
'noise_sampler'
]
=
noise_sampler
self
.
model_wrap_cfg
.
init_latent
=
x
...
...
@@ -337,7 +338,7 @@ class KDiffusionSampler:
extra_params_kwargs
[
'sigmas'
]
=
sigmas
if
self
.
funcname
==
'sample_dpmpp_sde'
:
noise_sampler
=
self
.
create_noise_sampler
(
x
,
sigmas
,
p
.
all_seeds
)
noise_sampler
=
self
.
create_noise_sampler
(
x
,
sigmas
,
p
)
extra_params_kwargs
[
'noise_sampler'
]
=
noise_sampler
self
.
last_latent
=
x
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment