mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
Increased allowed random seed range
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
|||||||
version = '2.1.732'
|
version = '2.1.733'
|
||||||
|
|||||||
@@ -123,13 +123,8 @@ def worker():
|
|||||||
controlnet_cpds_path = None
|
controlnet_cpds_path = None
|
||||||
clip_vision_path, ip_negative_path, ip_adapter_path = None, None, None
|
clip_vision_path, ip_negative_path, ip_adapter_path = None, None, None
|
||||||
|
|
||||||
seed = image_seed
|
seed = int(image_seed)
|
||||||
max_seed = int(1024 * 1024 * 1024)
|
print(f'[Parameters] Seed = {seed}')
|
||||||
if not isinstance(seed, int):
|
|
||||||
seed = random.randint(1, max_seed)
|
|
||||||
if seed < 0:
|
|
||||||
seed = - seed
|
|
||||||
seed = seed % max_seed
|
|
||||||
|
|
||||||
if performance_selection == 'Speed':
|
if performance_selection == 'Speed':
|
||||||
steps = 30
|
steps = 30
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, set_seed
|
|||||||
from modules.path import fooocus_expansion_path
|
from modules.path import fooocus_expansion_path
|
||||||
from fcbh.model_patcher import ModelPatcher
|
from fcbh.model_patcher import ModelPatcher
|
||||||
|
|
||||||
|
# limitation of np.random.seed(), called from transformers.set_seed()
|
||||||
|
SEED_LIMIT_NUMPY = 2**32
|
||||||
|
|
||||||
|
|
||||||
fooocus_magic_split = [
|
fooocus_magic_split = [
|
||||||
', extremely',
|
', extremely',
|
||||||
@@ -54,7 +57,7 @@ class FooocusExpansion:
|
|||||||
print('Fooocus Expansion loaded by itself.')
|
print('Fooocus Expansion loaded by itself.')
|
||||||
model_management.load_model_gpu(self.patcher)
|
model_management.load_model_gpu(self.patcher)
|
||||||
|
|
||||||
seed = int(seed)
|
seed = int(seed) % SEED_LIMIT_NUMPY
|
||||||
set_seed(seed)
|
set_seed(seed)
|
||||||
origin = safe_str(prompt)
|
origin = safe_str(prompt)
|
||||||
prompt = origin + fooocus_magic_split[seed % len(fooocus_magic_split)]
|
prompt = origin + fooocus_magic_split[seed % len(fooocus_magic_split)]
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
# 2.1.733
|
||||||
|
|
||||||
|
* Increased allowed random seed range.
|
||||||
|
|
||||||
# 2.1.728
|
# 2.1.728
|
||||||
|
|
||||||
* Fixed some potential numerical problems since 2.1.723
|
* Fixed some potential numerical problems since 2.1.723
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ from modules.sdxl_styles import legal_style_names, aspect_ratios
|
|||||||
from modules.private_logger import get_current_html_path
|
from modules.private_logger import get_current_html_path
|
||||||
from modules.ui_gradio_extensions import reload_javascript
|
from modules.ui_gradio_extensions import reload_javascript
|
||||||
|
|
||||||
|
# as in k-diffusion (sampling.py)
|
||||||
|
MIN_SEED = 0
|
||||||
|
MAX_SEED = 2**63 - 1
|
||||||
|
|
||||||
|
|
||||||
def generate_clicked(*args):
|
def generate_clicked(*args):
|
||||||
execution_start_time = time.perf_counter()
|
execution_start_time = time.perf_counter()
|
||||||
@@ -193,16 +197,22 @@ with shared.gradio_root:
|
|||||||
info='Describing what you do not want to see.', lines=2,
|
info='Describing what you do not want to see.', lines=2,
|
||||||
value=modules.path.default_negative_prompt)
|
value=modules.path.default_negative_prompt)
|
||||||
seed_random = gr.Checkbox(label='Random', value=True)
|
seed_random = gr.Checkbox(label='Random', value=True)
|
||||||
image_seed = gr.Number(label='Seed', value=0, precision=0, visible=False)
|
image_seed = gr.Textbox(label='Seed', value=0, max_lines=1, visible=False) # workaround for https://github.com/gradio-app/gradio/issues/5354
|
||||||
|
|
||||||
def random_checked(r):
|
def random_checked(r):
|
||||||
return gr.update(visible=not r)
|
return gr.update(visible=not r)
|
||||||
|
|
||||||
def refresh_seed(r, s):
|
def refresh_seed(r, seed_string):
|
||||||
if r:
|
if r:
|
||||||
return random.randint(1, 1024*1024*1024)
|
return random.randint(MIN_SEED, MAX_SEED)
|
||||||
else:
|
else:
|
||||||
return s
|
try:
|
||||||
|
seed_value = int(seed_string)
|
||||||
|
if MIN_SEED <= seed_value <= MAX_SEED:
|
||||||
|
return seed_value
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
return random.randint(MIN_SEED, MAX_SEED)
|
||||||
|
|
||||||
seed_random.change(random_checked, inputs=[seed_random], outputs=[image_seed], queue=False)
|
seed_random.change(random_checked, inputs=[seed_random], outputs=[image_seed], queue=False)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user