This commit is contained in:
lvmin 2023-09-10 22:08:55 -07:00
parent afdf47ea79
commit 14713eb95e
3 changed files with 13 additions and 1 deletions

View File

@ -1 +1 @@
version = '1.0.63'
version = '1.0.64'

View File

@ -9,6 +9,7 @@ fooocus_magic_split = [
', intricate',
'. The',
]
dangrous_patterns = '[]【】()|:'
def safe_str(x):
@ -18,6 +19,12 @@ def safe_str(x):
return x.rstrip(",. \r\n")
def remove_pattern(x, pattern):
for p in pattern:
x = x.replace(p, '')
return x
class FooocusExpansion:
def __init__(self):
self.tokenizer = AutoTokenizer.from_pretrained(fooocus_expansion_path)
@ -37,4 +44,5 @@ class FooocusExpansion:
response = self.pipe(prompt, max_length=len(prompt) + 256)
result = response[0]['generated_text'][len(origin):]
result = safe_str(result)
result = remove_pattern(result, dangrous_patterns)
return result

View File

@ -1,3 +1,7 @@
### 1.0.64
* Fixed a small OOM problem.
### 1.0.62
* Change prompt expansion to suffix mode for better balance of semantic and style (and debugging).