Fooocus

What is Fooocus

Fooocus is a software tool for generating images based on text prompts. It's designed to be simpler and easier to use than other popular software/services like Stable Diffusion or Midjourney. Fooocus is based on Gradio, a framework that allows developers to quickly build web interface for any machine learning model.

Here's a breakdown of its key features:

Focus on Prompting:

Simplified Workflow:

Community and Development:

Here are some potential downsides to consider:

Fooocus vs Midjourney

The biggest difference between Fooocus and Midjourney is Fooocus is open source, thus it's free and you can generate as many images as you want to. Here's a quick comparison table:

Aspect Fooocus Midjourney
Description A project focused on prompting and generating with AI. An independent research lab working on various AI projects.
License GPL-3.0 license (free and copyleft). Freemium
GitHub Popularity 29.2k stars, 3.2k forks. Not specified.
Open Source Yes No

In terms of features, despite its simple web-based interface (generated by Gradio), Fooocus has pretty much all the major functions you might expect:

Midjourney Fooocus
V1 V2 V3 V4 Image Variations Supported via Input Image -> Upscale or Variation -> Vary
U1 U2 U3 U4 Upscaling Up to 2x upscale via Input Image -> Upscale
Inpainting Supported via Input Image -> Inpaint or Outpaint
Image Prompt Supported via Input Image -> Image Prompt
--style parameter Advanced -> Style
Stylize Advanced -> Guidance
niji 5 Styles run_anime.bat launcher for anime style
--quality parameter Advanced -> Quality
--repeat parameter Advanced -> Image Number
Multi Prompts Simply input prompts in multiple lines
Prompt Weights Similar syntax "I am (happy:1.5)".
Negative Prompt Supported via Advanced -> Negative Prompt
Aspect Ratio (--ar) Supported via Advanced -> Aspect Ratios
InsightFace FaceSwap
/describe command Supported via Input Image -> Describe

System Requirements

Below is the minimal requirements for running Fooocus locally. If your device capability is lower than these spec, you may not be able to use Fooocus. In this case, running Fooocus in Google Colab is your only choice if you want to fiddle with the program.

Operating System GPU Minimal GPU Memory Minimal System Memory System Swap Note
Windows/Linux Nvidia RTX 4XXX 4GB 8GB Required fastest
Windows/Linux Nvidia RTX 3XXX 4GB 8GB Required usually faster than RTX 2XXX
Windows/Linux Nvidia RTX 2XXX 4GB 8GB Required usually faster than GTX 1XXX
Windows/Linux Nvidia GTX 1XXX 8GB (* 6GB uncertain) 8GB Required only marginally faster than CPU
Windows/Linux Nvidia GTX 9XX 8GB 8GB Required faster or slower than CPU
Windows/Linux Nvidia GTX < 9XX Not supported / / /
Windows AMD GPU 8GB (updated 2023 Dec 30) 8GB Required via DirectML (* ROCm is on hold), about 3x slower than Nvidia RTX 3XXX
Linux AMD GPU 8GB 8GB Required via ROCm, about 1.5x slower than Nvidia RTX 3XXX
Mac M1/M2 MPS Shared Shared Shared about 9x slower than Nvidia RTX 3XXX
Windows/Linux/Mac only use CPU 0GB 32GB Required about 17x slower than Nvidia RTX 3XXX

How to install

Windows

  1. Download Fooocus V2 from the release page. The current version is Fooocus_win64_2-1-831 based on CUDA 12 and Pytorch2.1. If you have an older device, you might want to use the previous_old_xformers_env.7z patch. This will update your system to use CUDA version 11.8 and PyTorch version 2.0, while keeping an older version of xformers.
  2. Run one of the following files to launch Fooocus: run.bat, run_anime.bat or run_realistic.bat. The filename implies which image style you want to generate.
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
  1. Access the web interface at the local URL provided in the command line (usually http://127.0.0.1:7865/). You can also access it from the other computer using public URL provided (https://xxxxxx.gradio.live)
  2. Please do note that the very first time you run Fooocus, it will download default models (and inpaint control model), which might take a few . If you encounter error messages or the web interface does nothing, see fixes for common problems here.

Linux using Anaconda/Miniconda

  1. Install git and anaconda. If you don't have Anaconda installed, download and install it from the Anaconda Distribution page.
  2. Clone Fooocus Repository: Assuming git is already installed on your system, clone the Fooocus repository using the following command:
    git clone https://github.com/lllyasviel/Fooocus.git
    
  3. Navigate to the Fooocus directory and create environment based on pre-defined YAML config:
    conda env create -f environment.yaml
    
  4. Activate fooocus environment (the name is taken from the YAML config) and install required packages.
    conda activate fooocus
    pip install -r requirements_versions.txt
    
  5. Run the launcher and let it download all the models automatically
    python entry_with_update.py
    
  6. If you want to generate "anime" or "realistic" style images, run either python entry_with_update.py --preset anime or python entry_with_update.py --preset realistic.

Fooocus in Colab

  1. Open In Colab Click on this button to open the pre-made Fooocus Jupyter Notebook.
  2. Click Connect at the upper right corner. Connect to Colab
  3. Once connected to the "core" of Google Colab, click the "play" button in the left side of the code snippet. Run Fooocus code snippet
  4. You will see a public gradio.live URL in the terminal output. Open this URL and you can begin fiddling with Fooocus. Fooocus Colab public URL

This unofficial site was set up to provide a reliable place to gather resources about Foooocus, as well as to provide easy access to documentation.

FAQ

Does Fooocus work offline?

Yes, Fooocus works completely offline against a local trained model. However, you might need an internet connection at the very first launch to download the models from HuggingFace.

How can I create the best Fooocus prompt?

You don't need to do that. Fooocus already had a GPT2 model to automatically expand and correct your prompts so that the model produces high quality images.

Fooocus V2 vs V1 difference?

Fooocus V2 has a completely new prompt engine built with GPT2, which offer support for many more styles without spending time building complex prompts (View more details)

Does Fooocus support multiple GPU?

Not yet. mashb1t (one of the major developers) answered in (issue #292)

Best prompt for Fooocus?

As mentioned earlier, Fooocus V2 automatically expand your prompt with the help of GPT2. Even a short prompt like “a boy” is auto-optimized at the moment you click Generate, so I believe it is not necessary to look for the best one.