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
be0f82df
Commit
be0f82df
authored
Sep 16, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
2288bc96
a441cd56
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
scripts/img2imgalt.py
scripts/img2imgalt.py
+18
-8
No files found.
scripts/img2imgalt.py
View file @
be0f82df
...
...
@@ -76,10 +76,10 @@ class Script(scripts.Script):
original_prompt
=
gr
.
Textbox
(
label
=
"Original prompt"
,
lines
=
1
)
cfg
=
gr
.
Slider
(
label
=
"Decode CFG scale"
,
minimum
=
0.0
,
maximum
=
15.0
,
step
=
0.1
,
value
=
1.0
)
st
=
gr
.
Slider
(
label
=
"Decode steps"
,
minimum
=
1
,
maximum
=
150
,
step
=
1
,
value
=
50
)
randomness
=
gr
.
Slider
(
label
=
"randomness"
,
minimum
=
0.0
,
maximum
=
1.0
,
step
=
0.01
,
value
=
0.0
)
return
[
original_prompt
,
cfg
,
st
,
randomness
]
return
[
original_prompt
,
cfg
,
st
]
def
run
(
self
,
p
,
original_prompt
,
cfg
,
st
):
def
run
(
self
,
p
,
original_prompt
,
cfg
,
st
,
randomness
):
p
.
batch_size
=
1
p
.
batch_count
=
1
...
...
@@ -90,18 +90,28 @@ class Script(scripts.Script):
same_everything
=
same_params
and
self
.
cache
.
latent
.
shape
==
lat
.
shape
and
np
.
abs
(
self
.
cache
.
latent
-
lat
)
.
sum
()
<
100
if
same_everything
:
noise
=
self
.
cache
.
noise
rec_
noise
=
self
.
cache
.
noise
else
:
shared
.
state
.
job_count
+=
1
cond
=
p
.
sd_model
.
get_learned_conditioning
(
p
.
batch_size
*
[
original_prompt
])
uncond
=
p
.
sd_model
.
get_learned_conditioning
(
p
.
batch_size
*
[
""
])
noise
=
find_noise_for_image
(
p
,
cond
,
uncond
,
cfg
,
st
)
self
.
cache
=
Cached
(
noise
,
cfg
,
st
,
lat
,
original_prompt
)
rec_
noise
=
find_noise_for_image
(
p
,
cond
,
uncond
,
cfg
,
st
)
self
.
cache
=
Cached
(
rec_
noise
,
cfg
,
st
,
lat
,
original_prompt
)
rand_noise
=
processing
.
create_random_tensors
(
p
.
init_latent
.
shape
[
1
:],
[
p
.
seed
+
x
+
1
for
x
in
range
(
p
.
init_latent
.
shape
[
0
])])
combined_noise
=
((
1
-
randomness
)
*
rec_noise
+
randomness
*
rand_noise
)
/
((
randomness
**
2
+
(
1
-
randomness
)
**
2
)
**
0.5
)
sampler
=
samplers
[
p
.
sampler_index
]
.
constructor
(
p
.
sd_model
)
samples_ddim
=
sampler
.
sample
(
p
,
noise
,
conditioning
,
unconditional_conditioning
)
return
samples_ddim
sigmas
=
sampler
.
model_wrap
.
get_sigmas
(
p
.
steps
)
noise_dt
=
combined_noise
-
(
p
.
init_latent
/
sigmas
[
0
]
)
p
.
seed
=
p
.
seed
+
1
return
sampler
.
sample_img2img
(
p
,
p
.
init_latent
,
noise_dt
,
conditioning
,
unconditional_conditioning
)
p
.
sample
=
sample_extra
...
...
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