Fooocus is an image generating software (based on Gradio).
Fooocus is a rethinking of Stable Diffusion and Midjourney’s designs:
-
Learned from Stable Diffusion, the software is offline, open source, and free.
-
Learned from Midjourney, the manual tweaking is not needed, and users only need to focus on the prompts and images.
(Last tested - 2023 Nov 15)
Colab | Info |
---|---|
Fooocus Un-Official |
In Colab, you can modify the last line to !python entry_with_update.py --share
or !python entry_with_update.py --preset anime --share
or !python entry_with_update.py --preset realistic --share
for Fooocus Default/Anime/Realistic Edition.
Note that this Colab will disable refiner by default because Colab free's resource is relatively limited.
Thanks to camenduru!
Given different goals, the default models and configs of Fooocus is different:
Task | Windows | Linux args | Main Model | Refiner | Config |
---|---|---|---|---|---|
General | run.bat | juggernautXL v6_RunDiffusion | not used | here | |
Realistic | run_realistic.bat | --preset realistic | realistic_stock_photo | not used | here |
Anime | run_anime.bat | --preset anime | bluepencil_v50 | dreamsharper_v8 (SD1.5) | here |
Note that the download is automatic - you do not need to do anything if the internet connection is okay. However, you can download them manually if you (or move them from somewhere else) have your own preparation.
List of "Hidden" Tricks
Below things are already inside the software, and users do not need to do anything about these.
- GPT2-based prompt expansion as a dynamic style "Fooocus V2". (similar to Midjourney's hidden pre-processsing and "raw" mode, or the LeonardoAI's Prompt Magic).
- Native refiner swap inside one single k-sampler. The advantage is that now the refiner model can reuse the base model's momentum (or ODE's history parameters) collected from k-sampling to achieve more coherent sampling. In Automatic1111's high-res fix and ComfyUI's node system, the base model and refiner use two independent k-samplers, which means the momentum is largely wasted, and the sampling continuity is broken. Fooocus uses its own advanced k-diffusion sampling that ensures seamless, native, and continuous swap in a refiner setup. (Update Aug 13: Actually I discussed this with Automatic1111 several days ago and it seems that the “native refiner swap inside one single k-sampler” is merged into the dev branch of webui. Great!)
- Negative ADM guidance. Because the highest resolution level of XL Base does not have cross attentions, the positive and negative signals for XL's highest resolution level cannot receive enough contrasts during the CFG sampling, causing the results look a bit plastic or overly smooth in certain cases. Fortunately, since the XL's highest resolution level is still conditioned on image aspect ratios (ADM), we can modify the adm on the positive/negative side to compensate for the lack of CFG contrast in the highest resolution level. (Update Aug 16, the IOS App Drawing Things will support Negative ADM Guidance. Great!)
- We implemented a carefully tuned variation of the Section 5.1 of "Improving Sample Quality of Diffusion Models Using Self-Attention Guidance". The weight is set to very low, but this is Fooocus's final guarantee to make sure that the XL will never yield overly smooth or plastic appearance (examples here). This can almostly eliminate all cases that XL still occasionally produce overly smooth results even with negative ADM guidance. (Update 2023 Aug 18, the Gaussian kernel of SAG is changed to an anisotropic kernel for better structure preservation and fewer artifacts.)
- We modified the style templates a bit and added the "cinematic-default".
- We tested the "sd_xl_offset_example-lora_1.0.safetensors" and it seems that when the lora weight is below 0.5, the results are always better than XL without lora.
- The parameters of samplers are carefully tuned.
- Because XL uses positional encoding for generation resolution, images generated by several fixed resolutions look a bit better than that from arbitrary resolutions (because the positional encoding is not very good at handling int numbers that are unseen during training). This suggests that the resolutions in UI may be hard coded for best results.
- Separated prompts for two different text encoders seem unnecessary. Separated prompts for base model and refiner may work but the effects are random, and we refrain from implement this.
- DPM family seems well-suited for XL, since XL sometimes generates overly smooth texture but DPM family sometimes generate overly dense detail in texture. Their joint effect looks neutral and appealing to human perception.
- A carefully designed system for balancing multiple styles as well as prompt expansion.
- Using automatic1111's method to normalize prompt emphasizing. This significantly improve results when users directly copy prompts from civitai.
- The joint swap system of refiner now also support img2img and upscale in a seamless way.
- CFG Scale and TSNR correction (tuned for SDXL) when CFG is bigger than 10.
After the first time you run Fooocus, a config file will be generated at Fooocus\config.txt
. This file can be edited for changing the model path or default parameters.
For example, an edited Fooocus\config.txt
(this file will be generated after the first launch) may look like this:
{
"path_checkpoints": "D:\\Fooocus\\models\\checkpoints",
"path_loras": "D:\\Fooocus\\models\\loras",
"path_embeddings": "D:\\Fooocus\\models\\embeddings",
"path_vae_approx": "D:\\Fooocus\\models\\vae_approx",
"path_upscale_models": "D:\\Fooocus\\models\\upscale_models",
"path_inpaint": "D:\\Fooocus\\models\\inpaint",
"path_controlnet": "D:\\Fooocus\\models\\controlnet",
"path_clip_vision": "D:\\Fooocus\\models\\clip_vision",
"path_fooocus_expansion": "D:\\Fooocus\\models\\prompt_expansion\\fooocus_expansion",
"path_outputs": "D:\\Fooocus\\outputs",
"default_model": "realisticStockPhoto_v10.safetensors",
"default_refiner": "",
"default_loras": [["lora_filename_1.safetensors", 0.5], ["lora_filename_2.safetensors", 0.5]],
"default_cfg_scale": 3.0,
"default_sampler": "dpmpp_2m",
"default_scheduler": "karras",
"default_negative_prompt": "low quality",
"default_positive_prompt": "",
"default_styles": [
"Fooocus V2",
"Fooocus Photograph",
"Fooocus Negative"
]
}
Many other keys, formats, and examples are in Fooocus\config_modification_tutorial.txt
(this file will be generated after the first launch).
Consider twice before you really change the config. If you find yourself breaking things, just delete Fooocus\config.txt
. Fooocus will go back to default.
A safter way is just to try "run_anime.bat" or "run_realistic.bat" - they should be already good enough for different tasks.
Note that user_path_config.txt
is deprecated and will be removed soon.
Click here to browse the advanced features.
Fooocus also has many community forks, just like SD-WebUI's vladmandic/automatic and anapnoe/stable-diffusion-webui-ux, for enthusiastic users who want to try!
Fooocus' forks |
---|
fenneishi/Fooocus-Control runew0lf/RuinedFooocus MoonRide303/Fooocus-MRE and so on ... |
See also About Forking and Promotion of Forks.
Fooocus is powered by FCBH backend, which starts from an odd mixture of Automatic1111 and ComfyUI.
Special thanks to twri and 3Diva for creating additional SDXL styles available in Fooocus.
The log is here.
We need your help! Please help with translating Fooocus to international languages.
You can put json files in the language
folder to translate the user interface.
For example, below is the content of Fooocus/language/example.json
:
{
"Generate": "生成",
"Input Image": "入力画像",
"Advanced": "고급",
"SAI 3D Model": "SAI 3D Modèle"
}
If you add --language example
arg, Fooocus will read Fooocus/language/example.json
to translate the UI.
For example, you can edit the ending line of Windows run.bat
as
.\python_embeded\python.exe -s Fooocus\entry_with_update.py --language example
Or run_anime.bat
as
.\python_embeded\python.exe -s Fooocus\entry_with_update.py --language example --preset anime
Or run_realistic.bat
as
.\python_embeded\python.exe -s Fooocus\entry_with_update.py --language example --preset realistic
For practical translation, you may create your own file like Fooocus/language/jp.json
or Fooocus/language/cn.json
and then use flag --language jp
or --language cn
. Apparently, these files do not exist now. We need your help to create these files!
Note that if no --language
is given and at the same time Fooocus/language/default.json
exists, Fooocus will always load Fooocus/language/default.json
for translation. By default, the file Fooocus/language/default.json
does not exist.