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
8a40e30d
Commit
8a40e30d
authored
Jul 30, 2023
by
Robert Barron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for whitespace after the number in constructions like [foo:bar: 0.5 ] and (foo : 0.5 )
parent
68f336bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
modules/prompt_parser.py
modules/prompt_parser.py
+8
-8
No files found.
modules/prompt_parser.py
View file @
8a40e30d
...
...
@@ -19,7 +19,7 @@ prompt: (emphasized | scheduled | alternate | plain | WHITESPACE)*
!emphasized: "(" prompt ")"
| "(" prompt ":" prompt ")"
| "[" prompt "]"
scheduled: "[" [prompt ":"] prompt ":" [WHITESPACE] NUMBER "]"
scheduled: "[" [prompt ":"] prompt ":" [WHITESPACE] NUMBER
[WHITESPACE]
"]"
alternate: "[" prompt ("|" prompt)+ "]"
WHITESPACE: /\s+/
plain: /([^\\\[\]():|]|\\.)+/
...
...
@@ -60,11 +60,11 @@ def get_learned_conditioning_prompt_schedules(prompts, steps):
class
CollectSteps
(
lark
.
Visitor
):
def
scheduled
(
self
,
tree
):
tree
.
children
[
-
1
]
=
float
(
tree
.
children
[
-
1
])
if
tree
.
children
[
-
1
]
<
1
:
tree
.
children
[
-
1
]
*=
steps
tree
.
children
[
-
1
]
=
min
(
steps
,
int
(
tree
.
children
[
-
1
]))
res
.
append
(
tree
.
children
[
-
1
])
tree
.
children
[
-
2
]
=
float
(
tree
.
children
[
-
2
])
if
tree
.
children
[
-
2
]
<
1
:
tree
.
children
[
-
2
]
*=
steps
tree
.
children
[
-
2
]
=
min
(
steps
,
int
(
tree
.
children
[
-
2
]))
res
.
append
(
tree
.
children
[
-
2
])
def
alternate
(
self
,
tree
):
res
.
extend
(
range
(
1
,
steps
+
1
))
...
...
@@ -75,7 +75,7 @@ def get_learned_conditioning_prompt_schedules(prompts, steps):
def
at_step
(
step
,
tree
):
class
AtStep
(
lark
.
Transformer
):
def
scheduled
(
self
,
args
):
before
,
after
,
_
,
when
=
args
before
,
after
,
_
,
when
,
_
=
args
yield
before
or
()
if
step
<=
when
else
after
def
alternate
(
self
,
args
):
yield
next
(
args
[(
step
-
1
)
%
len
(
args
)])
...
...
@@ -333,7 +333,7 @@ re_attention = re.compile(r"""
\\|
\(|
\[|
:
([+-]?[.\d]+)
\)|
:
\s*([+-]?[.\d]+)\s*
\)|
\)|
]|
[^\\()\[\]:]+|
...
...
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