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
365d4b16
Commit
365d4b16
authored
Oct 20, 2022
by
discus0434
Committed by
GitHub
Oct 20, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'AUTOMATIC1111:master' into master
parents
3770b8d2
f510a227
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
23 deletions
+49
-23
modules/prompt_parser.py
modules/prompt_parser.py
+1
-1
modules/sd_hijack_optimizations.py
modules/sd_hijack_optimizations.py
+1
-1
modules/sd_models.py
modules/sd_models.py
+4
-1
modules/ui.py
modules/ui.py
+39
-15
style.css
style.css
+4
-5
No files found.
modules/prompt_parser.py
View file @
365d4b16
...
...
@@ -275,7 +275,7 @@ re_attention = re.compile(r"""
def
parse_prompt_attention
(
text
):
"""
Parses a string with attention tokens and returns a list of pairs: text and its asso
ic
ated weight.
Parses a string with attention tokens and returns a list of pairs: text and its asso
ci
ated weight.
Accepted tokens are:
(abc) - increases attention to abc by a multiplier of 1.1
(abc:3.12) - increases attention to abc by a multiplier of 3.12
...
...
modules/sd_hijack_optimizations.py
View file @
365d4b16
...
...
@@ -181,7 +181,7 @@ def einsum_op_cuda(q, k, v):
mem_free_torch
=
mem_reserved
-
mem_active
mem_free_total
=
mem_free_cuda
+
mem_free_torch
# Divide factor of safety as there's copying and fragmentation
return
self
.
einsum_op_tensor_mem
(
q
,
k
,
v
,
mem_free_total
/
3.3
/
(
1
<<
20
))
return
einsum_op_tensor_mem
(
q
,
k
,
v
,
mem_free_total
/
3.3
/
(
1
<<
20
))
def
einsum_op
(
q
,
k
,
v
):
if
q
.
device
.
type
==
'cuda'
:
...
...
modules/sd_models.py
View file @
365d4b16
...
...
@@ -148,7 +148,10 @@ def get_state_dict_from_checkpoint(pl_sd):
if
new_key
is
not
None
:
sd
[
new_key
]
=
v
return
sd
pl_sd
.
clear
()
pl_sd
.
update
(
sd
)
return
pl_sd
def
load_model_weights
(
model
,
checkpoint_info
):
...
...
modules/ui.py
View file @
365d4b16
...
...
@@ -12,7 +12,7 @@ import time
import
traceback
import
platform
import
subprocess
as
sp
from
functools
import
reduce
from
functools
import
partial
,
reduce
import
numpy
as
np
import
torch
...
...
@@ -261,6 +261,19 @@ def wrap_gradio_call(func, extra_outputs=None):
return
f
def
calc_time_left
(
progress
,
threshold
,
label
,
force_display
):
if
progress
==
0
:
return
""
else
:
time_since_start
=
time
.
time
()
-
shared
.
state
.
time_start
eta
=
(
time_since_start
/
progress
)
eta_relative
=
eta
-
time_since_start
if
(
eta_relative
>
threshold
and
progress
>
0.02
)
or
force_display
:
return
label
+
time
.
strftime
(
'
%
H:
%
M:
%
S'
,
time
.
gmtime
(
eta_relative
))
else
:
return
""
def
check_progress_call
(
id_part
):
if
shared
.
state
.
job_count
==
0
:
return
""
,
gr_show
(
False
),
gr_show
(
False
),
gr_show
(
False
)
...
...
@@ -272,11 +285,15 @@ def check_progress_call(id_part):
if
shared
.
state
.
sampling_steps
>
0
:
progress
+=
1
/
shared
.
state
.
job_count
*
shared
.
state
.
sampling_step
/
shared
.
state
.
sampling_steps
time_left
=
calc_time_left
(
progress
,
60
,
" ETA:"
,
shared
.
state
.
time_left_force_display
)
if
time_left
!=
""
:
shared
.
state
.
time_left_force_display
=
True
progress
=
min
(
progress
,
1
)
progressbar
=
""
if
opts
.
show_progressbar
:
progressbar
=
f
"""<div class='progressDiv'><div class='progress' style="
width:{progress * 100}
%
">{str(int(progress*100))+"
%
"
if progress > 0.01 else ""}</div></div>"""
progressbar
=
f
"""<div class='progressDiv'><div class='progress' style="
overflow:hidden;width:{progress * 100}
%
">{str(int(progress*100))+"
%
"+time_left
if progress > 0.01 else ""}</div></div>"""
image
=
gr_show
(
False
)
preview_visibility
=
gr_show
(
False
)
...
...
@@ -308,6 +325,8 @@ def check_progress_call_initial(id_part):
shared
.
state
.
current_latent
=
None
shared
.
state
.
current_image
=
None
shared
.
state
.
textinfo
=
None
shared
.
state
.
time_start
=
time
.
time
()
shared
.
state
.
time_left_force_display
=
False
return
check_progress_call
(
id_part
)
...
...
@@ -1543,6 +1562,7 @@ Requested path was: {f}
def
reload_scripts
():
modules
.
scripts
.
reload_script_body_only
()
reload_javascript
()
# need to refresh the html page
reload_script_bodies
.
click
(
fn
=
reload_scripts
,
...
...
@@ -1801,26 +1821,30 @@ Requested path was: {f}
return
demo
with
open
(
os
.
path
.
join
(
script_path
,
"script.js"
),
"r"
,
encoding
=
"utf8"
)
as
jsfile
:
javascript
=
f
'<script>{jsfile.read()}</script>'
def
load_javascript
(
raw_response
):
with
open
(
os
.
path
.
join
(
script_path
,
"script.js"
),
"r"
,
encoding
=
"utf8"
)
as
jsfile
:
javascript
=
f
'<script>{jsfile.read()}</script>'
jsdir
=
os
.
path
.
join
(
script_path
,
"javascript"
)
for
filename
in
sorted
(
os
.
listdir
(
jsdir
)):
with
open
(
os
.
path
.
join
(
jsdir
,
filename
),
"r"
,
encoding
=
"utf8"
)
as
jsfile
:
javascript
+=
f
"
\n
<script>{jsfile.read()}</script>"
jsdir
=
os
.
path
.
join
(
script_path
,
"javascript"
)
for
filename
in
sorted
(
os
.
listdir
(
jsdir
)):
with
open
(
os
.
path
.
join
(
jsdir
,
filename
),
"r"
,
encoding
=
"utf8"
)
as
jsfile
:
javascript
+=
f
"
\n
<!-- {filename} -->
<script>{jsfile.read()}</script>"
if
cmd_opts
.
theme
is
not
None
:
javascript
+=
f
"
\n
<script>set_theme('{cmd_opts.theme}');</script>
\n
"
if
cmd_opts
.
theme
is
not
None
:
javascript
+=
f
"
\n
<script>set_theme('{cmd_opts.theme}');</script>
\n
"
javascript
+=
f
"
\n
<script>{localization.localization_js(shared.opts.localization)}</script>"
javascript
+=
f
"
\n
<script>{localization.localization_js(shared.opts.localization)}</script>"
if
'gradio_routes_templates_response'
not
in
globals
():
def
template_response
(
*
args
,
**
kwargs
):
res
=
gradio_routes_templates_response
(
*
args
,
**
kwargs
)
res
.
body
=
res
.
body
.
replace
(
b
'</head>'
,
f
'{javascript}</head>'
.
encode
(
"utf8"
))
res
=
raw_response
(
*
args
,
**
kwargs
)
res
.
body
=
res
.
body
.
replace
(
b
'</head>'
,
f
'{javascript}</head>'
.
encode
(
"utf8"
))
res
.
init_headers
()
return
res
gradio_routes_templates_response
=
gradio
.
routes
.
templates
.
TemplateResponse
gradio
.
routes
.
templates
.
TemplateResponse
=
template_response
reload_javascript
=
partial
(
load_javascript
,
gradio
.
routes
.
templates
.
TemplateResponse
)
reload_javascript
()
style.css
View file @
365d4b16
...
...
@@ -34,9 +34,10 @@
.performance
{
font-size
:
0.85em
;
color
:
#444
;
display
:
flex
;
justify-content
:
space-between
;
white-space
:
nowrap
;
}
.performance
p
{
display
:
inline-block
;
}
.performance
.time
{
...
...
@@ -44,8 +45,6 @@
}
.performance
.vram
{
margin-left
:
0
;
text-align
:
right
;
}
#txt2img_generate
,
#img2img_generate
{
...
...
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