1.0.55
This commit is contained in:
parent
75ebaf2677
commit
13f9daabe0
|
|
@ -3,6 +3,15 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline, set_seed
|
|||
from modules.path import fooocus_expansion_path
|
||||
|
||||
|
||||
magic_split = [
|
||||
', extremely',
|
||||
', by',
|
||||
', trending',
|
||||
', best',
|
||||
'. ',
|
||||
]
|
||||
|
||||
|
||||
def safe_str(x):
|
||||
x = str(x)
|
||||
for _ in range(16):
|
||||
|
|
@ -22,9 +31,11 @@ class FooocusExpansion:
|
|||
print('Fooocus Expansion engine loaded.')
|
||||
|
||||
def __call__(self, prompt, seed):
|
||||
prompt = safe_str(prompt) + '. ' # Reduce semantic corruption.
|
||||
seed = int(seed)
|
||||
set_seed(seed)
|
||||
|
||||
prompt = safe_str(prompt) + magic_split[seed % len(magic_split)]
|
||||
|
||||
response = self.pipe(prompt, max_length=len(prompt) + 256)
|
||||
result = response[0]['generated_text']
|
||||
result = safe_str(result)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
### 1.0.55
|
||||
|
||||
* Begin to use magic split.
|
||||
|
||||
### 1.0.55
|
||||
|
||||
* Minor changes of Prompt Expansion.
|
||||
|
||||
### 1.0.52
|
||||
|
|
|
|||
Loading…
Reference in New Issue