fix oom
This commit is contained in:
parent
afdf47ea79
commit
14713eb95e
|
|
@ -1 +1 @@
|
||||||
version = '1.0.63'
|
version = '1.0.64'
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ fooocus_magic_split = [
|
||||||
', intricate',
|
', intricate',
|
||||||
'. The',
|
'. The',
|
||||||
]
|
]
|
||||||
|
dangrous_patterns = '[]【】()()|::'
|
||||||
|
|
||||||
|
|
||||||
def safe_str(x):
|
def safe_str(x):
|
||||||
|
|
@ -18,6 +19,12 @@ def safe_str(x):
|
||||||
return x.rstrip(",. \r\n")
|
return x.rstrip(",. \r\n")
|
||||||
|
|
||||||
|
|
||||||
|
def remove_pattern(x, pattern):
|
||||||
|
for p in pattern:
|
||||||
|
x = x.replace(p, '')
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
class FooocusExpansion:
|
class FooocusExpansion:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.tokenizer = AutoTokenizer.from_pretrained(fooocus_expansion_path)
|
self.tokenizer = AutoTokenizer.from_pretrained(fooocus_expansion_path)
|
||||||
|
|
@ -37,4 +44,5 @@ class FooocusExpansion:
|
||||||
response = self.pipe(prompt, max_length=len(prompt) + 256)
|
response = self.pipe(prompt, max_length=len(prompt) + 256)
|
||||||
result = response[0]['generated_text'][len(origin):]
|
result = response[0]['generated_text'][len(origin):]
|
||||||
result = safe_str(result)
|
result = safe_str(result)
|
||||||
|
result = remove_pattern(result, dangrous_patterns)
|
||||||
return result
|
return result
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
### 1.0.64
|
||||||
|
|
||||||
|
* Fixed a small OOM problem.
|
||||||
|
|
||||||
### 1.0.62
|
### 1.0.62
|
||||||
|
|
||||||
* Change prompt expansion to suffix mode for better balance of semantic and style (and debugging).
|
* Change prompt expansion to suffix mode for better balance of semantic and style (and debugging).
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue