[Tutorial] Introducing Fooocus: Simplified Image Generation for Everyone
Fooocus, an innovative image generating software built upon Gradio, brings a fresh approach to Stable Diffusion and Midjourney's designs. It merges the best of both worlds, offering an offline, open-source, and free platform while eliminating the need for manual tweaking, allowing users to focus solely on prompts and images.
One of Fooocus's standout features is its streamlined user experience. It incorporates numerous inner optimizations and quality improvements, relieving users of the burden of complex technical parameters. Instead, it fosters seamless interaction between humans and computers, making image generation an enjoyable endeavor.
Installation of Fooocus has been simplified significantly. With just a few clicks between downloading the software and generating the first image, users can dive right into the creative process. The software demands minimal GPU memory (4GB Nvidia) and is readily available for Windows users.
How to Get Started with Fooocus
Downloading Fooocus
Windows users can easily download Fooocus by clicking here, then following these simple steps:
- Download the file and unzip it.
- Run the "run.bat" file.
Upon the first launch, Fooocus will automatically download default models to the specified folders, catering to various presets. For users employing inpainting features, the software will download its own inpaint control model.
Enhancing Installation Efficiency
For those who already possess the necessary files, accelerating the installation process is feasible by copying them to the designated locations within the software.
Troubleshooting
If encountering errors such as "MetadataIncompleteBuffer" or "PytorchStreamReader" it's likely that the model files are corrupted. In such cases, redownloading the models is recommended.
Performance Insights
On a 16GB RAM, 6GB VRAM (Nvidia 3060 laptop), Fooocus operates at approximately 1.35 seconds per iteration, showcasing impressive speed, especially considering the affordability of laptops equipped with a 3060 GPU.
Additionally, it's worth noting that some reports indicate Nvidia driver versions above 532 may cause a tenfold reduction in performance compared to version 531. Users experiencing extended generation times might benefit from reverting to Nvidia Driver 531 Laptop or Nvidia Driver 531 Desktop.System Requirements
Fooocus mandates a minimum of 4GB Nvidia GPU memory and 8GB system memory. In most cases, Microsoft’s Virtual Swap technique is automatically enabled in Windows installations, eliminating the need for manual configurations.
Colab Setup (Last tested - 2023 Dec 12)
In Colab, modify the last line to execute Fooocus Default, Anime, or Realistic Edition:
!python entry_with_update.py --share or !python entry_with_update.py --preset anime --share or !python entry_with_update.py --preset realistic --share
Please note, the Colab version disables the refiner by default due to resource limitations but guarantees basic text-to-image functionality.
Linux (Anaconda/Miniconda)
For Anaconda/Miniconda users:
git clone https://github.com/lllyasviel/Fooocus.git
cd Fooocus
conda env create -f environment.yaml
conda activate fooocus
pip install -r requirements_versions.txt
Download default models to "Fooocus\models\checkpoints" or let Fooocus automatically handle the downloads using the launcher:
conda activate fooocus
python entry_with_update.py
Or, if you want to open a remote port, use:
conda activate fooocus
python entry_with_update.py --listen
Use python entry_with_update.py --preset anime or python entry_with_update.py --preset realistic for Fooocus Anime/Realistic Edition.
Linux (Python Venv)
Your Linux needs to have Python 3.10 installed, and let's say your Python can be called with the command python3 with your venv system working; you can:
git clone https://github.com/lllyasviel/Fooocus.git
cd Fooocus
python3 -m venv fooocus_env
source fooocus_env/bin/activate
pip install -r requirements_versions.txt
See the above sections for model downloads. You can launch the software with:
source fooocus_env/bin/activate
python entry_with_update.py
Or, if you want to open a remote port, use
source fooocus_env/bin/activate
python entry_with_update.py --listen
Use python entry_with_update.py --preset anime or python entry_with_update.py --preset realistic for Fooocus Anime/Realistic Edition.
Linux (Native System Python)
git clone https://github.com/lllyasviel/Fooocus.git
cd Fooocus
pip3 install -r requirements_versions.txt
See the above sections for model downloads. You can launch the software with:
python3 entry_with_update.py
Or, if you want to open a remote port, use
python3 entry_with_update.py --listen
Use python entry_with_update.py --preset anime or python entry_with_update.py --preset realistic for Fooocus Anime/Realistic Edition.
Linux (AMD GPUs)
Requirements vary for different platforms. Modify the torch package for AMD:
Same with the above instructions. You need to change torch to the AMD version
pip uninstall torch torchvision torchaudio torchtext functorch xformers
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.6
AMD is not intensively tested, however. The AMD support is in beta.
Use python entry_with_update.py --preset anime or python entry_with_update.py --preset realistic for Fooocus Anime/Realistic Edition.
Windows (AMD GPUs)
Windows users with AMD GPUs can follow similar steps as Windows users with other configurations but adapt the content of the run.bat file accordingly.
.\python_embeded\python.exe -m pip uninstall torch torchvision torchaudio torchtext functorch xformers -y
.\python_embeded\python.exe -m pip install torch-directml
.\python_embeded\python.exe -s Fooocus\entry_with_update.py --directml
pause
Then run the run.bat.
AMD is not intensively tested, however. The AMD support is in beta.
For AMD, use .\python_embeded\python.exe entry_with_update.py --directml --preset anime or .\python_embeded\python.exe entry_with_update.py --directml --preset realistic for Fooocus Anime/Realistic Edition.
Mac Setup
For Mac users (M1 or M2), here's an unofficial guideline:
- Install the conda package manager and pytorch nightly. Read the Accelerated PyTorch training on Mac Apple Developer guide for instructions. Make sure pytorch recognizes your MPS device.
- Open the macOS Terminal app and clone this repository with git clone https://github.com/lllyasviel/Fooocus.git.
- Change to the new Fooocus directory, cd Fooocus.
- Create a new conda environment, conda env create -f environment.yaml.
- Activate your new conda environment, conda activate fooocus.
- Install the packages required by Fooocus, pip install -r requirements_versions.txt.
- Launch Fooocus by running python entry_with_update.py. (Some Mac M2 users may need python entry_with_update.py --disable-offload-from-vram to speed up model loading/unloading.) The first time you run Fooocus, it will automatically download the Stable Diffusion SDXL models and will take a significant amount of time, depending on your internet connection.





Comments
Post a Comment
Leave your comment here...