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
d5bba20a
Commit
d5bba20a
authored
Oct 04, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ignore errors in parse for purposes of token counting for #1564
parent
b7f39969
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
modules/ui.py
modules/ui.py
+10
-2
No files found.
modules/ui.py
View file @
d5bba20a
...
...
@@ -386,14 +386,22 @@ def connect_reuse_seed(seed: gr.Number, reuse_seed: gr.Button, generation_info:
outputs
=
[
seed
,
dummy_component
]
)
def
update_token_counter
(
text
,
steps
):
prompt_schedules
=
get_learned_conditioning_prompt_schedules
([
text
],
steps
)
try
:
prompt_schedules
=
get_learned_conditioning_prompt_schedules
([
text
],
steps
)
except
Exception
:
# a parsing error can happen here during typing, and we don't want to bother the user with
# messages related to it in console
prompt_schedules
=
[[[
steps
,
text
]]]
flat_prompts
=
reduce
(
lambda
list1
,
list2
:
list1
+
list2
,
prompt_schedules
)
prompts
=
[
prompt_text
for
step
,
prompt_text
in
flat_prompts
]
prompts
=
[
prompt_text
for
step
,
prompt_text
in
flat_prompts
]
tokens
,
token_count
,
max_length
=
max
([
model_hijack
.
tokenize
(
prompt
)
for
prompt
in
prompts
],
key
=
lambda
args
:
args
[
1
])
style_class
=
' class="red"'
if
(
token_count
>
max_length
)
else
""
return
f
"<span {style_class}>{token_count}/{max_length}</span>"
def
create_toprow
(
is_img2img
):
id_part
=
"img2img"
if
is_img2img
else
"txt2img"
...
...
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