Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stable-diffusion-webui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
stable-diffusion-webui
Commits
1eb588cb
Commit
1eb588cb
authored
Oct 04, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove functools.cache as some people are having issues with it
parent
e1b128d8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
prompt_parser.py
modules/prompt_parser.py
+6
-2
No files found.
modules/prompt_parser.py
View file @
1eb588cb
...
@@ -29,6 +29,7 @@ def get_learned_conditioning_prompt_schedules(prompts, steps):
...
@@ -29,6 +29,7 @@ def get_learned_conditioning_prompt_schedules(prompts, steps):
%
import common.SIGNED_NUMBER -> NUMBER
%
import common.SIGNED_NUMBER -> NUMBER
"""
"""
parser
=
Lark
(
grammar
,
parser
=
'lalr'
)
parser
=
Lark
(
grammar
,
parser
=
'lalr'
)
def
collect_steps
(
steps
,
tree
):
def
collect_steps
(
steps
,
tree
):
l
=
[
steps
]
l
=
[
steps
]
class
CollectSteps
(
Visitor
):
class
CollectSteps
(
Visitor
):
...
@@ -40,6 +41,7 @@ def get_learned_conditioning_prompt_schedules(prompts, steps):
...
@@ -40,6 +41,7 @@ def get_learned_conditioning_prompt_schedules(prompts, steps):
l
.
append
(
tree
.
children
[
-
1
])
l
.
append
(
tree
.
children
[
-
1
])
CollectSteps
()
.
visit
(
tree
)
CollectSteps
()
.
visit
(
tree
)
return
sorted
(
set
(
l
))
return
sorted
(
set
(
l
))
def
at_step
(
step
,
tree
):
def
at_step
(
step
,
tree
):
class
AtStep
(
Transformer
):
class
AtStep
(
Transformer
):
def
scheduled
(
self
,
args
):
def
scheduled
(
self
,
args
):
...
@@ -62,11 +64,13 @@ def get_learned_conditioning_prompt_schedules(prompts, steps):
...
@@ -62,11 +64,13 @@ def get_learned_conditioning_prompt_schedules(prompts, steps):
for
child
in
children
:
for
child
in
children
:
yield
from
child
yield
from
child
return
AtStep
()
.
transform
(
tree
)
return
AtStep
()
.
transform
(
tree
)
@
functools
.
cache
def
get_schedule
(
prompt
):
def
get_schedule
(
prompt
):
tree
=
parser
.
parse
(
prompt
)
tree
=
parser
.
parse
(
prompt
)
return
[[
t
,
at_step
(
t
,
tree
)]
for
t
in
collect_steps
(
steps
,
tree
)]
return
[[
t
,
at_step
(
t
,
tree
)]
for
t
in
collect_steps
(
steps
,
tree
)]
return
[
get_schedule
(
prompt
)
for
prompt
in
prompts
]
promptdict
=
{
prompt
:
get_schedule
(
prompt
)
for
prompt
in
set
(
prompts
)}
return
[
promptdict
[
prompt
]
for
prompt
in
prompts
]
ScheduledPromptConditioning
=
namedtuple
(
"ScheduledPromptConditioning"
,
[
"end_at_step"
,
"cond"
])
ScheduledPromptConditioning
=
namedtuple
(
"ScheduledPromptConditioning"
,
[
"end_at_step"
,
"cond"
])
...
...
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