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QOL)@N}hkD-%>^W^TB8EH~ked)0GOZy$nD4m+9I#RZ7NWm_H6qyCWa>B%VxU1R|3
z+3#84N7aGKoHYANcr(_cQ+Q5L#J5~~!(;#GlS5y8tHdf=MJXsuF-DbUE44P&yF;vG
z!a}|Nb;@Q1iG(`2a-3>3$H_45+B&@K1^`p*e^=)&J?P8*m$^NJrY>F&Ym@B#WKZq@+UEy;*uPf*
zrm-Sk(5F`F*5%TEbEvwaie+9A?`nC0Zf?SkWVrgaJvOC9$hL6{_LFA%iWJFjlW0cv
zUh`rdyFQ1Ep*a1=5rPj$l%_Mg>VF~T?cH`hAhckq*Sw(}PnESoo&MlmkSa8~4hi?0
z(^aLm-^%}`D-fqnR=l(77oPgZFb3bu*?EZ&7eQ&3OuadFy1+5F1^p8VsA<6h9m!
zG=1Q3cZ2>^*8NUYcF=N|lzazF?qeqi&W+Jbk;{JEoY56T%$js1#R>D00B}9wN$OBY
zs<=EHZ{c3I#%MTU)YsR^1)hx
pZ)TVPh{BgFji^?BgQA#X432I+X`(dr3u>}lG124nSoP-b{{X_R7Q6re
literal 0
HcmV?d00001
diff --git a/sdxl_styles/sdxl_styles_fooocus.json b/sdxl_styles/sdxl_styles_fooocus.json
index 81d6442e..cf64eab4 100644
--- a/sdxl_styles/sdxl_styles_fooocus.json
+++ b/sdxl_styles/sdxl_styles_fooocus.json
@@ -3,6 +3,10 @@
"name": "Fooocus Enhance",
"negative_prompt": "(worst quality, low quality, normal quality, lowres, low details, oversaturated, undersaturated, overexposed, underexposed, grayscale, bw, bad photo, bad photography, bad art:1.4), (watermark, signature, text font, username, error, logo, words, letters, digits, autograph, trademark, name:1.2), (blur, blurry, grainy), morbid, ugly, asymmetrical, mutated malformed, mutilated, poorly lit, bad shadow, draft, cropped, out of frame, cut off, censored, jpeg artifacts, out of focus, glitch, duplicate, (airbrushed, cartoon, anime, semi-realistic, cgi, render, blender, digital art, manga, amateur:1.3), (3D ,3D Game, 3D Game Scene, 3D Character:1.1), (bad hands, bad anatomy, bad body, bad face, bad teeth, bad arms, bad legs, deformities:1.3)"
},
+ {
+ "name": "Fooocus Semi Realistic",
+ "negative_prompt": "(worst quality, low quality, normal quality, lowres, low details, oversaturated, undersaturated, overexposed, underexposed, bad photo, bad photography, bad art:1.4), (watermark, signature, text font, username, error, logo, words, letters, digits, autograph, trademark, name:1.2), (blur, blurry, grainy), morbid, ugly, asymmetrical, mutated malformed, mutilated, poorly lit, bad shadow, draft, cropped, out of frame, cut off, censored, jpeg artifacts, out of focus, glitch, duplicate, (bad hands, bad anatomy, bad body, bad face, bad teeth, bad arms, bad legs, deformities:1.3)"
+ },
{
"name": "Fooocus Sharp",
"prompt": "cinematic still {prompt} . emotional, harmonious, vignette, 4k epic detailed, shot on kodak, 35mm photo, sharp focus, high budget, cinemascope, moody, epic, gorgeous, film grain, grainy",
From 86cba3f223720245269b96d86560d8ef16806c2a Mon Sep 17 00:00:00 2001
From: Manuel Schmid
Date: Fri, 15 Mar 2024 23:11:26 +0100
Subject: [PATCH 34/42] feat: add translation for unsupported image error
(#2537)
---
language/en.json | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/language/en.json b/language/en.json
index 0f97e6e9..fefc79c4 100644
--- a/language/en.json
+++ b/language/en.json
@@ -384,5 +384,6 @@
"Metadata Scheme": "Metadata Scheme",
"Image Prompt parameters are not included. Use png and a1111 for compatibility with Civitai.": "Image Prompt parameters are not included. Use png and a1111 for compatibility with Civitai.",
"fooocus (json)": "fooocus (json)",
- "a1111 (plain text)": "a1111 (plain text)"
+ "a1111 (plain text)": "a1111 (plain text)",
+ "Unsupported image type in input": "Unsupported image type in input"
}
\ No newline at end of file
From d057f2fae9c8222cb30a1eb20c549a7cf2c96bda Mon Sep 17 00:00:00 2001
From: Manuel Schmid <9307310+mashb1t@users.noreply.github.com>
Date: Sun, 17 Mar 2024 14:01:10 +0100
Subject: [PATCH 35/42] fix: correctly handle empty lora array in a1111
metadata log scheme (#2551)
---
modules/meta_parser.py | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/modules/meta_parser.py b/modules/meta_parser.py
index 546c093f..e518a9cf 100644
--- a/modules/meta_parser.py
+++ b/modules/meta_parser.py
@@ -377,7 +377,7 @@ class A1111MetadataParser(MetadataParser):
data[key] = filename
break
- if 'lora_hashes' in data:
+ if 'lora_hashes' in data and data['lora_hashes'] != '':
lora_filenames = modules.config.lora_filenames.copy()
if modules.config.sdxl_lcm_lora in lora_filenames:
lora_filenames.remove(modules.config.sdxl_lcm_lora)
@@ -431,16 +431,15 @@ class A1111MetadataParser(MetadataParser):
if key in data:
generation_params[self.fooocus_to_a1111[key]] = data[key]
- lora_hashes = []
- for index, (lora_name, lora_weight, lora_hash) in enumerate(self.loras):
- # workaround for Fooocus not knowing LoRA name in LoRA metadata
- lora_hashes.append(f'{lora_name}: {lora_hash}: {lora_weight}')
- lora_hashes_string = ', '.join(lora_hashes)
+ if len(self.loras) > 0:
+ lora_hashes = []
+ for index, (lora_name, lora_weight, lora_hash) in enumerate(self.loras):
+ # workaround for Fooocus not knowing LoRA name in LoRA metadata
+ lora_hashes.append(f'{lora_name}: {lora_hash}: {lora_weight}')
+ lora_hashes_string = ', '.join(lora_hashes)
+ generation_params[self.fooocus_to_a1111['lora_hashes']] = lora_hashes_string
- generation_params |= {
- self.fooocus_to_a1111['lora_hashes']: lora_hashes_string,
- self.fooocus_to_a1111['version']: data['version']
- }
+ generation_params[self.fooocus_to_a1111['version']] = data['version']
if modules.config.metadata_created_by != '':
generation_params[self.fooocus_to_a1111['created_by']] = modules.config.metadata_created_by
From 6b44c101dbfe742fd912456c200ad1bfa4a88473 Mon Sep 17 00:00:00 2001
From: Manuel Schmid
Date: Mon, 18 Mar 2024 12:30:39 +0100
Subject: [PATCH 36/42] feat: update changelog and readme
---
readme.md | 10 +++++++---
update_log.md | 11 +++++++++++
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/readme.md b/readme.md
index 4e47ac08..6ec24eed 100644
--- a/readme.md
+++ b/readme.md
@@ -84,6 +84,10 @@ The first time you launch the software, it will automatically download models:
After Fooocus 2.1.60, you will also have `run_anime.bat` and `run_realistic.bat`. They are different model presets (and require different models, but they will be automatically downloaded). [Check here for more details](https://github.com/lllyasviel/Fooocus/discussions/679).
+After Fooocus 2.3.0 you can also switch presets directly in the browser. Keep in mind to add these arguments if you want to change the default behavior:
+* Use `--disable-preset-selection` to disable preset selection in the browser.
+* Use `--always-download-new-model` to download missing models on preset switch. Default is fallback to `previous_default_models` defined in the corresponding preset, also see terminal output.
+

If you already have these files, you can copy them to the above locations to speed up installation.
@@ -115,7 +119,7 @@ See also the common problems and troubleshoots [here](troubleshoot.md).
### Colab
-(Last tested - 2024 Mar 11)
+(Last tested - 2024 Mar 18 - @mashb1t)
| Colab | Info
| --- | --- |
@@ -125,9 +129,9 @@ In Colab, you can modify the last line to `!python entry_with_update.py --share
Note that this Colab will disable refiner by default because Colab free's resources are relatively limited (and some "big" features like image prompt may cause free-tier Colab to disconnect). We make sure that basic text-to-image is always working on free-tier Colab.
-Using `--always-high-vram` shifts resource allocation from RAM to VRAM and achieves the overall best balance between performance, flexibility and stability on the default T4 instance.
+Using `--always-high-vram` shifts resource allocation from RAM to VRAM and achieves the overall best balance between performance, flexibility and stability on the default T4 instance. Please find more information [here](https://github.com/lllyasviel/Fooocus/pull/1710#issuecomment-1989185346).
-Thanks to [camenduru](https://github.com/camenduru)!
+Thanks to [camenduru](https://github.com/camenduru) for the template!
### Linux (Using Anaconda)
diff --git a/update_log.md b/update_log.md
index 322c19c1..4e22db0a 100644
--- a/update_log.md
+++ b/update_log.md
@@ -1,3 +1,14 @@
+# [2.3.0](https://github.com/lllyasviel/Fooocus/releases/tag/2.3.0)
+
+* Add performance "lightning" (based on [SDXL-Lightning 4 step LoRA](https://huggingface.co/ByteDance/SDXL-Lightning/blob/main/sdxl_lightning_4step_lora.safetensors))
+* Add preset selection to UI, disable with argument `--disable-preset-selection`. Use `--always-download-new-model` to download missing models on preset switch.
+* Improve face swap consistency by switching later in the process to (synthetic) refiner
+* Add temp path cleanup on startup
+* Add support for wildcard subdirectories
+* Add scrollable 2 column layout for styles for better structure
+* Improve Colab resource needs for T4 instances (default), positively tested with all image prompt features
+* Improve anime preset, now uses style `Fooocus Semi Realistic` instead of `Fooocus Negative` (less wet look images)
+
# [2.2.1](https://github.com/lllyasviel/Fooocus/releases/tag/2.2.1)
* Fix some small bugs (e.g. image grid, upscale fast 2x, LoRA weight width in Firefox)
From c08518abae926d596ac5095ba8af7c3c3d88cc4d Mon Sep 17 00:00:00 2001
From: Manuel Schmid
Date: Mon, 18 Mar 2024 17:40:37 +0100
Subject: [PATCH 37/42] feat: add backwards compatibility for presets without
disable/enable LoRA boolean
https://github.com/lllyasviel/Fooocus/pull/2507
---
modules/config.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/modules/config.py b/modules/config.py
index c82f61c2..f3bf7f1f 100644
--- a/modules/config.py
+++ b/modules/config.py
@@ -323,8 +323,12 @@ default_loras = get_config_item_or_set_default(
1.0
]
],
- validator=lambda x: isinstance(x, list) and all(len(y) == 3 and isinstance(y[0], bool) and isinstance(y[1], str) and isinstance(y[2], numbers.Number) for y in x)
+ validator=lambda x: isinstance(x, list) and all(
+ len(y) == 3 and isinstance(y[0], bool) and isinstance(y[1], str) and isinstance(y[2], numbers.Number)
+ or len(y) == 2 and isinstance(y[0], str) and isinstance(y[1], numbers.Number)
+ for y in x)
)
+default_loras = [(y[0], y[1], y[2]) if len(y) == 3 else (True, y[0], y[1]) for y in default_loras]
default_max_lora_number = get_config_item_or_set_default(
key='default_max_lora_number',
default_value=len(default_loras) if isinstance(default_loras, list) and len(default_loras) > 0 else 5,
From ee361715afb7dab10ff266fcf8d8c6abcebfd81a Mon Sep 17 00:00:00 2001
From: Manuel Schmid
Date: Mon, 18 Mar 2024 18:04:15 +0100
Subject: [PATCH 38/42] docs: bump version number to 2.3.0
---
fooocus_version.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fooocus_version.py b/fooocus_version.py
index 6c3c2c90..a4b8895b 100644
--- a/fooocus_version.py
+++ b/fooocus_version.py
@@ -1 +1 @@
-version = '2.2.1'
+version = '2.3.0'
From 3efce581cac1df4441980710f55c28fbde3ac3d7 Mon Sep 17 00:00:00 2001
From: Manuel Schmid
Date: Mon, 18 Mar 2024 18:13:15 +0100
Subject: [PATCH 39/42] docs: add hint for colab preset timeout to readme
---
readme.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/readme.md b/readme.md
index 6ec24eed..5f66e02a 100644
--- a/readme.md
+++ b/readme.md
@@ -119,7 +119,7 @@ See also the common problems and troubleshoots [here](troubleshoot.md).
### Colab
-(Last tested - 2024 Mar 18 - @mashb1t)
+(Last tested - 2024 Mar 18 by [mashb1t](https://github.com/mashb1t))
| Colab | Info
| --- | --- |
@@ -127,6 +127,8 @@ See also the common problems and troubleshoots [here](troubleshoot.md).
In Colab, you can modify the last line to `!python entry_with_update.py --share --always-high-vram` or `!python entry_with_update.py --share --always-high-vram --preset anime` or `!python entry_with_update.py --share --always-high-vram --preset realistic` for Fooocus Default/Anime/Realistic Edition.
+You can also change the preset in the UI. Please be aware that this may lead to timeouts after 60 seconds. If this is the case, please wait until the download has finished, change the preset to initial and back to the one you've selected or reload the page.
+
Note that this Colab will disable refiner by default because Colab free's resources are relatively limited (and some "big" features like image prompt may cause free-tier Colab to disconnect). We make sure that basic text-to-image is always working on free-tier Colab.
Using `--always-high-vram` shifts resource allocation from RAM to VRAM and achieves the overall best balance between performance, flexibility and stability on the default T4 instance. Please find more information [here](https://github.com/lllyasviel/Fooocus/pull/1710#issuecomment-1989185346).
From 532a6e2e67634a8b33fb218a44da498c4f689db5 Mon Sep 17 00:00:00 2001
From: Manuel Schmid
Date: Tue, 19 Mar 2024 19:10:14 +0100
Subject: [PATCH 40/42] fix: remove positive prompt from anime prefix
prevents the prompt from getting overridden when switching presets in browser
---
presets/anime.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/presets/anime.json b/presets/anime.json
index 6fe6e4ba..2610677c 100644
--- a/presets/anime.json
+++ b/presets/anime.json
@@ -34,7 +34,7 @@
"default_sampler": "dpmpp_2m_sde_gpu",
"default_scheduler": "karras",
"default_performance": "Speed",
- "default_prompt": "1girl, ",
+ "default_prompt": "",
"default_prompt_negative": "",
"default_styles": [
"Fooocus V2",
From 856eb750ab515a3b5b28b7d35360fca1411dd933 Mon Sep 17 00:00:00 2001
From: Manuel Schmid
Date: Tue, 19 Mar 2024 23:08:38 +0100
Subject: [PATCH 41/42] fix: add enabled value to LoRA when setting
default_max_lora_number
---
modules/config.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/config.py b/modules/config.py
index f3bf7f1f..ba2a76fb 100644
--- a/modules/config.py
+++ b/modules/config.py
@@ -476,7 +476,7 @@ metadata_created_by = get_config_item_or_set_default(
example_inpaint_prompts = [[x] for x in example_inpaint_prompts]
-config_dict["default_loras"] = default_loras = default_loras[:default_max_lora_number] + [['None', 1.0] for _ in range(default_max_lora_number - len(default_loras))]
+config_dict["default_loras"] = default_loras = default_loras[:default_max_lora_number] + [[True, 'None', 1.0] for _ in range(default_max_lora_number - len(default_loras))]
# mapping config to meta parameter
possible_preset_keys = {
From 978267f461e204c6c4359a79ed818ee2e3e1af39 Mon Sep 17 00:00:00 2001
From: Manuel Schmid
Date: Wed, 20 Mar 2024 21:12:21 +0100
Subject: [PATCH 42/42] fix: correctly set preset config and loras in meta
parser
---
modules/config.py | 8 --------
modules/meta_parser.py | 19 ++++++++++++++-----
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/modules/config.py b/modules/config.py
index ba2a76fb..76ffd348 100644
--- a/modules/config.py
+++ b/modules/config.py
@@ -124,14 +124,6 @@ def try_get_preset_content(preset):
print(e)
return {}
-
-try:
- with open(os.path.abspath(f'./presets/default.json'), "r", encoding="utf-8") as json_file:
- config_dict.update(json.load(json_file))
-except Exception as e:
- print(f'Load default preset failed.')
- print(e)
-
available_presets = get_presets()
preset = args_manager.args.preset
config_dict.update(try_get_preset_content(preset))
diff --git a/modules/meta_parser.py b/modules/meta_parser.py
index 15f0ad7b..10bc6896 100644
--- a/modules/meta_parser.py
+++ b/modules/meta_parser.py
@@ -169,11 +169,20 @@ def get_freeu(key: str, fallback: str | None, source_dict: dict, results: list,
def get_lora(key: str, fallback: str | None, source_dict: dict, results: list):
try:
- n, w = source_dict.get(key, source_dict.get(fallback)).split(' : ')
- w = float(w)
- results.append(True)
- results.append(n)
- results.append(w)
+ split_data = source_dict.get(key, source_dict.get(fallback)).split(' : ')
+ enabled = True
+ name = split_data[0]
+ weight = split_data[1]
+
+ if len(split_data) == 3:
+ enabled = split_data[0] == 'True'
+ name = split_data[1]
+ weight = split_data[2]
+
+ weight = float(weight)
+ results.append(enabled)
+ results.append(name)
+ results.append(weight)
except:
results.append(True)
results.append('None')