Upload 29 files
Browse files- .dockerignore +54 -0
- .gitattributes +3 -58
- .gitignore +55 -0
- Dockerfile +29 -0
- LICENSE +674 -0
- args_manager.py +61 -0
- auth-example.json +6 -0
- build_launcher.py +26 -0
- development.md +11 -0
- docker-compose.yml +36 -0
- docker.md +131 -0
- entry_with_update.py +46 -0
- entrypoint.sh +33 -0
- environment.yaml +7 -0
- experiments_expansion.py +8 -0
- experiments_face.py +7 -0
- experiments_interrogate.py +8 -0
- experiments_mask_generation.py +24 -0
- fooocus_colab.ipynb +35 -0
- fooocus_version.py +1 -0
- launch.py +152 -0
- notification-example.mp3 +0 -0
- readme.md +486 -0
- requirements_docker.txt +2 -0
- requirements_versions.txt +24 -0
- shared.py +1 -0
- troubleshoot.md +178 -0
- update_log.md +750 -0
- webui.py +1128 -0
.dockerignore
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
__pycache__
|
2 |
+
*.ckpt
|
3 |
+
*.safetensors
|
4 |
+
*.pth
|
5 |
+
*.pt
|
6 |
+
*.bin
|
7 |
+
*.patch
|
8 |
+
*.backup
|
9 |
+
*.corrupted
|
10 |
+
*.partial
|
11 |
+
*.onnx
|
12 |
+
sorted_styles.json
|
13 |
+
/input
|
14 |
+
/cache
|
15 |
+
/language/default.json
|
16 |
+
/test_imgs
|
17 |
+
config.txt
|
18 |
+
config_modification_tutorial.txt
|
19 |
+
user_path_config.txt
|
20 |
+
user_path_config-deprecated.txt
|
21 |
+
/modules/*.png
|
22 |
+
/repositories
|
23 |
+
/fooocus_env
|
24 |
+
/venv
|
25 |
+
/tmp
|
26 |
+
/ui-config.json
|
27 |
+
/outputs
|
28 |
+
/config.json
|
29 |
+
/log
|
30 |
+
/webui.settings.bat
|
31 |
+
/embeddings
|
32 |
+
/styles.csv
|
33 |
+
/params.txt
|
34 |
+
/styles.csv.bak
|
35 |
+
/webui-user.bat
|
36 |
+
/webui-user.sh
|
37 |
+
/interrogate
|
38 |
+
/user.css
|
39 |
+
/.idea
|
40 |
+
/notification.ogg
|
41 |
+
/notification.mp3
|
42 |
+
/SwinIR
|
43 |
+
/textual_inversion
|
44 |
+
.vscode
|
45 |
+
/extensions
|
46 |
+
/test/stdout.txt
|
47 |
+
/test/stderr.txt
|
48 |
+
/cache.json*
|
49 |
+
/config_states/
|
50 |
+
/node_modules
|
51 |
+
/package-lock.json
|
52 |
+
/.coverage*
|
53 |
+
/auth.json
|
54 |
+
.DS_Store
|
.gitattributes
CHANGED
@@ -1,58 +1,3 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
*.
|
4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
-
*.lz4 filter=lfs diff=lfs merge=lfs -text
|
12 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
13 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
14 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
15 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
16 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
17 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
18 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
19 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
20 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
21 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
22 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
23 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
24 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
25 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
26 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
27 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
28 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
29 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
30 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
31 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
32 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
33 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
34 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
35 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
36 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
37 |
-
# Audio files - uncompressed
|
38 |
-
*.pcm filter=lfs diff=lfs merge=lfs -text
|
39 |
-
*.sam filter=lfs diff=lfs merge=lfs -text
|
40 |
-
*.raw filter=lfs diff=lfs merge=lfs -text
|
41 |
-
# Audio files - compressed
|
42 |
-
*.aac filter=lfs diff=lfs merge=lfs -text
|
43 |
-
*.flac filter=lfs diff=lfs merge=lfs -text
|
44 |
-
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
45 |
-
*.ogg filter=lfs diff=lfs merge=lfs -text
|
46 |
-
*.wav filter=lfs diff=lfs merge=lfs -text
|
47 |
-
# Image files - uncompressed
|
48 |
-
*.bmp filter=lfs diff=lfs merge=lfs -text
|
49 |
-
*.gif filter=lfs diff=lfs merge=lfs -text
|
50 |
-
*.png filter=lfs diff=lfs merge=lfs -text
|
51 |
-
*.tiff filter=lfs diff=lfs merge=lfs -text
|
52 |
-
# Image files - compressed
|
53 |
-
*.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
-
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
-
*.webp filter=lfs diff=lfs merge=lfs -text
|
56 |
-
# Video files - compressed
|
57 |
-
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
58 |
-
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
1 |
+
# Ensure that shell scripts always use lf line endings, e.g. entrypoint.sh for docker
|
2 |
+
* text=auto
|
3 |
+
*.sh text eol=lf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.gitignore
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
__pycache__
|
2 |
+
*.ckpt
|
3 |
+
*.safetensors
|
4 |
+
*.pth
|
5 |
+
*.pt
|
6 |
+
*.bin
|
7 |
+
*.patch
|
8 |
+
*.backup
|
9 |
+
*.corrupted
|
10 |
+
*.partial
|
11 |
+
*.onnx
|
12 |
+
sorted_styles.json
|
13 |
+
hash_cache.txt
|
14 |
+
/input
|
15 |
+
/cache
|
16 |
+
/language/default.json
|
17 |
+
/test_imgs
|
18 |
+
config.txt
|
19 |
+
config_modification_tutorial.txt
|
20 |
+
user_path_config.txt
|
21 |
+
user_path_config-deprecated.txt
|
22 |
+
/modules/*.png
|
23 |
+
/repositories
|
24 |
+
/fooocus_env
|
25 |
+
/venv
|
26 |
+
/tmp
|
27 |
+
/ui-config.json
|
28 |
+
/outputs
|
29 |
+
/config.json
|
30 |
+
/log
|
31 |
+
/webui.settings.bat
|
32 |
+
/embeddings
|
33 |
+
/styles.csv
|
34 |
+
/params.txt
|
35 |
+
/styles.csv.bak
|
36 |
+
/webui-user.bat
|
37 |
+
/webui-user.sh
|
38 |
+
/interrogate
|
39 |
+
/user.css
|
40 |
+
/.idea
|
41 |
+
/notification.ogg
|
42 |
+
/notification.mp3
|
43 |
+
/SwinIR
|
44 |
+
/textual_inversion
|
45 |
+
.vscode
|
46 |
+
/extensions
|
47 |
+
/test/stdout.txt
|
48 |
+
/test/stderr.txt
|
49 |
+
/cache.json*
|
50 |
+
/config_states/
|
51 |
+
/node_modules
|
52 |
+
/package-lock.json
|
53 |
+
/.coverage*
|
54 |
+
/auth.json
|
55 |
+
.DS_Store
|
Dockerfile
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM nvidia/cuda:12.4.1-base-ubuntu22.04
|
2 |
+
ENV DEBIAN_FRONTEND noninteractive
|
3 |
+
ENV CMDARGS --listen
|
4 |
+
|
5 |
+
RUN apt-get update -y && \
|
6 |
+
apt-get install -y curl libgl1 libglib2.0-0 python3-pip python-is-python3 git && \
|
7 |
+
apt-get clean && \
|
8 |
+
rm -rf /var/lib/apt/lists/*
|
9 |
+
|
10 |
+
COPY requirements_docker.txt requirements_versions.txt /tmp/
|
11 |
+
RUN pip install --no-cache-dir -r /tmp/requirements_docker.txt -r /tmp/requirements_versions.txt && \
|
12 |
+
rm -f /tmp/requirements_docker.txt /tmp/requirements_versions.txt
|
13 |
+
RUN pip install --no-cache-dir xformers==0.0.23 --no-dependencies
|
14 |
+
RUN curl -fsL -o /usr/local/lib/python3.10/dist-packages/gradio/frpc_linux_amd64_v0.2 https://cdn-media.huggingface.co/frpc-gradio-0.2/frpc_linux_amd64 && \
|
15 |
+
chmod +x /usr/local/lib/python3.10/dist-packages/gradio/frpc_linux_amd64_v0.2
|
16 |
+
|
17 |
+
RUN adduser --disabled-password --gecos '' user && \
|
18 |
+
mkdir -p /content/app /content/data
|
19 |
+
|
20 |
+
COPY entrypoint.sh /content/
|
21 |
+
RUN chown -R user:user /content
|
22 |
+
|
23 |
+
WORKDIR /content
|
24 |
+
USER user
|
25 |
+
|
26 |
+
COPY --chown=user:user . /content/app
|
27 |
+
RUN mv /content/app/models /content/app/models.org
|
28 |
+
|
29 |
+
CMD [ "sh", "-c", "/content/entrypoint.sh ${CMDARGS}" ]
|
LICENSE
ADDED
@@ -0,0 +1,674 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 29 June 2007
|
3 |
+
|
4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
6 |
+
of this license document, but changing it is not allowed.
|
7 |
+
|
8 |
+
Preamble
|
9 |
+
|
10 |
+
The GNU General Public License is a free, copyleft license for
|
11 |
+
software and other kinds of works.
|
12 |
+
|
13 |
+
The licenses for most software and other practical works are designed
|
14 |
+
to take away your freedom to share and change the works. By contrast,
|
15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
16 |
+
share and change all versions of a program--to make sure it remains free
|
17 |
+
software for all its users. We, the Free Software Foundation, use the
|
18 |
+
GNU General Public License for most of our software; it applies also to
|
19 |
+
any other work released this way by its authors. You can apply it to
|
20 |
+
your programs, too.
|
21 |
+
|
22 |
+
When we speak of free software, we are referring to freedom, not
|
23 |
+
price. Our General Public Licenses are designed to make sure that you
|
24 |
+
have the freedom to distribute copies of free software (and charge for
|
25 |
+
them if you wish), that you receive source code or can get it if you
|
26 |
+
want it, that you can change the software or use pieces of it in new
|
27 |
+
free programs, and that you know you can do these things.
|
28 |
+
|
29 |
+
To protect your rights, we need to prevent others from denying you
|
30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
+
certain responsibilities if you distribute copies of the software, or if
|
32 |
+
you modify it: responsibilities to respect the freedom of others.
|
33 |
+
|
34 |
+
For example, if you distribute copies of such a program, whether
|
35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
36 |
+
freedoms that you received. You must make sure that they, too, receive
|
37 |
+
or can get the source code. And you must show them these terms so they
|
38 |
+
know their rights.
|
39 |
+
|
40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
43 |
+
|
44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
45 |
+
that there is no warranty for this free software. For both users' and
|
46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
47 |
+
changed, so that their problems will not be attributed erroneously to
|
48 |
+
authors of previous versions.
|
49 |
+
|
50 |
+
Some devices are designed to deny users access to install or run
|
51 |
+
modified versions of the software inside them, although the manufacturer
|
52 |
+
can do so. This is fundamentally incompatible with the aim of
|
53 |
+
protecting users' freedom to change the software. The systematic
|
54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
+
have designed this version of the GPL to prohibit the practice for those
|
57 |
+
products. If such problems arise substantially in other domains, we
|
58 |
+
stand ready to extend this provision to those domains in future versions
|
59 |
+
of the GPL, as needed to protect the freedom of users.
|
60 |
+
|
61 |
+
Finally, every program is threatened constantly by software patents.
|
62 |
+
States should not allow patents to restrict development and use of
|
63 |
+
software on general-purpose computers, but in those that do, we wish to
|
64 |
+
avoid the special danger that patents applied to a free program could
|
65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
+
patents cannot be used to render the program non-free.
|
67 |
+
|
68 |
+
The precise terms and conditions for copying, distribution and
|
69 |
+
modification follow.
|
70 |
+
|
71 |
+
TERMS AND CONDITIONS
|
72 |
+
|
73 |
+
0. Definitions.
|
74 |
+
|
75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
76 |
+
|
77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
+
works, such as semiconductor masks.
|
79 |
+
|
80 |
+
"The Program" refers to any copyrightable work licensed under this
|
81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
+
"recipients" may be individuals or organizations.
|
83 |
+
|
84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
+
in a fashion requiring copyright permission, other than the making of an
|
86 |
+
exact copy. The resulting work is called a "modified version" of the
|
87 |
+
earlier work or a work "based on" the earlier work.
|
88 |
+
|
89 |
+
A "covered work" means either the unmodified Program or a work based
|
90 |
+
on the Program.
|
91 |
+
|
92 |
+
To "propagate" a work means to do anything with it that, without
|
93 |
+
permission, would make you directly or secondarily liable for
|
94 |
+
infringement under applicable copyright law, except executing it on a
|
95 |
+
computer or modifying a private copy. Propagation includes copying,
|
96 |
+
distribution (with or without modification), making available to the
|
97 |
+
public, and in some countries other activities as well.
|
98 |
+
|
99 |
+
To "convey" a work means any kind of propagation that enables other
|
100 |
+
parties to make or receive copies. Mere interaction with a user through
|
101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
102 |
+
|
103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
+
to the extent that it includes a convenient and prominently visible
|
105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
+
tells the user that there is no warranty for the work (except to the
|
107 |
+
extent that warranties are provided), that licensees may convey the
|
108 |
+
work under this License, and how to view a copy of this License. If
|
109 |
+
the interface presents a list of user commands or options, such as a
|
110 |
+
menu, a prominent item in the list meets this criterion.
|
111 |
+
|
112 |
+
1. Source Code.
|
113 |
+
|
114 |
+
The "source code" for a work means the preferred form of the work
|
115 |
+
for making modifications to it. "Object code" means any non-source
|
116 |
+
form of a work.
|
117 |
+
|
118 |
+
A "Standard Interface" means an interface that either is an official
|
119 |
+
standard defined by a recognized standards body, or, in the case of
|
120 |
+
interfaces specified for a particular programming language, one that
|
121 |
+
is widely used among developers working in that language.
|
122 |
+
|
123 |
+
The "System Libraries" of an executable work include anything, other
|
124 |
+
than the work as a whole, that (a) is included in the normal form of
|
125 |
+
packaging a Major Component, but which is not part of that Major
|
126 |
+
Component, and (b) serves only to enable use of the work with that
|
127 |
+
Major Component, or to implement a Standard Interface for which an
|
128 |
+
implementation is available to the public in source code form. A
|
129 |
+
"Major Component", in this context, means a major essential component
|
130 |
+
(kernel, window system, and so on) of the specific operating system
|
131 |
+
(if any) on which the executable work runs, or a compiler used to
|
132 |
+
produce the work, or an object code interpreter used to run it.
|
133 |
+
|
134 |
+
The "Corresponding Source" for a work in object code form means all
|
135 |
+
the source code needed to generate, install, and (for an executable
|
136 |
+
work) run the object code and to modify the work, including scripts to
|
137 |
+
control those activities. However, it does not include the work's
|
138 |
+
System Libraries, or general-purpose tools or generally available free
|
139 |
+
programs which are used unmodified in performing those activities but
|
140 |
+
which are not part of the work. For example, Corresponding Source
|
141 |
+
includes interface definition files associated with source files for
|
142 |
+
the work, and the source code for shared libraries and dynamically
|
143 |
+
linked subprograms that the work is specifically designed to require,
|
144 |
+
such as by intimate data communication or control flow between those
|
145 |
+
subprograms and other parts of the work.
|
146 |
+
|
147 |
+
The Corresponding Source need not include anything that users
|
148 |
+
can regenerate automatically from other parts of the Corresponding
|
149 |
+
Source.
|
150 |
+
|
151 |
+
The Corresponding Source for a work in source code form is that
|
152 |
+
same work.
|
153 |
+
|
154 |
+
2. Basic Permissions.
|
155 |
+
|
156 |
+
All rights granted under this License are granted for the term of
|
157 |
+
copyright on the Program, and are irrevocable provided the stated
|
158 |
+
conditions are met. This License explicitly affirms your unlimited
|
159 |
+
permission to run the unmodified Program. The output from running a
|
160 |
+
covered work is covered by this License only if the output, given its
|
161 |
+
content, constitutes a covered work. This License acknowledges your
|
162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
+
|
164 |
+
You may make, run and propagate covered works that you do not
|
165 |
+
convey, without conditions so long as your license otherwise remains
|
166 |
+
in force. You may convey covered works to others for the sole purpose
|
167 |
+
of having them make modifications exclusively for you, or provide you
|
168 |
+
with facilities for running those works, provided that you comply with
|
169 |
+
the terms of this License in conveying all material for which you do
|
170 |
+
not control copyright. Those thus making or running the covered works
|
171 |
+
for you must do so exclusively on your behalf, under your direction
|
172 |
+
and control, on terms that prohibit them from making any copies of
|
173 |
+
your copyrighted material outside their relationship with you.
|
174 |
+
|
175 |
+
Conveying under any other circumstances is permitted solely under
|
176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
+
makes it unnecessary.
|
178 |
+
|
179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
+
|
181 |
+
No covered work shall be deemed part of an effective technological
|
182 |
+
measure under any applicable law fulfilling obligations under article
|
183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
+
similar laws prohibiting or restricting circumvention of such
|
185 |
+
measures.
|
186 |
+
|
187 |
+
When you convey a covered work, you waive any legal power to forbid
|
188 |
+
circumvention of technological measures to the extent such circumvention
|
189 |
+
is effected by exercising rights under this License with respect to
|
190 |
+
the covered work, and you disclaim any intention to limit operation or
|
191 |
+
modification of the work as a means of enforcing, against the work's
|
192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
193 |
+
technological measures.
|
194 |
+
|
195 |
+
4. Conveying Verbatim Copies.
|
196 |
+
|
197 |
+
You may convey verbatim copies of the Program's source code as you
|
198 |
+
receive it, in any medium, provided that you conspicuously and
|
199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
200 |
+
keep intact all notices stating that this License and any
|
201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
+
keep intact all notices of the absence of any warranty; and give all
|
203 |
+
recipients a copy of this License along with the Program.
|
204 |
+
|
205 |
+
You may charge any price or no price for each copy that you convey,
|
206 |
+
and you may offer support or warranty protection for a fee.
|
207 |
+
|
208 |
+
5. Conveying Modified Source Versions.
|
209 |
+
|
210 |
+
You may convey a work based on the Program, or the modifications to
|
211 |
+
produce it from the Program, in the form of source code under the
|
212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
213 |
+
|
214 |
+
a) The work must carry prominent notices stating that you modified
|
215 |
+
it, and giving a relevant date.
|
216 |
+
|
217 |
+
b) The work must carry prominent notices stating that it is
|
218 |
+
released under this License and any conditions added under section
|
219 |
+
7. This requirement modifies the requirement in section 4 to
|
220 |
+
"keep intact all notices".
|
221 |
+
|
222 |
+
c) You must license the entire work, as a whole, under this
|
223 |
+
License to anyone who comes into possession of a copy. This
|
224 |
+
License will therefore apply, along with any applicable section 7
|
225 |
+
additional terms, to the whole of the work, and all its parts,
|
226 |
+
regardless of how they are packaged. This License gives no
|
227 |
+
permission to license the work in any other way, but it does not
|
228 |
+
invalidate such permission if you have separately received it.
|
229 |
+
|
230 |
+
d) If the work has interactive user interfaces, each must display
|
231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
233 |
+
work need not make them do so.
|
234 |
+
|
235 |
+
A compilation of a covered work with other separate and independent
|
236 |
+
works, which are not by their nature extensions of the covered work,
|
237 |
+
and which are not combined with it such as to form a larger program,
|
238 |
+
in or on a volume of a storage or distribution medium, is called an
|
239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
240 |
+
used to limit the access or legal rights of the compilation's users
|
241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
242 |
+
in an aggregate does not cause this License to apply to the other
|
243 |
+
parts of the aggregate.
|
244 |
+
|
245 |
+
6. Conveying Non-Source Forms.
|
246 |
+
|
247 |
+
You may convey a covered work in object code form under the terms
|
248 |
+
of sections 4 and 5, provided that you also convey the
|
249 |
+
machine-readable Corresponding Source under the terms of this License,
|
250 |
+
in one of these ways:
|
251 |
+
|
252 |
+
a) Convey the object code in, or embodied in, a physical product
|
253 |
+
(including a physical distribution medium), accompanied by the
|
254 |
+
Corresponding Source fixed on a durable physical medium
|
255 |
+
customarily used for software interchange.
|
256 |
+
|
257 |
+
b) Convey the object code in, or embodied in, a physical product
|
258 |
+
(including a physical distribution medium), accompanied by a
|
259 |
+
written offer, valid for at least three years and valid for as
|
260 |
+
long as you offer spare parts or customer support for that product
|
261 |
+
model, to give anyone who possesses the object code either (1) a
|
262 |
+
copy of the Corresponding Source for all the software in the
|
263 |
+
product that is covered by this License, on a durable physical
|
264 |
+
medium customarily used for software interchange, for a price no
|
265 |
+
more than your reasonable cost of physically performing this
|
266 |
+
conveying of source, or (2) access to copy the
|
267 |
+
Corresponding Source from a network server at no charge.
|
268 |
+
|
269 |
+
c) Convey individual copies of the object code with a copy of the
|
270 |
+
written offer to provide the Corresponding Source. This
|
271 |
+
alternative is allowed only occasionally and noncommercially, and
|
272 |
+
only if you received the object code with such an offer, in accord
|
273 |
+
with subsection 6b.
|
274 |
+
|
275 |
+
d) Convey the object code by offering access from a designated
|
276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
277 |
+
Corresponding Source in the same way through the same place at no
|
278 |
+
further charge. You need not require recipients to copy the
|
279 |
+
Corresponding Source along with the object code. If the place to
|
280 |
+
copy the object code is a network server, the Corresponding Source
|
281 |
+
may be on a different server (operated by you or a third party)
|
282 |
+
that supports equivalent copying facilities, provided you maintain
|
283 |
+
clear directions next to the object code saying where to find the
|
284 |
+
Corresponding Source. Regardless of what server hosts the
|
285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
286 |
+
available for as long as needed to satisfy these requirements.
|
287 |
+
|
288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
+
you inform other peers where the object code and Corresponding
|
290 |
+
Source of the work are being offered to the general public at no
|
291 |
+
charge under subsection 6d.
|
292 |
+
|
293 |
+
A separable portion of the object code, whose source code is excluded
|
294 |
+
from the Corresponding Source as a System Library, need not be
|
295 |
+
included in conveying the object code work.
|
296 |
+
|
297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
298 |
+
tangible personal property which is normally used for personal, family,
|
299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
+
product received by a particular user, "normally used" refers to a
|
303 |
+
typical or common use of that class of product, regardless of the status
|
304 |
+
of the particular user or of the way in which the particular user
|
305 |
+
actually uses, or expects or is expected to use, the product. A product
|
306 |
+
is a consumer product regardless of whether the product has substantial
|
307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
+
the only significant mode of use of the product.
|
309 |
+
|
310 |
+
"Installation Information" for a User Product means any methods,
|
311 |
+
procedures, authorization keys, or other information required to install
|
312 |
+
and execute modified versions of a covered work in that User Product from
|
313 |
+
a modified version of its Corresponding Source. The information must
|
314 |
+
suffice to ensure that the continued functioning of the modified object
|
315 |
+
code is in no case prevented or interfered with solely because
|
316 |
+
modification has been made.
|
317 |
+
|
318 |
+
If you convey an object code work under this section in, or with, or
|
319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
320 |
+
part of a transaction in which the right of possession and use of the
|
321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
322 |
+
fixed term (regardless of how the transaction is characterized), the
|
323 |
+
Corresponding Source conveyed under this section must be accompanied
|
324 |
+
by the Installation Information. But this requirement does not apply
|
325 |
+
if neither you nor any third party retains the ability to install
|
326 |
+
modified object code on the User Product (for example, the work has
|
327 |
+
been installed in ROM).
|
328 |
+
|
329 |
+
The requirement to provide Installation Information does not include a
|
330 |
+
requirement to continue to provide support service, warranty, or updates
|
331 |
+
for a work that has been modified or installed by the recipient, or for
|
332 |
+
the User Product in which it has been modified or installed. Access to a
|
333 |
+
network may be denied when the modification itself materially and
|
334 |
+
adversely affects the operation of the network or violates the rules and
|
335 |
+
protocols for communication across the network.
|
336 |
+
|
337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
338 |
+
in accord with this section must be in a format that is publicly
|
339 |
+
documented (and with an implementation available to the public in
|
340 |
+
source code form), and must require no special password or key for
|
341 |
+
unpacking, reading or copying.
|
342 |
+
|
343 |
+
7. Additional Terms.
|
344 |
+
|
345 |
+
"Additional permissions" are terms that supplement the terms of this
|
346 |
+
License by making exceptions from one or more of its conditions.
|
347 |
+
Additional permissions that are applicable to the entire Program shall
|
348 |
+
be treated as though they were included in this License, to the extent
|
349 |
+
that they are valid under applicable law. If additional permissions
|
350 |
+
apply only to part of the Program, that part may be used separately
|
351 |
+
under those permissions, but the entire Program remains governed by
|
352 |
+
this License without regard to the additional permissions.
|
353 |
+
|
354 |
+
When you convey a copy of a covered work, you may at your option
|
355 |
+
remove any additional permissions from that copy, or from any part of
|
356 |
+
it. (Additional permissions may be written to require their own
|
357 |
+
removal in certain cases when you modify the work.) You may place
|
358 |
+
additional permissions on material, added by you to a covered work,
|
359 |
+
for which you have or can give appropriate copyright permission.
|
360 |
+
|
361 |
+
Notwithstanding any other provision of this License, for material you
|
362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
+
that material) supplement the terms of this License with terms:
|
364 |
+
|
365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
366 |
+
terms of sections 15 and 16 of this License; or
|
367 |
+
|
368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
369 |
+
author attributions in that material or in the Appropriate Legal
|
370 |
+
Notices displayed by works containing it; or
|
371 |
+
|
372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
+
requiring that modified versions of such material be marked in
|
374 |
+
reasonable ways as different from the original version; or
|
375 |
+
|
376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
+
authors of the material; or
|
378 |
+
|
379 |
+
e) Declining to grant rights under trademark law for use of some
|
380 |
+
trade names, trademarks, or service marks; or
|
381 |
+
|
382 |
+
f) Requiring indemnification of licensors and authors of that
|
383 |
+
material by anyone who conveys the material (or modified versions of
|
384 |
+
it) with contractual assumptions of liability to the recipient, for
|
385 |
+
any liability that these contractual assumptions directly impose on
|
386 |
+
those licensors and authors.
|
387 |
+
|
388 |
+
All other non-permissive additional terms are considered "further
|
389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
390 |
+
received it, or any part of it, contains a notice stating that it is
|
391 |
+
governed by this License along with a term that is a further
|
392 |
+
restriction, you may remove that term. If a license document contains
|
393 |
+
a further restriction but permits relicensing or conveying under this
|
394 |
+
License, you may add to a covered work material governed by the terms
|
395 |
+
of that license document, provided that the further restriction does
|
396 |
+
not survive such relicensing or conveying.
|
397 |
+
|
398 |
+
If you add terms to a covered work in accord with this section, you
|
399 |
+
must place, in the relevant source files, a statement of the
|
400 |
+
additional terms that apply to those files, or a notice indicating
|
401 |
+
where to find the applicable terms.
|
402 |
+
|
403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
+
form of a separately written license, or stated as exceptions;
|
405 |
+
the above requirements apply either way.
|
406 |
+
|
407 |
+
8. Termination.
|
408 |
+
|
409 |
+
You may not propagate or modify a covered work except as expressly
|
410 |
+
provided under this License. Any attempt otherwise to propagate or
|
411 |
+
modify it is void, and will automatically terminate your rights under
|
412 |
+
this License (including any patent licenses granted under the third
|
413 |
+
paragraph of section 11).
|
414 |
+
|
415 |
+
However, if you cease all violation of this License, then your
|
416 |
+
license from a particular copyright holder is reinstated (a)
|
417 |
+
provisionally, unless and until the copyright holder explicitly and
|
418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
419 |
+
holder fails to notify you of the violation by some reasonable means
|
420 |
+
prior to 60 days after the cessation.
|
421 |
+
|
422 |
+
Moreover, your license from a particular copyright holder is
|
423 |
+
reinstated permanently if the copyright holder notifies you of the
|
424 |
+
violation by some reasonable means, this is the first time you have
|
425 |
+
received notice of violation of this License (for any work) from that
|
426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
427 |
+
your receipt of the notice.
|
428 |
+
|
429 |
+
Termination of your rights under this section does not terminate the
|
430 |
+
licenses of parties who have received copies or rights from you under
|
431 |
+
this License. If your rights have been terminated and not permanently
|
432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
433 |
+
material under section 10.
|
434 |
+
|
435 |
+
9. Acceptance Not Required for Having Copies.
|
436 |
+
|
437 |
+
You are not required to accept this License in order to receive or
|
438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
+
to receive a copy likewise does not require acceptance. However,
|
441 |
+
nothing other than this License grants you permission to propagate or
|
442 |
+
modify any covered work. These actions infringe copyright if you do
|
443 |
+
not accept this License. Therefore, by modifying or propagating a
|
444 |
+
covered work, you indicate your acceptance of this License to do so.
|
445 |
+
|
446 |
+
10. Automatic Licensing of Downstream Recipients.
|
447 |
+
|
448 |
+
Each time you convey a covered work, the recipient automatically
|
449 |
+
receives a license from the original licensors, to run, modify and
|
450 |
+
propagate that work, subject to this License. You are not responsible
|
451 |
+
for enforcing compliance by third parties with this License.
|
452 |
+
|
453 |
+
An "entity transaction" is a transaction transferring control of an
|
454 |
+
organization, or substantially all assets of one, or subdividing an
|
455 |
+
organization, or merging organizations. If propagation of a covered
|
456 |
+
work results from an entity transaction, each party to that
|
457 |
+
transaction who receives a copy of the work also receives whatever
|
458 |
+
licenses to the work the party's predecessor in interest had or could
|
459 |
+
give under the previous paragraph, plus a right to possession of the
|
460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
461 |
+
the predecessor has it or can get it with reasonable efforts.
|
462 |
+
|
463 |
+
You may not impose any further restrictions on the exercise of the
|
464 |
+
rights granted or affirmed under this License. For example, you may
|
465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
466 |
+
rights granted under this License, and you may not initiate litigation
|
467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
+
any patent claim is infringed by making, using, selling, offering for
|
469 |
+
sale, or importing the Program or any portion of it.
|
470 |
+
|
471 |
+
11. Patents.
|
472 |
+
|
473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
474 |
+
License of the Program or a work on which the Program is based. The
|
475 |
+
work thus licensed is called the contributor's "contributor version".
|
476 |
+
|
477 |
+
A contributor's "essential patent claims" are all patent claims
|
478 |
+
owned or controlled by the contributor, whether already acquired or
|
479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
+
by this License, of making, using, or selling its contributor version,
|
481 |
+
but do not include claims that would be infringed only as a
|
482 |
+
consequence of further modification of the contributor version. For
|
483 |
+
purposes of this definition, "control" includes the right to grant
|
484 |
+
patent sublicenses in a manner consistent with the requirements of
|
485 |
+
this License.
|
486 |
+
|
487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
+
patent license under the contributor's essential patent claims, to
|
489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
+
propagate the contents of its contributor version.
|
491 |
+
|
492 |
+
In the following three paragraphs, a "patent license" is any express
|
493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
494 |
+
(such as an express permission to practice a patent or covenant not to
|
495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
496 |
+
party means to make such an agreement or commitment not to enforce a
|
497 |
+
patent against the party.
|
498 |
+
|
499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
500 |
+
and the Corresponding Source of the work is not available for anyone
|
501 |
+
to copy, free of charge and under the terms of this License, through a
|
502 |
+
publicly available network server or other readily accessible means,
|
503 |
+
then you must either (1) cause the Corresponding Source to be so
|
504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
506 |
+
consistent with the requirements of this License, to extend the patent
|
507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
508 |
+
actual knowledge that, but for the patent license, your conveying the
|
509 |
+
covered work in a country, or your recipient's use of the covered work
|
510 |
+
in a country, would infringe one or more identifiable patents in that
|
511 |
+
country that you have reason to believe are valid.
|
512 |
+
|
513 |
+
If, pursuant to or in connection with a single transaction or
|
514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
+
covered work, and grant a patent license to some of the parties
|
516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
517 |
+
or convey a specific copy of the covered work, then the patent license
|
518 |
+
you grant is automatically extended to all recipients of the covered
|
519 |
+
work and works based on it.
|
520 |
+
|
521 |
+
A patent license is "discriminatory" if it does not include within
|
522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
524 |
+
specifically granted under this License. You may not convey a covered
|
525 |
+
work if you are a party to an arrangement with a third party that is
|
526 |
+
in the business of distributing software, under which you make payment
|
527 |
+
to the third party based on the extent of your activity of conveying
|
528 |
+
the work, and under which the third party grants, to any of the
|
529 |
+
parties who would receive the covered work from you, a discriminatory
|
530 |
+
patent license (a) in connection with copies of the covered work
|
531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
+
for and in connection with specific products or compilations that
|
533 |
+
contain the covered work, unless you entered into that arrangement,
|
534 |
+
or that patent license was granted, prior to 28 March 2007.
|
535 |
+
|
536 |
+
Nothing in this License shall be construed as excluding or limiting
|
537 |
+
any implied license or other defenses to infringement that may
|
538 |
+
otherwise be available to you under applicable patent law.
|
539 |
+
|
540 |
+
12. No Surrender of Others' Freedom.
|
541 |
+
|
542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
543 |
+
otherwise) that contradict the conditions of this License, they do not
|
544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
546 |
+
License and any other pertinent obligations, then as a consequence you may
|
547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
+
to collect a royalty for further conveying from those to whom you convey
|
549 |
+
the Program, the only way you could satisfy both those terms and this
|
550 |
+
License would be to refrain entirely from conveying the Program.
|
551 |
+
|
552 |
+
13. Use with the GNU Affero General Public License.
|
553 |
+
|
554 |
+
Notwithstanding any other provision of this License, you have
|
555 |
+
permission to link or combine any covered work with a work licensed
|
556 |
+
under version 3 of the GNU Affero General Public License into a single
|
557 |
+
combined work, and to convey the resulting work. The terms of this
|
558 |
+
License will continue to apply to the part which is the covered work,
|
559 |
+
but the special requirements of the GNU Affero General Public License,
|
560 |
+
section 13, concerning interaction through a network will apply to the
|
561 |
+
combination as such.
|
562 |
+
|
563 |
+
14. Revised Versions of this License.
|
564 |
+
|
565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
566 |
+
the GNU General Public License from time to time. Such new versions will
|
567 |
+
be similar in spirit to the present version, but may differ in detail to
|
568 |
+
address new problems or concerns.
|
569 |
+
|
570 |
+
Each version is given a distinguishing version number. If the
|
571 |
+
Program specifies that a certain numbered version of the GNU General
|
572 |
+
Public License "or any later version" applies to it, you have the
|
573 |
+
option of following the terms and conditions either of that numbered
|
574 |
+
version or of any later version published by the Free Software
|
575 |
+
Foundation. If the Program does not specify a version number of the
|
576 |
+
GNU General Public License, you may choose any version ever published
|
577 |
+
by the Free Software Foundation.
|
578 |
+
|
579 |
+
If the Program specifies that a proxy can decide which future
|
580 |
+
versions of the GNU General Public License can be used, that proxy's
|
581 |
+
public statement of acceptance of a version permanently authorizes you
|
582 |
+
to choose that version for the Program.
|
583 |
+
|
584 |
+
Later license versions may give you additional or different
|
585 |
+
permissions. However, no additional obligations are imposed on any
|
586 |
+
author or copyright holder as a result of your choosing to follow a
|
587 |
+
later version.
|
588 |
+
|
589 |
+
15. Disclaimer of Warranty.
|
590 |
+
|
591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
+
|
600 |
+
16. Limitation of Liability.
|
601 |
+
|
602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
+
SUCH DAMAGES.
|
611 |
+
|
612 |
+
17. Interpretation of Sections 15 and 16.
|
613 |
+
|
614 |
+
If the disclaimer of warranty and limitation of liability provided
|
615 |
+
above cannot be given local legal effect according to their terms,
|
616 |
+
reviewing courts shall apply local law that most closely approximates
|
617 |
+
an absolute waiver of all civil liability in connection with the
|
618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
619 |
+
copy of the Program in return for a fee.
|
620 |
+
|
621 |
+
END OF TERMS AND CONDITIONS
|
622 |
+
|
623 |
+
How to Apply These Terms to Your New Programs
|
624 |
+
|
625 |
+
If you develop a new program, and you want it to be of the greatest
|
626 |
+
possible use to the public, the best way to achieve this is to make it
|
627 |
+
free software which everyone can redistribute and change under these terms.
|
628 |
+
|
629 |
+
To do so, attach the following notices to the program. It is safest
|
630 |
+
to attach them to the start of each source file to most effectively
|
631 |
+
state the exclusion of warranty; and each file should have at least
|
632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
633 |
+
|
634 |
+
<one line to give the program's name and a brief idea of what it does.>
|
635 |
+
Copyright (C) <year> <name of author>
|
636 |
+
|
637 |
+
This program is free software: you can redistribute it and/or modify
|
638 |
+
it under the terms of the GNU General Public License as published by
|
639 |
+
the Free Software Foundation, either version 3 of the License, or
|
640 |
+
(at your option) any later version.
|
641 |
+
|
642 |
+
This program is distributed in the hope that it will be useful,
|
643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
+
GNU General Public License for more details.
|
646 |
+
|
647 |
+
You should have received a copy of the GNU General Public License
|
648 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
649 |
+
|
650 |
+
Also add information on how to contact you by electronic and paper mail.
|
651 |
+
|
652 |
+
If the program does terminal interaction, make it output a short
|
653 |
+
notice like this when it starts in an interactive mode:
|
654 |
+
|
655 |
+
<program> Copyright (C) <year> <name of author>
|
656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
+
This is free software, and you are welcome to redistribute it
|
658 |
+
under certain conditions; type `show c' for details.
|
659 |
+
|
660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
+
parts of the General Public License. Of course, your program's commands
|
662 |
+
might be different; for a GUI interface, you would use an "about box".
|
663 |
+
|
664 |
+
You should also get your employer (if you work as a programmer) or school,
|
665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
+
<https://www.gnu.org/licenses/>.
|
668 |
+
|
669 |
+
The GNU General Public License does not permit incorporating your program
|
670 |
+
into proprietary programs. If your program is a subroutine library, you
|
671 |
+
may consider it more useful to permit linking proprietary applications with
|
672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
+
Public License instead of this License. But first, please read
|
674 |
+
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
args_manager.py
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import ldm_patched.modules.args_parser as args_parser
|
2 |
+
|
3 |
+
args_parser.parser.add_argument("--share", action='store_true', help="Set whether to share on Gradio.")
|
4 |
+
|
5 |
+
args_parser.parser.add_argument("--preset", type=str, default=None, help="Apply specified UI preset.")
|
6 |
+
args_parser.parser.add_argument("--disable-preset-selection", action='store_true',
|
7 |
+
help="Disables preset selection in Gradio.")
|
8 |
+
|
9 |
+
args_parser.parser.add_argument("--language", type=str, default='default',
|
10 |
+
help="Translate UI using json files in [language] folder. "
|
11 |
+
"For example, [--language example] will use [language/example.json] for translation.")
|
12 |
+
|
13 |
+
# For example, https://github.com/lllyasviel/Fooocus/issues/849
|
14 |
+
args_parser.parser.add_argument("--disable-offload-from-vram", action="store_true",
|
15 |
+
help="Force loading models to vram when the unload can be avoided. "
|
16 |
+
"Some Mac users may need this.")
|
17 |
+
|
18 |
+
args_parser.parser.add_argument("--theme", type=str, help="launches the UI with light or dark theme", default=None)
|
19 |
+
args_parser.parser.add_argument("--disable-image-log", action='store_true',
|
20 |
+
help="Prevent writing images and logs to the outputs folder.")
|
21 |
+
|
22 |
+
args_parser.parser.add_argument("--disable-analytics", action='store_true',
|
23 |
+
help="Disables analytics for Gradio.")
|
24 |
+
|
25 |
+
args_parser.parser.add_argument("--disable-metadata", action='store_true',
|
26 |
+
help="Disables saving metadata to images.")
|
27 |
+
|
28 |
+
args_parser.parser.add_argument("--disable-preset-download", action='store_true',
|
29 |
+
help="Disables downloading models for presets", default=False)
|
30 |
+
|
31 |
+
args_parser.parser.add_argument("--disable-enhance-output-sorting", action='store_true',
|
32 |
+
help="Disables enhance output sorting for final image gallery.")
|
33 |
+
|
34 |
+
args_parser.parser.add_argument("--enable-auto-describe-image", action='store_true',
|
35 |
+
help="Enables automatic description of uov and enhance image when prompt is empty", default=False)
|
36 |
+
|
37 |
+
args_parser.parser.add_argument("--always-download-new-model", action='store_true',
|
38 |
+
help="Always download newer models", default=False)
|
39 |
+
|
40 |
+
args_parser.parser.add_argument("--rebuild-hash-cache", help="Generates missing model and LoRA hashes.",
|
41 |
+
type=int, nargs="?", metavar="CPU_NUM_THREADS", const=-1)
|
42 |
+
|
43 |
+
args_parser.parser.set_defaults(
|
44 |
+
disable_cuda_malloc=True,
|
45 |
+
in_browser=True,
|
46 |
+
port=None
|
47 |
+
)
|
48 |
+
|
49 |
+
args_parser.args = args_parser.parser.parse_args()
|
50 |
+
|
51 |
+
# (Disable by default because of issues like https://github.com/lllyasviel/Fooocus/issues/724)
|
52 |
+
args_parser.args.always_offload_from_vram = not args_parser.args.disable_offload_from_vram
|
53 |
+
|
54 |
+
if args_parser.args.disable_analytics:
|
55 |
+
import os
|
56 |
+
os.environ["GRADIO_ANALYTICS_ENABLED"] = "False"
|
57 |
+
|
58 |
+
if args_parser.args.disable_in_browser:
|
59 |
+
args_parser.args.in_browser = False
|
60 |
+
|
61 |
+
args = args_parser.args
|
auth-example.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"user": "sitting-duck-1",
|
4 |
+
"pass": "very-bad-publicly-known-password-change-it"
|
5 |
+
}
|
6 |
+
]
|
build_launcher.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
win32_root = os.path.dirname(os.path.dirname(__file__))
|
4 |
+
python_embeded_path = os.path.join(win32_root, 'python_embeded')
|
5 |
+
|
6 |
+
is_win32_standalone_build = os.path.exists(python_embeded_path) and os.path.isdir(python_embeded_path)
|
7 |
+
|
8 |
+
win32_cmd = '''
|
9 |
+
.\python_embeded\python.exe -s Fooocus\entry_with_update.py {cmds} %*
|
10 |
+
pause
|
11 |
+
'''
|
12 |
+
|
13 |
+
|
14 |
+
def build_launcher():
|
15 |
+
if not is_win32_standalone_build:
|
16 |
+
return
|
17 |
+
|
18 |
+
presets = [None, 'anime', 'realistic']
|
19 |
+
|
20 |
+
for preset in presets:
|
21 |
+
win32_cmd_preset = win32_cmd.replace('{cmds}', '' if preset is None else f'--preset {preset}')
|
22 |
+
bat_path = os.path.join(win32_root, 'run.bat' if preset is None else f'run_{preset}.bat')
|
23 |
+
if not os.path.exists(bat_path):
|
24 |
+
with open(bat_path, "w", encoding="utf-8") as f:
|
25 |
+
f.write(win32_cmd_preset)
|
26 |
+
return
|
development.md
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## Running unit tests
|
2 |
+
|
3 |
+
Native python:
|
4 |
+
```
|
5 |
+
python -m unittest tests/
|
6 |
+
```
|
7 |
+
|
8 |
+
Embedded python (Windows zip file installation method):
|
9 |
+
```
|
10 |
+
..\python_embeded\python.exe -m unittest
|
11 |
+
```
|
docker-compose.yml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
volumes:
|
2 |
+
fooocus-data:
|
3 |
+
|
4 |
+
services:
|
5 |
+
app:
|
6 |
+
build: .
|
7 |
+
image: ghcr.io/lllyasviel/fooocus
|
8 |
+
ports:
|
9 |
+
- "7865:7865"
|
10 |
+
environment:
|
11 |
+
- CMDARGS=--listen # Arguments for launch.py.
|
12 |
+
- DATADIR=/content/data # Directory which stores models, outputs dir
|
13 |
+
- config_path=/content/data/config.txt
|
14 |
+
- config_example_path=/content/data/config_modification_tutorial.txt
|
15 |
+
- path_checkpoints=/content/data/models/checkpoints/
|
16 |
+
- path_loras=/content/data/models/loras/
|
17 |
+
- path_embeddings=/content/data/models/embeddings/
|
18 |
+
- path_vae_approx=/content/data/models/vae_approx/
|
19 |
+
- path_upscale_models=/content/data/models/upscale_models/
|
20 |
+
- path_inpaint=/content/data/models/inpaint/
|
21 |
+
- path_controlnet=/content/data/models/controlnet/
|
22 |
+
- path_clip_vision=/content/data/models/clip_vision/
|
23 |
+
- path_fooocus_expansion=/content/data/models/prompt_expansion/fooocus_expansion/
|
24 |
+
- path_outputs=/content/app/outputs/ # Warning: If it is not located under '/content/app', you can't see history log!
|
25 |
+
volumes:
|
26 |
+
- fooocus-data:/content/data
|
27 |
+
#- ./models:/import/models # Once you import files, you don't need to mount again.
|
28 |
+
#- ./outputs:/import/outputs # Once you import files, you don't need to mount again.
|
29 |
+
tty: true
|
30 |
+
deploy:
|
31 |
+
resources:
|
32 |
+
reservations:
|
33 |
+
devices:
|
34 |
+
- driver: nvidia
|
35 |
+
device_ids: ['0']
|
36 |
+
capabilities: [compute, utility]
|
docker.md
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Fooocus on Docker
|
2 |
+
|
3 |
+
The docker image is based on NVIDIA CUDA 12.4 and PyTorch 2.1, see [Dockerfile](Dockerfile) and [requirements_docker.txt](requirements_docker.txt) for details.
|
4 |
+
|
5 |
+
## Requirements
|
6 |
+
|
7 |
+
- A computer with specs good enough to run Fooocus, and proprietary Nvidia drivers
|
8 |
+
- Docker, Docker Compose, or Podman
|
9 |
+
|
10 |
+
## Quick start
|
11 |
+
|
12 |
+
**More information in the [notes](#notes).**
|
13 |
+
|
14 |
+
### Running with Docker Compose
|
15 |
+
|
16 |
+
1. Clone this repository
|
17 |
+
2. Run the docker container with `docker compose up`.
|
18 |
+
|
19 |
+
### Running with Docker
|
20 |
+
|
21 |
+
```sh
|
22 |
+
docker run -p 7865:7865 -v fooocus-data:/content/data -it \
|
23 |
+
--gpus all \
|
24 |
+
-e CMDARGS=--listen \
|
25 |
+
-e DATADIR=/content/data \
|
26 |
+
-e config_path=/content/data/config.txt \
|
27 |
+
-e config_example_path=/content/data/config_modification_tutorial.txt \
|
28 |
+
-e path_checkpoints=/content/data/models/checkpoints/ \
|
29 |
+
-e path_loras=/content/data/models/loras/ \
|
30 |
+
-e path_embeddings=/content/data/models/embeddings/ \
|
31 |
+
-e path_vae_approx=/content/data/models/vae_approx/ \
|
32 |
+
-e path_upscale_models=/content/data/models/upscale_models/ \
|
33 |
+
-e path_inpaint=/content/data/models/inpaint/ \
|
34 |
+
-e path_controlnet=/content/data/models/controlnet/ \
|
35 |
+
-e path_clip_vision=/content/data/models/clip_vision/ \
|
36 |
+
-e path_fooocus_expansion=/content/data/models/prompt_expansion/fooocus_expansion/ \
|
37 |
+
-e path_outputs=/content/app/outputs/ \
|
38 |
+
ghcr.io/lllyasviel/fooocus
|
39 |
+
```
|
40 |
+
### Running with Podman
|
41 |
+
|
42 |
+
```sh
|
43 |
+
podman run -p 7865:7865 -v fooocus-data:/content/data -it \
|
44 |
+
--security-opt=no-new-privileges --cap-drop=ALL --security-opt label=type:nvidia_container_t --device=nvidia.com/gpu=all \
|
45 |
+
-e CMDARGS=--listen \
|
46 |
+
-e DATADIR=/content/data \
|
47 |
+
-e config_path=/content/data/config.txt \
|
48 |
+
-e config_example_path=/content/data/config_modification_tutorial.txt \
|
49 |
+
-e path_checkpoints=/content/data/models/checkpoints/ \
|
50 |
+
-e path_loras=/content/data/models/loras/ \
|
51 |
+
-e path_embeddings=/content/data/models/embeddings/ \
|
52 |
+
-e path_vae_approx=/content/data/models/vae_approx/ \
|
53 |
+
-e path_upscale_models=/content/data/models/upscale_models/ \
|
54 |
+
-e path_inpaint=/content/data/models/inpaint/ \
|
55 |
+
-e path_controlnet=/content/data/models/controlnet/ \
|
56 |
+
-e path_clip_vision=/content/data/models/clip_vision/ \
|
57 |
+
-e path_fooocus_expansion=/content/data/models/prompt_expansion/fooocus_expansion/ \
|
58 |
+
-e path_outputs=/content/app/outputs/ \
|
59 |
+
ghcr.io/lllyasviel/fooocus
|
60 |
+
```
|
61 |
+
|
62 |
+
When you see the message `Use the app with http://0.0.0.0:7865/` in the console, you can access the URL in your browser.
|
63 |
+
|
64 |
+
Your models and outputs are stored in the `fooocus-data` volume, which, depending on OS, is stored in `/var/lib/docker/volumes/` (or `~/.local/share/containers/storage/volumes/` when using `podman`).
|
65 |
+
|
66 |
+
## Building the container locally
|
67 |
+
|
68 |
+
Clone the repository first, and open a terminal in the folder.
|
69 |
+
|
70 |
+
Build with `docker`:
|
71 |
+
```sh
|
72 |
+
docker build . -t fooocus
|
73 |
+
```
|
74 |
+
|
75 |
+
Build with `podman`:
|
76 |
+
```sh
|
77 |
+
podman build . -t fooocus
|
78 |
+
```
|
79 |
+
|
80 |
+
## Details
|
81 |
+
|
82 |
+
### Update the container manually (`docker compose`)
|
83 |
+
|
84 |
+
When you are using `docker compose up` continuously, the container is not updated to the latest version of Fooocus automatically.
|
85 |
+
Run `git pull` before executing `docker compose build --no-cache` to build an image with the latest Fooocus version.
|
86 |
+
You can then start it with `docker compose up`
|
87 |
+
|
88 |
+
### Import models, outputs
|
89 |
+
|
90 |
+
If you want to import files from models or the outputs folder, you can add the following bind mounts in the [docker-compose.yml](docker-compose.yml) or your preferred method of running the container:
|
91 |
+
```
|
92 |
+
#- ./models:/import/models # Once you import files, you don't need to mount again.
|
93 |
+
#- ./outputs:/import/outputs # Once you import files, you don't need to mount again.
|
94 |
+
```
|
95 |
+
After running the container, your files will be copied into `/content/data/models` and `/content/data/outputs`
|
96 |
+
Since `/content/data` is a persistent volume folder, your files will be persisted even when you re-run the container without the above mounts.
|
97 |
+
|
98 |
+
|
99 |
+
### Paths inside the container
|
100 |
+
|
101 |
+
|Path|Details|
|
102 |
+
|-|-|
|
103 |
+
|/content/app|The application stored folder|
|
104 |
+
|/content/app/models.org|Original 'models' folder.<br> Files are copied to the '/content/app/models' which is symlinked to '/content/data/models' every time the container boots. (Existing files will not be overwritten.) |
|
105 |
+
|/content/data|Persistent volume mount point|
|
106 |
+
|/content/data/models|The folder is symlinked to '/content/app/models'|
|
107 |
+
|/content/data/outputs|The folder is symlinked to '/content/app/outputs'|
|
108 |
+
|
109 |
+
### Environments
|
110 |
+
|
111 |
+
You can change `config.txt` parameters by using environment variables.
|
112 |
+
**The priority of using the environments is higher than the values defined in `config.txt`, and they will be saved to the `config_modification_tutorial.txt`**
|
113 |
+
|
114 |
+
Docker specified environments are there. They are used by 'entrypoint.sh'
|
115 |
+
|Environment|Details|
|
116 |
+
|-|-|
|
117 |
+
|DATADIR|'/content/data' location.|
|
118 |
+
|CMDARGS|Arguments for [entry_with_update.py](entry_with_update.py) which is called by [entrypoint.sh](entrypoint.sh)|
|
119 |
+
|config_path|'config.txt' location|
|
120 |
+
|config_example_path|'config_modification_tutorial.txt' location|
|
121 |
+
|HF_MIRROR| huggingface mirror site domain|
|
122 |
+
|
123 |
+
You can also use the same json key names and values explained in the 'config_modification_tutorial.txt' as the environments.
|
124 |
+
See examples in the [docker-compose.yml](docker-compose.yml)
|
125 |
+
|
126 |
+
## Notes
|
127 |
+
|
128 |
+
- Please keep 'path_outputs' under '/content/app'. Otherwise, you may get an error when you open the history log.
|
129 |
+
- Docker on Mac/Windows still has issues in the form of slow volume access when you use "bind mount" volumes. Please refer to [this article](https://docs.docker.com/storage/volumes/#use-a-volume-with-docker-compose) for not using "bind mount".
|
130 |
+
- The MPS backend (Metal Performance Shaders, Apple Silicon M1/M2/etc.) is not yet supported in Docker, see https://github.com/pytorch/pytorch/issues/81224
|
131 |
+
- You can also use `docker compose up -d` to start the container detached and connect to the logs with `docker compose logs -f`. This way you can also close the terminal and keep the container running.
|
entry_with_update.py
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import sys
|
3 |
+
|
4 |
+
|
5 |
+
root = os.path.dirname(os.path.abspath(__file__))
|
6 |
+
sys.path.append(root)
|
7 |
+
os.chdir(root)
|
8 |
+
|
9 |
+
|
10 |
+
try:
|
11 |
+
import pygit2
|
12 |
+
pygit2.option(pygit2.GIT_OPT_SET_OWNER_VALIDATION, 0)
|
13 |
+
|
14 |
+
repo = pygit2.Repository(os.path.abspath(os.path.dirname(__file__)))
|
15 |
+
|
16 |
+
branch_name = repo.head.shorthand
|
17 |
+
|
18 |
+
remote_name = 'origin'
|
19 |
+
remote = repo.remotes[remote_name]
|
20 |
+
|
21 |
+
remote.fetch()
|
22 |
+
|
23 |
+
local_branch_ref = f'refs/heads/{branch_name}'
|
24 |
+
local_branch = repo.lookup_reference(local_branch_ref)
|
25 |
+
|
26 |
+
remote_reference = f'refs/remotes/{remote_name}/{branch_name}'
|
27 |
+
remote_commit = repo.revparse_single(remote_reference)
|
28 |
+
|
29 |
+
merge_result, _ = repo.merge_analysis(remote_commit.id)
|
30 |
+
|
31 |
+
if merge_result & pygit2.GIT_MERGE_ANALYSIS_UP_TO_DATE:
|
32 |
+
print("Already up-to-date")
|
33 |
+
elif merge_result & pygit2.GIT_MERGE_ANALYSIS_FASTFORWARD:
|
34 |
+
local_branch.set_target(remote_commit.id)
|
35 |
+
repo.head.set_target(remote_commit.id)
|
36 |
+
repo.checkout_tree(repo.get(remote_commit.id))
|
37 |
+
repo.reset(local_branch.target, pygit2.GIT_RESET_HARD)
|
38 |
+
print("Fast-forward merge")
|
39 |
+
elif merge_result & pygit2.GIT_MERGE_ANALYSIS_NORMAL:
|
40 |
+
print("Update failed - Did you modify any file?")
|
41 |
+
except Exception as e:
|
42 |
+
print('Update failed.')
|
43 |
+
print(str(e))
|
44 |
+
|
45 |
+
print('Update succeeded.')
|
46 |
+
from launch import *
|
entrypoint.sh
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
ORIGINALDIR=/content/app
|
4 |
+
# Use predefined DATADIR if it is defined
|
5 |
+
[[ x"${DATADIR}" == "x" ]] && DATADIR=/content/data
|
6 |
+
|
7 |
+
# Make persistent dir from original dir
|
8 |
+
function mklink () {
|
9 |
+
mkdir -p $DATADIR/$1
|
10 |
+
ln -s $DATADIR/$1 $ORIGINALDIR
|
11 |
+
}
|
12 |
+
|
13 |
+
# Copy old files from import dir
|
14 |
+
function import () {
|
15 |
+
(test -d /import/$1 && cd /import/$1 && cp -Rpn . $DATADIR/$1/)
|
16 |
+
}
|
17 |
+
|
18 |
+
cd $ORIGINALDIR
|
19 |
+
|
20 |
+
# models
|
21 |
+
mklink models
|
22 |
+
# Copy original files
|
23 |
+
(cd $ORIGINALDIR/models.org && cp -Rpn . $ORIGINALDIR/models/)
|
24 |
+
# Import old files
|
25 |
+
import models
|
26 |
+
|
27 |
+
# outputs
|
28 |
+
mklink outputs
|
29 |
+
# Import old files
|
30 |
+
import outputs
|
31 |
+
|
32 |
+
# Start application
|
33 |
+
python launch.py $*
|
environment.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: fooocus
|
2 |
+
channels:
|
3 |
+
- defaults
|
4 |
+
dependencies:
|
5 |
+
- python=3.10
|
6 |
+
- pip=23.0
|
7 |
+
- packaging
|
experiments_expansion.py
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from modules.expansion import FooocusExpansion
|
2 |
+
|
3 |
+
expansion = FooocusExpansion()
|
4 |
+
|
5 |
+
text = 'a handsome man'
|
6 |
+
|
7 |
+
for i in range(64):
|
8 |
+
print(expansion(text, seed=i))
|
experiments_face.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import cv2
|
2 |
+
import extras.face_crop as cropper
|
3 |
+
|
4 |
+
|
5 |
+
img = cv2.imread('lena.png')
|
6 |
+
result = cropper.crop_image(img)
|
7 |
+
cv2.imwrite('lena_result.png', result)
|
experiments_interrogate.py
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import cv2
|
2 |
+
from extras.interrogate import default_interrogator as default_interrogator_photo
|
3 |
+
from extras.wd14tagger import default_interrogator as default_interrogator_anime
|
4 |
+
|
5 |
+
img = cv2.imread('./test_imgs/red_box.jpg')[:, :, ::-1].copy()
|
6 |
+
print(default_interrogator_photo(img))
|
7 |
+
img = cv2.imread('./test_imgs/miku.jpg')[:, :, ::-1].copy()
|
8 |
+
print(default_interrogator_anime(img))
|
experiments_mask_generation.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# https://github.com/sail-sg/EditAnything/blob/main/sam2groundingdino_edit.py
|
2 |
+
|
3 |
+
import numpy as np
|
4 |
+
from PIL import Image
|
5 |
+
|
6 |
+
from extras.inpaint_mask import SAMOptions, generate_mask_from_image
|
7 |
+
|
8 |
+
original_image = Image.open('cat.webp')
|
9 |
+
image = np.array(original_image, dtype=np.uint8)
|
10 |
+
|
11 |
+
sam_options = SAMOptions(
|
12 |
+
dino_prompt='eye',
|
13 |
+
dino_box_threshold=0.3,
|
14 |
+
dino_text_threshold=0.25,
|
15 |
+
dino_erode_or_dilate=0,
|
16 |
+
dino_debug=False,
|
17 |
+
max_detections=2,
|
18 |
+
model_type='vit_b'
|
19 |
+
)
|
20 |
+
|
21 |
+
mask_image, _, _, _ = generate_mask_from_image(image, sam_options=sam_options)
|
22 |
+
|
23 |
+
merged_masks_img = Image.fromarray(mask_image)
|
24 |
+
merged_masks_img.show()
|
fooocus_colab.ipynb
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": null,
|
6 |
+
"metadata": {
|
7 |
+
"id": "VjYy0F2gZIPR"
|
8 |
+
},
|
9 |
+
"outputs": [],
|
10 |
+
"source": [
|
11 |
+
"!pip install pygit2==1.15.1\n",
|
12 |
+
"%cd /content\n",
|
13 |
+
"!git clone https://github.com/lllyasviel/Fooocus.git\n",
|
14 |
+
"%cd /content/Fooocus\n",
|
15 |
+
"!python entry_with_update.py --share --always-high-vram\n"
|
16 |
+
]
|
17 |
+
}
|
18 |
+
],
|
19 |
+
"metadata": {
|
20 |
+
"accelerator": "GPU",
|
21 |
+
"colab": {
|
22 |
+
"gpuType": "T4",
|
23 |
+
"provenance": []
|
24 |
+
},
|
25 |
+
"kernelspec": {
|
26 |
+
"display_name": "Python 3",
|
27 |
+
"name": "python3"
|
28 |
+
},
|
29 |
+
"language_info": {
|
30 |
+
"name": "python"
|
31 |
+
}
|
32 |
+
},
|
33 |
+
"nbformat": 4,
|
34 |
+
"nbformat_minor": 0
|
35 |
+
}
|
fooocus_version.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
version = '2.5.5'
|
launch.py
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import ssl
|
3 |
+
import sys
|
4 |
+
|
5 |
+
print('[System ARGV] ' + str(sys.argv))
|
6 |
+
|
7 |
+
root = os.path.dirname(os.path.abspath(__file__))
|
8 |
+
sys.path.append(root)
|
9 |
+
os.chdir(root)
|
10 |
+
|
11 |
+
os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1"
|
12 |
+
os.environ["PYTORCH_MPS_HIGH_WATERMARK_RATIO"] = "0.0"
|
13 |
+
if "GRADIO_SERVER_PORT" not in os.environ:
|
14 |
+
os.environ["GRADIO_SERVER_PORT"] = "7865"
|
15 |
+
|
16 |
+
ssl._create_default_https_context = ssl._create_unverified_context
|
17 |
+
|
18 |
+
import platform
|
19 |
+
import fooocus_version
|
20 |
+
|
21 |
+
from build_launcher import build_launcher
|
22 |
+
from modules.launch_util import is_installed, run, python, run_pip, requirements_met, delete_folder_content
|
23 |
+
from modules.model_loader import load_file_from_url
|
24 |
+
|
25 |
+
REINSTALL_ALL = False
|
26 |
+
TRY_INSTALL_XFORMERS = False
|
27 |
+
|
28 |
+
|
29 |
+
def prepare_environment():
|
30 |
+
torch_index_url = os.environ.get('TORCH_INDEX_URL', "https://download.pytorch.org/whl/cu121")
|
31 |
+
torch_command = os.environ.get('TORCH_COMMAND',
|
32 |
+
f"pip install torch==2.1.0 torchvision==0.16.0 --extra-index-url {torch_index_url}")
|
33 |
+
requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt")
|
34 |
+
|
35 |
+
print(f"Python {sys.version}")
|
36 |
+
print(f"Fooocus version: {fooocus_version.version}")
|
37 |
+
|
38 |
+
if REINSTALL_ALL or not is_installed("torch") or not is_installed("torchvision"):
|
39 |
+
run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch", live=True)
|
40 |
+
|
41 |
+
if TRY_INSTALL_XFORMERS:
|
42 |
+
if REINSTALL_ALL or not is_installed("xformers"):
|
43 |
+
xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.23')
|
44 |
+
if platform.system() == "Windows":
|
45 |
+
if platform.python_version().startswith("3.10"):
|
46 |
+
run_pip(f"install -U -I --no-deps {xformers_package}", "xformers", live=True)
|
47 |
+
else:
|
48 |
+
print("Installation of xformers is not supported in this version of Python.")
|
49 |
+
print(
|
50 |
+
"You can also check this and build manually: https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Xformers#building-xformers-on-windows-by-duckness")
|
51 |
+
if not is_installed("xformers"):
|
52 |
+
exit(0)
|
53 |
+
elif platform.system() == "Linux":
|
54 |
+
run_pip(f"install -U -I --no-deps {xformers_package}", "xformers")
|
55 |
+
|
56 |
+
if REINSTALL_ALL or not requirements_met(requirements_file):
|
57 |
+
run_pip(f"install -r \"{requirements_file}\"", "requirements")
|
58 |
+
|
59 |
+
return
|
60 |
+
|
61 |
+
|
62 |
+
vae_approx_filenames = [
|
63 |
+
('xlvaeapp.pth', 'https://huggingface.co/lllyasviel/misc/resolve/main/xlvaeapp.pth'),
|
64 |
+
('vaeapp_sd15.pth', 'https://huggingface.co/lllyasviel/misc/resolve/main/vaeapp_sd15.pt'),
|
65 |
+
('xl-to-v1_interposer-v4.0.safetensors',
|
66 |
+
'https://huggingface.co/mashb1t/misc/resolve/main/xl-to-v1_interposer-v4.0.safetensors')
|
67 |
+
]
|
68 |
+
|
69 |
+
|
70 |
+
def ini_args():
|
71 |
+
from args_manager import args
|
72 |
+
return args
|
73 |
+
|
74 |
+
|
75 |
+
prepare_environment()
|
76 |
+
build_launcher()
|
77 |
+
args = ini_args()
|
78 |
+
|
79 |
+
if args.gpu_device_id is not None:
|
80 |
+
os.environ['CUDA_VISIBLE_DEVICES'] = str(args.gpu_device_id)
|
81 |
+
print("Set device to:", args.gpu_device_id)
|
82 |
+
|
83 |
+
if args.hf_mirror is not None:
|
84 |
+
os.environ['HF_MIRROR'] = str(args.hf_mirror)
|
85 |
+
print("Set hf_mirror to:", args.hf_mirror)
|
86 |
+
|
87 |
+
from modules import config
|
88 |
+
from modules.hash_cache import init_cache
|
89 |
+
|
90 |
+
os.environ["U2NET_HOME"] = config.path_inpaint
|
91 |
+
|
92 |
+
os.environ['GRADIO_TEMP_DIR'] = config.temp_path
|
93 |
+
|
94 |
+
if config.temp_path_cleanup_on_launch:
|
95 |
+
print(f'[Cleanup] Attempting to delete content of temp dir {config.temp_path}')
|
96 |
+
result = delete_folder_content(config.temp_path, '[Cleanup] ')
|
97 |
+
if result:
|
98 |
+
print("[Cleanup] Cleanup successful")
|
99 |
+
else:
|
100 |
+
print(f"[Cleanup] Failed to delete content of temp dir.")
|
101 |
+
|
102 |
+
|
103 |
+
def download_models(default_model, previous_default_models, checkpoint_downloads, embeddings_downloads, lora_downloads, vae_downloads):
|
104 |
+
from modules.util import get_file_from_folder_list
|
105 |
+
|
106 |
+
for file_name, url in vae_approx_filenames:
|
107 |
+
load_file_from_url(url=url, model_dir=config.path_vae_approx, file_name=file_name)
|
108 |
+
|
109 |
+
load_file_from_url(
|
110 |
+
url='https://huggingface.co/lllyasviel/misc/resolve/main/fooocus_expansion.bin',
|
111 |
+
model_dir=config.path_fooocus_expansion,
|
112 |
+
file_name='pytorch_model.bin'
|
113 |
+
)
|
114 |
+
|
115 |
+
if args.disable_preset_download:
|
116 |
+
print('Skipped model download.')
|
117 |
+
return default_model, checkpoint_downloads
|
118 |
+
|
119 |
+
if not args.always_download_new_model:
|
120 |
+
if not os.path.isfile(get_file_from_folder_list(default_model, config.paths_checkpoints)):
|
121 |
+
for alternative_model_name in previous_default_models:
|
122 |
+
if os.path.isfile(get_file_from_folder_list(alternative_model_name, config.paths_checkpoints)):
|
123 |
+
print(f'You do not have [{default_model}] but you have [{alternative_model_name}].')
|
124 |
+
print(f'Fooocus will use [{alternative_model_name}] to avoid downloading new models, '
|
125 |
+
f'but you are not using the latest models.')
|
126 |
+
print('Use --always-download-new-model to avoid fallback and always get new models.')
|
127 |
+
checkpoint_downloads = {}
|
128 |
+
default_model = alternative_model_name
|
129 |
+
break
|
130 |
+
|
131 |
+
for file_name, url in checkpoint_downloads.items():
|
132 |
+
model_dir = os.path.dirname(get_file_from_folder_list(file_name, config.paths_checkpoints))
|
133 |
+
load_file_from_url(url=url, model_dir=model_dir, file_name=file_name)
|
134 |
+
for file_name, url in embeddings_downloads.items():
|
135 |
+
load_file_from_url(url=url, model_dir=config.path_embeddings, file_name=file_name)
|
136 |
+
for file_name, url in lora_downloads.items():
|
137 |
+
model_dir = os.path.dirname(get_file_from_folder_list(file_name, config.paths_loras))
|
138 |
+
load_file_from_url(url=url, model_dir=model_dir, file_name=file_name)
|
139 |
+
for file_name, url in vae_downloads.items():
|
140 |
+
load_file_from_url(url=url, model_dir=config.path_vae, file_name=file_name)
|
141 |
+
|
142 |
+
return default_model, checkpoint_downloads
|
143 |
+
|
144 |
+
|
145 |
+
config.default_base_model_name, config.checkpoint_downloads = download_models(
|
146 |
+
config.default_base_model_name, config.previous_default_models, config.checkpoint_downloads,
|
147 |
+
config.embeddings_downloads, config.lora_downloads, config.vae_downloads)
|
148 |
+
|
149 |
+
config.update_files()
|
150 |
+
init_cache(config.model_filenames, config.paths_checkpoints, config.lora_filenames, config.paths_loras)
|
151 |
+
|
152 |
+
from webui import *
|
notification-example.mp3
ADDED
Binary file (38.3 kB). View file
|
|
readme.md
ADDED
@@ -0,0 +1,486 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div align=center>
|
2 |
+
<img src="https://github.com/lllyasviel/Fooocus/assets/19834515/483fb86d-c9a2-4c20-997c-46dafc124f25">
|
3 |
+
</div>
|
4 |
+
|
5 |
+
# Fooocus
|
6 |
+
|
7 |
+
[>>> Click Here to Install Fooocus <<<](#download)
|
8 |
+
|
9 |
+
Fooocus is an image generating software (based on [Gradio](https://www.gradio.app/) <a href='https://github.com/gradio-app/gradio'><img src='https://img.shields.io/github/stars/gradio-app/gradio'></a>).
|
10 |
+
|
11 |
+
Fooocus presents a rethinking of image generator designs. The software is offline, open source, and free, while at the same time, similar to many online image generators like Midjourney, the manual tweaking is not needed, and users only need to focus on the prompts and images. Fooocus has also simplified the installation: between pressing "download" and generating the first image, the number of needed mouse clicks is strictly limited to less than 3. Minimal GPU memory requirement is 4GB (Nvidia).
|
12 |
+
|
13 |
+
**Recently many fake websites exist on Google when you search “fooocus”. Do not trust those – here is the only official source of Fooocus.**
|
14 |
+
|
15 |
+
# Project Status: Limited Long-Term Support (LTS) with Bug Fixes Only
|
16 |
+
|
17 |
+
The Fooocus project, built entirely on the **Stable Diffusion XL** architecture, is now in a state of limited long-term support (LTS) with bug fixes only. As the existing functionalities are considered as nearly free of programmartic issues (Thanks to [mashb1t](https://github.com/mashb1t)'s huge efforts), future updates will focus exclusively on addressing any bugs that may arise.
|
18 |
+
|
19 |
+
**There are no current plans to migrate to or incorporate newer model architectures.** However, this may change during time with the development of open-source community. For example, if the community converge to one single dominant method for image generation (which may really happen in half or one years given the current status), Fooocus may also migrate to that exact method.
|
20 |
+
|
21 |
+
For those interested in utilizing newer models such as **Flux**, we recommend exploring alternative platforms such as [WebUI Forge](https://github.com/lllyasviel/stable-diffusion-webui-forge) (also from us), [ComfyUI/SwarmUI](https://github.com/comfyanonymous/ComfyUI). Additionally, several [excellent forks of Fooocus](https://github.com/lllyasviel/Fooocus?tab=readme-ov-file#forks) are available for experimentation.
|
22 |
+
|
23 |
+
Again, recently many fake websites exist on Google when you search “fooocus”. Do **NOT** get Fooocus from those websites – this page is the only official source of Fooocus. We never have any website like such as “fooocus.com”, “fooocus.net”, “fooocus.co”, “fooocus.ai”, “fooocus.org”, “fooocus.pro”, “fooocus.one”. Those websites are ALL FAKE. **They have ABSOLUTLY no relationship to us. Fooocus is a 100% non-commercial offline open-source software.**
|
24 |
+
|
25 |
+
# Features
|
26 |
+
|
27 |
+
Below is a quick list using Midjourney's examples:
|
28 |
+
|
29 |
+
| Midjourney | Fooocus |
|
30 |
+
| - | - |
|
31 |
+
| High-quality text-to-image without needing much prompt engineering or parameter tuning. <br> (Unknown method) | High-quality text-to-image without needing much prompt engineering or parameter tuning. <br> (Fooocus has an offline GPT-2 based prompt processing engine and lots of sampling improvements so that results are always beautiful, no matter if your prompt is as short as “house in garden” or as long as 1000 words) |
|
32 |
+
| V1 V2 V3 V4 | Input Image -> Upscale or Variation -> Vary (Subtle) / Vary (Strong)|
|
33 |
+
| U1 U2 U3 U4 | Input Image -> Upscale or Variation -> Upscale (1.5x) / Upscale (2x) |
|
34 |
+
| Inpaint / Up / Down / Left / Right (Pan) | Input Image -> Inpaint or Outpaint -> Inpaint / Up / Down / Left / Right <br> (Fooocus uses its own inpaint algorithm and inpaint models so that results are more satisfying than all other software that uses standard SDXL inpaint method/model) |
|
35 |
+
| Image Prompt | Input Image -> Image Prompt <br> (Fooocus uses its own image prompt algorithm so that result quality and prompt understanding are more satisfying than all other software that uses standard SDXL methods like standard IP-Adapters or Revisions) |
|
36 |
+
| --style | Advanced -> Style |
|
37 |
+
| --stylize | Advanced -> Advanced -> Guidance |
|
38 |
+
| --niji | [Multiple launchers: "run.bat", "run_anime.bat", and "run_realistic.bat".](https://github.com/lllyasviel/Fooocus/discussions/679) <br> Fooocus support SDXL models on Civitai <br> (You can google search “Civitai” if you do not know about it) |
|
39 |
+
| --quality | Advanced -> Quality |
|
40 |
+
| --repeat | Advanced -> Image Number |
|
41 |
+
| Multi Prompts (::) | Just use multiple lines of prompts |
|
42 |
+
| Prompt Weights | You can use " I am (happy:1.5)". <br> Fooocus uses A1111's reweighting algorithm so that results are better than ComfyUI if users directly copy prompts from Civitai. (Because if prompts are written in ComfyUI's reweighting, users are less likely to copy prompt texts as they prefer dragging files) <br> To use embedding, you can use "(embedding:file_name:1.1)" |
|
43 |
+
| --no | Advanced -> Negative Prompt |
|
44 |
+
| --ar | Advanced -> Aspect Ratios |
|
45 |
+
| InsightFace | Input Image -> Image Prompt -> Advanced -> FaceSwap |
|
46 |
+
| Describe | Input Image -> Describe |
|
47 |
+
|
48 |
+
Below is a quick list using LeonardoAI's examples:
|
49 |
+
|
50 |
+
| LeonardoAI | Fooocus |
|
51 |
+
| - | - |
|
52 |
+
| Prompt Magic | Advanced -> Style -> Fooocus V2 |
|
53 |
+
| Advanced Sampler Parameters (like Contrast/Sharpness/etc) | Advanced -> Advanced -> Sampling Sharpness / etc |
|
54 |
+
| User-friendly ControlNets | Input Image -> Image Prompt -> Advanced |
|
55 |
+
|
56 |
+
Also, [click here to browse the advanced features.](https://github.com/lllyasviel/Fooocus/discussions/117)
|
57 |
+
|
58 |
+
# Download
|
59 |
+
|
60 |
+
### Windows
|
61 |
+
|
62 |
+
You can directly download Fooocus with:
|
63 |
+
|
64 |
+
**[>>> Click here to download <<<](https://github.com/lllyasviel/Fooocus/releases/download/v2.5.0/Fooocus_win64_2-5-0.7z)**
|
65 |
+
|
66 |
+
After you download the file, please uncompress it and then run the "run.bat".
|
67 |
+
|
68 |
+
![image](https://github.com/lllyasviel/Fooocus/assets/19834515/c49269c4-c274-4893-b368-047c401cc58c)
|
69 |
+
|
70 |
+
The first time you launch the software, it will automatically download models:
|
71 |
+
|
72 |
+
1. It will download [default models](#models) to the folder "Fooocus\models\checkpoints" given different presets. You can download them in advance if you do not want automatic download.
|
73 |
+
2. Note that if you use inpaint, at the first time you inpaint an image, it will download [Fooocus's own inpaint control model from here](https://huggingface.co/lllyasviel/fooocus_inpaint/resolve/main/inpaint_v26.fooocus.patch) as the file "Fooocus\models\inpaint\inpaint_v26.fooocus.patch" (the size of this file is 1.28GB).
|
74 |
+
|
75 |
+
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).
|
76 |
+
|
77 |
+
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:
|
78 |
+
* Use `--disable-preset-selection` to disable preset selection in the browser.
|
79 |
+
* 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.
|
80 |
+
|
81 |
+
![image](https://github.com/lllyasviel/Fooocus/assets/19834515/d386f817-4bd7-490c-ad89-c1e228c23447)
|
82 |
+
|
83 |
+
If you already have these files, you can copy them to the above locations to speed up installation.
|
84 |
+
|
85 |
+
Note that if you see **"MetadataIncompleteBuffer" or "PytorchStreamReader"**, then your model files are corrupted. Please download models again.
|
86 |
+
|
87 |
+
Below is a test on a relatively low-end laptop with **16GB System RAM** and **6GB VRAM** (Nvidia 3060 laptop). The speed on this machine is about 1.35 seconds per iteration. Pretty impressive – nowadays laptops with 3060 are usually at very acceptable price.
|
88 |
+
|
89 |
+
![image](https://github.com/lllyasviel/Fooocus/assets/19834515/938737a5-b105-4f19-b051-81356cb7c495)
|
90 |
+
|
91 |
+
Besides, recently many other software report that Nvidia driver above 532 is sometimes 10x slower than Nvidia driver 531. If your generation time is very long, consider download [Nvidia Driver 531 Laptop](https://www.nvidia.com/download/driverResults.aspx/199991/en-us/) or [Nvidia Driver 531 Desktop](https://www.nvidia.com/download/driverResults.aspx/199990/en-us/).
|
92 |
+
|
93 |
+
Note that the minimal requirement is **4GB Nvidia GPU memory (4GB VRAM)** and **8GB system memory (8GB RAM)**. This requires using Microsoft’s Virtual Swap technique, which is automatically enabled by your Windows installation in most cases, so you often do not need to do anything about it. However, if you are not sure, or if you manually turned it off (would anyone really do that?), or **if you see any "RuntimeError: CPUAllocator"**, you can enable it here:
|
94 |
+
|
95 |
+
<details>
|
96 |
+
<summary>Click here to see the image instructions. </summary>
|
97 |
+
|
98 |
+
![image](https://github.com/lllyasviel/Fooocus/assets/19834515/2a06b130-fe9b-4504-94f1-2763be4476e9)
|
99 |
+
|
100 |
+
**And make sure that you have at least 40GB free space on each drive if you still see "RuntimeError: CPUAllocator" !**
|
101 |
+
|
102 |
+
</details>
|
103 |
+
|
104 |
+
Please open an issue if you use similar devices but still cannot achieve acceptable performances.
|
105 |
+
|
106 |
+
Note that the [minimal requirement](#minimal-requirement) for different platforms is different.
|
107 |
+
|
108 |
+
See also the common problems and troubleshoots [here](troubleshoot.md).
|
109 |
+
|
110 |
+
### Colab
|
111 |
+
|
112 |
+
(Last tested - 2024 Aug 12 by [mashb1t](https://github.com/mashb1t))
|
113 |
+
|
114 |
+
| Colab | Info
|
115 |
+
| --- | --- |
|
116 |
+
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/lllyasviel/Fooocus/blob/main/fooocus_colab.ipynb) | Fooocus Official
|
117 |
+
|
118 |
+
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.
|
119 |
+
|
120 |
+
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.
|
121 |
+
|
122 |
+
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.
|
123 |
+
|
124 |
+
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).
|
125 |
+
|
126 |
+
Thanks to [camenduru](https://github.com/camenduru) for the template!
|
127 |
+
|
128 |
+
### Linux (Using Anaconda)
|
129 |
+
|
130 |
+
If you want to use Anaconda/Miniconda, you can
|
131 |
+
|
132 |
+
git clone https://github.com/lllyasviel/Fooocus.git
|
133 |
+
cd Fooocus
|
134 |
+
conda env create -f environment.yaml
|
135 |
+
conda activate fooocus
|
136 |
+
pip install -r requirements_versions.txt
|
137 |
+
|
138 |
+
Then download the models: download [default models](#models) to the folder "Fooocus\models\checkpoints". **Or let Fooocus automatically download the models** using the launcher:
|
139 |
+
|
140 |
+
conda activate fooocus
|
141 |
+
python entry_with_update.py
|
142 |
+
|
143 |
+
Or, if you want to open a remote port, use
|
144 |
+
|
145 |
+
conda activate fooocus
|
146 |
+
python entry_with_update.py --listen
|
147 |
+
|
148 |
+
Use `python entry_with_update.py --preset anime` or `python entry_with_update.py --preset realistic` for Fooocus Anime/Realistic Edition.
|
149 |
+
|
150 |
+
### Linux (Using Python Venv)
|
151 |
+
|
152 |
+
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
|
153 |
+
|
154 |
+
git clone https://github.com/lllyasviel/Fooocus.git
|
155 |
+
cd Fooocus
|
156 |
+
python3 -m venv fooocus_env
|
157 |
+
source fooocus_env/bin/activate
|
158 |
+
pip install -r requirements_versions.txt
|
159 |
+
|
160 |
+
See the above sections for model downloads. You can launch the software with:
|
161 |
+
|
162 |
+
source fooocus_env/bin/activate
|
163 |
+
python entry_with_update.py
|
164 |
+
|
165 |
+
Or, if you want to open a remote port, use
|
166 |
+
|
167 |
+
source fooocus_env/bin/activate
|
168 |
+
python entry_with_update.py --listen
|
169 |
+
|
170 |
+
Use `python entry_with_update.py --preset anime` or `python entry_with_update.py --preset realistic` for Fooocus Anime/Realistic Edition.
|
171 |
+
|
172 |
+
### Linux (Using native system Python)
|
173 |
+
|
174 |
+
If you know what you are doing, and your Linux already has **Python 3.10** installed, and your Python can be called with the command **python3** (and Pip with **pip3**), you can
|
175 |
+
|
176 |
+
git clone https://github.com/lllyasviel/Fooocus.git
|
177 |
+
cd Fooocus
|
178 |
+
pip3 install -r requirements_versions.txt
|
179 |
+
|
180 |
+
See the above sections for model downloads. You can launch the software with:
|
181 |
+
|
182 |
+
python3 entry_with_update.py
|
183 |
+
|
184 |
+
Or, if you want to open a remote port, use
|
185 |
+
|
186 |
+
python3 entry_with_update.py --listen
|
187 |
+
|
188 |
+
Use `python entry_with_update.py --preset anime` or `python entry_with_update.py --preset realistic` for Fooocus Anime/Realistic Edition.
|
189 |
+
|
190 |
+
### Linux (AMD GPUs)
|
191 |
+
|
192 |
+
Note that the [minimal requirement](#minimal-requirement) for different platforms is different.
|
193 |
+
|
194 |
+
Same with the above instructions. You need to change torch to the AMD version
|
195 |
+
|
196 |
+
pip uninstall torch torchvision torchaudio torchtext functorch xformers
|
197 |
+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.6
|
198 |
+
|
199 |
+
AMD is not intensively tested, however. The AMD support is in beta.
|
200 |
+
|
201 |
+
Use `python entry_with_update.py --preset anime` or `python entry_with_update.py --preset realistic` for Fooocus Anime/Realistic Edition.
|
202 |
+
|
203 |
+
### Windows (AMD GPUs)
|
204 |
+
|
205 |
+
Note that the [minimal requirement](#minimal-requirement) for different platforms is different.
|
206 |
+
|
207 |
+
Same with Windows. Download the software and edit the content of `run.bat` as:
|
208 |
+
|
209 |
+
.\python_embeded\python.exe -m pip uninstall torch torchvision torchaudio torchtext functorch xformers -y
|
210 |
+
.\python_embeded\python.exe -m pip install torch-directml
|
211 |
+
.\python_embeded\python.exe -s Fooocus\entry_with_update.py --directml
|
212 |
+
pause
|
213 |
+
|
214 |
+
Then run the `run.bat`.
|
215 |
+
|
216 |
+
AMD is not intensively tested, however. The AMD support is in beta.
|
217 |
+
|
218 |
+
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.
|
219 |
+
|
220 |
+
### Mac
|
221 |
+
|
222 |
+
Note that the [minimal requirement](#minimal-requirement) for different platforms is different.
|
223 |
+
|
224 |
+
Mac is not intensively tested. Below is an unofficial guideline for using Mac. You can discuss problems [here](https://github.com/lllyasviel/Fooocus/pull/129).
|
225 |
+
|
226 |
+
You can install Fooocus on Apple Mac silicon (M1 or M2) with macOS 'Catalina' or a newer version. Fooocus runs on Apple silicon computers via [PyTorch](https://pytorch.org/get-started/locally/) MPS device acceleration. Mac Silicon computers don't come with a dedicated graphics card, resulting in significantly longer image processing times compared to computers with dedicated graphics cards.
|
227 |
+
|
228 |
+
1. Install the conda package manager and pytorch nightly. Read the [Accelerated PyTorch training on Mac](https://developer.apple.com/metal/pytorch/) Apple Developer guide for instructions. Make sure pytorch recognizes your MPS device.
|
229 |
+
1. Open the macOS Terminal app and clone this repository with `git clone https://github.com/lllyasviel/Fooocus.git`.
|
230 |
+
1. Change to the new Fooocus directory, `cd Fooocus`.
|
231 |
+
1. Create a new conda environment, `conda env create -f environment.yaml`.
|
232 |
+
1. Activate your new conda environment, `conda activate fooocus`.
|
233 |
+
1. Install the packages required by Fooocus, `pip install -r requirements_versions.txt`.
|
234 |
+
1. 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.
|
235 |
+
|
236 |
+
Use `python entry_with_update.py --preset anime` or `python entry_with_update.py --preset realistic` for Fooocus Anime/Realistic Edition.
|
237 |
+
|
238 |
+
### Docker
|
239 |
+
|
240 |
+
See [docker.md](docker.md)
|
241 |
+
|
242 |
+
### Download Previous Version
|
243 |
+
|
244 |
+
See the guidelines [here](https://github.com/lllyasviel/Fooocus/discussions/1405).
|
245 |
+
|
246 |
+
## Minimal Requirement
|
247 |
+
|
248 |
+
Below is the minimal requirement for running Fooocus locally. If your device capability is lower than this spec, you may not be able to use Fooocus locally. (Please let us know, in any case, if your device capability is lower but Fooocus still works.)
|
249 |
+
|
250 |
+
| Operating System | GPU | Minimal GPU Memory | Minimal System Memory | [System Swap](troubleshoot.md) | Note |
|
251 |
+
|-------------------|------------------------------|------------------------------|---------------------------|--------------------------------|----------------------------------------------------------------------------|
|
252 |
+
| Windows/Linux | Nvidia RTX 4XXX | 4GB | 8GB | Required | fastest |
|
253 |
+
| Windows/Linux | Nvidia RTX 3XXX | 4GB | 8GB | Required | usually faster than RTX 2XXX |
|
254 |
+
| Windows/Linux | Nvidia RTX 2XXX | 4GB | 8GB | Required | usually faster than GTX 1XXX |
|
255 |
+
| Windows/Linux | Nvidia GTX 1XXX | 8GB (* 6GB uncertain) | 8GB | Required | only marginally faster than CPU |
|
256 |
+
| Windows/Linux | Nvidia GTX 9XX | 8GB | 8GB | Required | faster or slower than CPU |
|
257 |
+
| Windows/Linux | Nvidia GTX < 9XX | Not supported | / | / | / |
|
258 |
+
| Windows | AMD GPU | 8GB (updated 2023 Dec 30) | 8GB | Required | via DirectML (* ROCm is on hold), about 3x slower than Nvidia RTX 3XXX |
|
259 |
+
| Linux | AMD GPU | 8GB | 8GB | Required | via ROCm, about 1.5x slower than Nvidia RTX 3XXX |
|
260 |
+
| Mac | M1/M2 MPS | Shared | Shared | Shared | about 9x slower than Nvidia RTX 3XXX |
|
261 |
+
| Windows/Linux/Mac | only use CPU | 0GB | 32GB | Required | about 17x slower than Nvidia RTX 3XXX |
|
262 |
+
|
263 |
+
* AMD GPU ROCm (on hold): The AMD is still working on supporting ROCm on Windows.
|
264 |
+
|
265 |
+
* Nvidia GTX 1XXX 6GB uncertain: Some people report 6GB success on GTX 10XX, but some other people report failure cases.
|
266 |
+
|
267 |
+
*Note that Fooocus is only for extremely high quality image generating. We will not support smaller models to reduce the requirement and sacrifice result quality.*
|
268 |
+
|
269 |
+
## Troubleshoot
|
270 |
+
|
271 |
+
See the common problems [here](troubleshoot.md).
|
272 |
+
|
273 |
+
## Default Models
|
274 |
+
<a name="models"></a>
|
275 |
+
|
276 |
+
Given different goals, the default models and configs of Fooocus are different:
|
277 |
+
|
278 |
+
| Task | Windows | Linux args | Main Model | Refiner | Config |
|
279 |
+
|-----------| --- | --- |-----------------------------| --- |--------------------------------------------------------------------------------|
|
280 |
+
| General | run.bat | | juggernautXL_v8Rundiffusion | not used | [here](https://github.com/lllyasviel/Fooocus/blob/main/presets/default.json) |
|
281 |
+
| Realistic | run_realistic.bat | --preset realistic | realisticStockPhoto_v20 | not used | [here](https://github.com/lllyasviel/Fooocus/blob/main/presets/realistic.json) |
|
282 |
+
| Anime | run_anime.bat | --preset anime | animaPencilXL_v500 | not used | [here](https://github.com/lllyasviel/Fooocus/blob/main/presets/anime.json) |
|
283 |
+
|
284 |
+
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.
|
285 |
+
|
286 |
+
## UI Access and Authentication
|
287 |
+
In addition to running on localhost, Fooocus can also expose its UI in two ways:
|
288 |
+
* Local UI listener: use `--listen` (specify port e.g. with `--port 8888`).
|
289 |
+
* API access: use `--share` (registers an endpoint at `.gradio.live`).
|
290 |
+
|
291 |
+
In both ways the access is unauthenticated by default. You can add basic authentication by creating a file called `auth.json` in the main directory, which contains a list of JSON objects with the keys `user` and `pass` (see example in [auth-example.json](./auth-example.json)).
|
292 |
+
|
293 |
+
## List of "Hidden" Tricks
|
294 |
+
<a name="tech_list"></a>
|
295 |
+
|
296 |
+
<details>
|
297 |
+
<summary>Click to see a list of tricks. Those are based on SDXL and are not very up-to-date with latest models.</summary>
|
298 |
+
|
299 |
+
1. GPT2-based [prompt expansion as a dynamic style "Fooocus V2".](https://github.com/lllyasviel/Fooocus/discussions/117#raw) (similar to Midjourney's hidden pre-processing and "raw" mode, or the LeonardoAI's Prompt Magic).
|
300 |
+
2. Native refiner swap inside one single k-sampler. The advantage is that the refiner model can now 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]( https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/12371) into the dev branch of webui. Great!)
|
301 |
+
3. 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 to 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 [Draw Things](https://apps.apple.com/us/app/draw-things-ai-generation/id6444050820) will support Negative ADM Guidance. Great!)
|
302 |
+
4. We implemented a carefully tuned variation of Section 5.1 of ["Improving Sample Quality of Diffusion Models Using Self-Attention Guidance"](https://arxiv.org/pdf/2210.00939.pdf). The weight is set to very low, but this is Fooocus's final guarantee to make sure that the XL will never yield an overly smooth or plastic appearance (examples [here](https://github.com/lllyasviel/Fooocus/discussions/117#sharpness)). This can almost eliminate all cases for which XL still occasionally produces 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.)
|
303 |
+
5. We modified the style templates a bit and added the "cinematic-default".
|
304 |
+
6. 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.
|
305 |
+
7. The parameters of samplers are carefully tuned.
|
306 |
+
8. Because XL uses positional encoding for generation resolution, images generated by several fixed resolutions look a bit better than those 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.
|
307 |
+
9. Separated prompts for two different text encoders seem unnecessary. Separated prompts for the base model and refiner may work, but the effects are random, and we refrain from implementing this.
|
308 |
+
10. The DPM family seems well-suited for XL since XL sometimes generates overly smooth texture, but the DPM family sometimes generates overly dense detail in texture. Their joint effect looks neutral and appealing to human perception.
|
309 |
+
11. A carefully designed system for balancing multiple styles as well as prompt expansion.
|
310 |
+
12. Using automatic1111's method to normalize prompt emphasizing. This significantly improves results when users directly copy prompts from civitai.
|
311 |
+
13. The joint swap system of the refiner now also supports img2img and upscale in a seamless way.
|
312 |
+
14. CFG Scale and TSNR correction (tuned for SDXL) when CFG is bigger than 10.
|
313 |
+
</details>
|
314 |
+
|
315 |
+
## Customization
|
316 |
+
|
317 |
+
After the first time you run Fooocus, a config file will be generated at `Fooocus\config.txt`. This file can be edited to change the model path or default parameters.
|
318 |
+
|
319 |
+
For example, an edited `Fooocus\config.txt` (this file will be generated after the first launch) may look like this:
|
320 |
+
|
321 |
+
```json
|
322 |
+
{
|
323 |
+
"path_checkpoints": "D:\\Fooocus\\models\\checkpoints",
|
324 |
+
"path_loras": "D:\\Fooocus\\models\\loras",
|
325 |
+
"path_embeddings": "D:\\Fooocus\\models\\embeddings",
|
326 |
+
"path_vae_approx": "D:\\Fooocus\\models\\vae_approx",
|
327 |
+
"path_upscale_models": "D:\\Fooocus\\models\\upscale_models",
|
328 |
+
"path_inpaint": "D:\\Fooocus\\models\\inpaint",
|
329 |
+
"path_controlnet": "D:\\Fooocus\\models\\controlnet",
|
330 |
+
"path_clip_vision": "D:\\Fooocus\\models\\clip_vision",
|
331 |
+
"path_fooocus_expansion": "D:\\Fooocus\\models\\prompt_expansion\\fooocus_expansion",
|
332 |
+
"path_outputs": "D:\\Fooocus\\outputs",
|
333 |
+
"default_model": "realisticStockPhoto_v10.safetensors",
|
334 |
+
"default_refiner": "",
|
335 |
+
"default_loras": [["lora_filename_1.safetensors", 0.5], ["lora_filename_2.safetensors", 0.5]],
|
336 |
+
"default_cfg_scale": 3.0,
|
337 |
+
"default_sampler": "dpmpp_2m",
|
338 |
+
"default_scheduler": "karras",
|
339 |
+
"default_negative_prompt": "low quality",
|
340 |
+
"default_positive_prompt": "",
|
341 |
+
"default_styles": [
|
342 |
+
"Fooocus V2",
|
343 |
+
"Fooocus Photograph",
|
344 |
+
"Fooocus Negative"
|
345 |
+
]
|
346 |
+
}
|
347 |
+
```
|
348 |
+
|
349 |
+
Many other keys, formats, and examples are in `Fooocus\config_modification_tutorial.txt` (this file will be generated after the first launch).
|
350 |
+
|
351 |
+
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.
|
352 |
+
|
353 |
+
A safer way is just to try "run_anime.bat" or "run_realistic.bat" - they should already be good enough for different tasks.
|
354 |
+
|
355 |
+
~Note that `user_path_config.txt` is deprecated and will be removed soon.~ (Edit: it is already removed.)
|
356 |
+
|
357 |
+
### All CMD Flags
|
358 |
+
|
359 |
+
```
|
360 |
+
entry_with_update.py [-h] [--listen [IP]] [--port PORT]
|
361 |
+
[--disable-header-check [ORIGIN]]
|
362 |
+
[--web-upload-size WEB_UPLOAD_SIZE]
|
363 |
+
[--hf-mirror HF_MIRROR]
|
364 |
+
[--external-working-path PATH [PATH ...]]
|
365 |
+
[--output-path OUTPUT_PATH]
|
366 |
+
[--temp-path TEMP_PATH] [--cache-path CACHE_PATH]
|
367 |
+
[--in-browser] [--disable-in-browser]
|
368 |
+
[--gpu-device-id DEVICE_ID]
|
369 |
+
[--async-cuda-allocation | --disable-async-cuda-allocation]
|
370 |
+
[--disable-attention-upcast]
|
371 |
+
[--all-in-fp32 | --all-in-fp16]
|
372 |
+
[--unet-in-bf16 | --unet-in-fp16 | --unet-in-fp8-e4m3fn | --unet-in-fp8-e5m2]
|
373 |
+
[--vae-in-fp16 | --vae-in-fp32 | --vae-in-bf16]
|
374 |
+
[--vae-in-cpu]
|
375 |
+
[--clip-in-fp8-e4m3fn | --clip-in-fp8-e5m2 | --clip-in-fp16 | --clip-in-fp32]
|
376 |
+
[--directml [DIRECTML_DEVICE]]
|
377 |
+
[--disable-ipex-hijack]
|
378 |
+
[--preview-option [none,auto,fast,taesd]]
|
379 |
+
[--attention-split | --attention-quad | --attention-pytorch]
|
380 |
+
[--disable-xformers]
|
381 |
+
[--always-gpu | --always-high-vram | --always-normal-vram | --always-low-vram | --always-no-vram | --always-cpu [CPU_NUM_THREADS]]
|
382 |
+
[--always-offload-from-vram]
|
383 |
+
[--pytorch-deterministic] [--disable-server-log]
|
384 |
+
[--debug-mode] [--is-windows-embedded-python]
|
385 |
+
[--disable-server-info] [--multi-user] [--share]
|
386 |
+
[--preset PRESET] [--disable-preset-selection]
|
387 |
+
[--language LANGUAGE]
|
388 |
+
[--disable-offload-from-vram] [--theme THEME]
|
389 |
+
[--disable-image-log] [--disable-analytics]
|
390 |
+
[--disable-metadata] [--disable-preset-download]
|
391 |
+
[--disable-enhance-output-sorting]
|
392 |
+
[--enable-auto-describe-image]
|
393 |
+
[--always-download-new-model]
|
394 |
+
[--rebuild-hash-cache [CPU_NUM_THREADS]]
|
395 |
+
```
|
396 |
+
|
397 |
+
## Inline Prompt Features
|
398 |
+
|
399 |
+
### Wildcards
|
400 |
+
|
401 |
+
Example prompt: `__color__ flower`
|
402 |
+
|
403 |
+
Processed for positive and negative prompt.
|
404 |
+
|
405 |
+
Selects a random wildcard from a predefined list of options, in this case the `wildcards/color.txt` file.
|
406 |
+
The wildcard will be replaced with a random color (randomness based on seed).
|
407 |
+
You can also disable randomness and process a wildcard file from top to bottom by enabling the checkbox `Read wildcards in order` in Developer Debug Mode.
|
408 |
+
|
409 |
+
Wildcards can be nested and combined, and multiple wildcards can be used in the same prompt (example see `wildcards/color_flower.txt`).
|
410 |
+
|
411 |
+
### Array Processing
|
412 |
+
|
413 |
+
Example prompt: `[[red, green, blue]] flower`
|
414 |
+
|
415 |
+
Processed only for positive prompt.
|
416 |
+
|
417 |
+
Processes the array from left to right, generating a separate image for each element in the array. In this case 3 images would be generated, one for each color.
|
418 |
+
Increase the image number to 3 to generate all 3 variants.
|
419 |
+
|
420 |
+
Arrays can not be nested, but multiple arrays can be used in the same prompt.
|
421 |
+
Does support inline LoRAs as array elements!
|
422 |
+
|
423 |
+
### Inline LoRAs
|
424 |
+
|
425 |
+
Example prompt: `flower <lora:sunflowers:1.2>`
|
426 |
+
|
427 |
+
Processed only for positive prompt.
|
428 |
+
|
429 |
+
Applies a LoRA to the prompt. The LoRA file must be located in the `models/loras` directory.
|
430 |
+
|
431 |
+
## Advanced Features
|
432 |
+
|
433 |
+
[Click here to browse the advanced features.](https://github.com/lllyasviel/Fooocus/discussions/117)
|
434 |
+
|
435 |
+
## Forks
|
436 |
+
|
437 |
+
Below are some Forks to Fooocus:
|
438 |
+
|
439 |
+
| Fooocus' forks |
|
440 |
+
| - |
|
441 |
+
| [fenneishi/Fooocus-Control](https://github.com/fenneishi/Fooocus-Control) </br>[runew0lf/RuinedFooocus](https://github.com/runew0lf/RuinedFooocus) </br> [MoonRide303/Fooocus-MRE](https://github.com/MoonRide303/Fooocus-MRE) </br> [metercai/SimpleSDXL](https://github.com/metercai/SimpleSDXL) </br> [mashb1t/Fooocus](https://github.com/mashb1t/Fooocus) </br> and so on ... |
|
442 |
+
|
443 |
+
## Thanks
|
444 |
+
|
445 |
+
Many thanks to [twri](https://github.com/twri) and [3Diva](https://github.com/3Diva) and [Marc K3nt3L](https://github.com/K3nt3L) for creating additional SDXL styles available in Fooocus.
|
446 |
+
|
447 |
+
The project starts from a mixture of [Stable Diffusion WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) and [ComfyUI](https://github.com/comfyanonymous/ComfyUI) codebases.
|
448 |
+
|
449 |
+
Also, thanks [daswer123](https://github.com/daswer123) for contributing the Canvas Zoom!
|
450 |
+
|
451 |
+
## Update Log
|
452 |
+
|
453 |
+
The log is [here](update_log.md).
|
454 |
+
|
455 |
+
## Localization/Translation/I18N
|
456 |
+
|
457 |
+
You can put json files in the `language` folder to translate the user interface.
|
458 |
+
|
459 |
+
For example, below is the content of `Fooocus/language/example.json`:
|
460 |
+
|
461 |
+
```json
|
462 |
+
{
|
463 |
+
"Generate": "生成",
|
464 |
+
"Input Image": "入力画像",
|
465 |
+
"Advanced": "고급",
|
466 |
+
"SAI 3D Model": "SAI 3D Modèle"
|
467 |
+
}
|
468 |
+
```
|
469 |
+
|
470 |
+
If you add `--language example` arg, Fooocus will read `Fooocus/language/example.json` to translate the UI.
|
471 |
+
|
472 |
+
For example, you can edit the ending line of Windows `run.bat` as
|
473 |
+
|
474 |
+
.\python_embeded\python.exe -s Fooocus\entry_with_update.py --language example
|
475 |
+
|
476 |
+
Or `run_anime.bat` as
|
477 |
+
|
478 |
+
.\python_embeded\python.exe -s Fooocus\entry_with_update.py --language example --preset anime
|
479 |
+
|
480 |
+
Or `run_realistic.bat` as
|
481 |
+
|
482 |
+
.\python_embeded\python.exe -s Fooocus\entry_with_update.py --language example --preset realistic
|
483 |
+
|
484 |
+
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!**
|
485 |
+
|
486 |
+
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.
|
requirements_docker.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
torch==2.1.0
|
2 |
+
torchvision==0.16.0
|
requirements_versions.txt
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
torchsde==0.2.6
|
2 |
+
einops==0.8.0
|
3 |
+
transformers==4.42.4
|
4 |
+
safetensors==0.4.3
|
5 |
+
accelerate==0.32.1
|
6 |
+
pyyaml==6.0.1
|
7 |
+
pillow==10.4.0
|
8 |
+
scipy==1.14.0
|
9 |
+
tqdm==4.66.4
|
10 |
+
psutil==6.0.0
|
11 |
+
pytorch_lightning==2.3.3
|
12 |
+
omegaconf==2.3.0
|
13 |
+
gradio==3.41.2
|
14 |
+
pygit2==1.15.1
|
15 |
+
opencv-contrib-python-headless==4.10.0.84
|
16 |
+
httpx==0.27.0
|
17 |
+
onnxruntime==1.18.1
|
18 |
+
timm==1.0.7
|
19 |
+
numpy==1.26.4
|
20 |
+
tokenizers==0.19.1
|
21 |
+
packaging==24.1
|
22 |
+
rembg==2.0.57
|
23 |
+
groundingdino-py==0.4.0
|
24 |
+
segment_anything==1.0
|
shared.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
gradio_root = None
|
troubleshoot.md
ADDED
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Below are many common problems that people encountered:
|
2 |
+
|
3 |
+
### RuntimeError: CPUAllocator
|
4 |
+
|
5 |
+
See also the section: **System Swap**
|
6 |
+
|
7 |
+
### Model loaded, then paused, then nothing happens
|
8 |
+
|
9 |
+
See also the section: **System Swap**
|
10 |
+
|
11 |
+
### Segmentation Fault
|
12 |
+
|
13 |
+
See also the section: **System Swap**
|
14 |
+
|
15 |
+
### Aborted
|
16 |
+
|
17 |
+
See also the section: **System Swap**
|
18 |
+
|
19 |
+
### core dumped
|
20 |
+
|
21 |
+
See also the section: **System Swap**
|
22 |
+
|
23 |
+
### Killed
|
24 |
+
|
25 |
+
See also the section: **System Swap**
|
26 |
+
|
27 |
+
### ^C, then quit
|
28 |
+
|
29 |
+
See also the section: **System Swap**
|
30 |
+
|
31 |
+
### adm 2816, then stuck
|
32 |
+
|
33 |
+
See also the section: **System Swap**
|
34 |
+
|
35 |
+
### Connection errored out
|
36 |
+
|
37 |
+
See also the section: **System Swap**
|
38 |
+
|
39 |
+
### Error 1006
|
40 |
+
|
41 |
+
See also the section: **System Swap**
|
42 |
+
|
43 |
+
### WinError 10060
|
44 |
+
|
45 |
+
See also the section: **System Swap**
|
46 |
+
|
47 |
+
### Read timed out
|
48 |
+
|
49 |
+
See also the section: **System Swap**
|
50 |
+
|
51 |
+
### No error, but the console close in a flash. Cannot find any error.
|
52 |
+
|
53 |
+
See also the section: **System Swap**
|
54 |
+
|
55 |
+
### Model loading is extremely slow (more than 1 minute)
|
56 |
+
|
57 |
+
See also the section: **System Swap**
|
58 |
+
|
59 |
+
### System Swap
|
60 |
+
|
61 |
+
All above problems are caused by the fact that you do not have enough System Swap.
|
62 |
+
|
63 |
+
Please make sure that you have at least 40GB System Swap. In fact, it does not need so much Swap, but 40Gb should be safe for you to run Fooocus in 100% success.
|
64 |
+
|
65 |
+
(If you have more than 64GB RAM, then *perhaps* you do not need any System Swap, but we are not exactly sure about this.)
|
66 |
+
|
67 |
+
Also, if your system swap is on HDD, the speed of model loading will be very slow. Please try best to put system swap on SSD.
|
68 |
+
|
69 |
+
If you are using Linux/Mac, please follow your provider's instructions to set Swap Space. Herein, the "provider" refers to Ubuntu official, CentOS official, Mac official, etc.
|
70 |
+
|
71 |
+
If you are using Windows, you can set Swap here:
|
72 |
+
|
73 |
+
![swap](https://github.com/lllyasviel/Fooocus/assets/19834515/2a06b130-fe9b-4504-94f1-2763be4476e9)
|
74 |
+
|
75 |
+
If you use both HDD and SSD, you *may* test some settings on the above step 7 to try best to put swap area on SSD, so that the speed of model loading will be faster.
|
76 |
+
|
77 |
+
**Important: Microsoft Windows 10/11 by default automate system swap for you so that you do not need to touch this dangerous setting. If you do not have enough system swap, just make sure that you have at least 40GB free space on each disk.** The Microsoft Windows 10/11 will automatically make swap areas for you.
|
78 |
+
|
79 |
+
Also, if you obtain Microsoft Windows 10/11 from some unofficial Chinese or Russian provider, they may have modified the default setting of system swap to advertise some "Enhanced Windows 10/11" (but actually they are just making things worse rather than improve things). In those cases, you may need to manually check if your system swap setting is consistent to the above screenshot.
|
80 |
+
|
81 |
+
Finally, note that you need to restart computer to activate any changes in system swap.
|
82 |
+
|
83 |
+
### MetadataIncompleteBuffer
|
84 |
+
|
85 |
+
See also the section: **Model corrupted**
|
86 |
+
|
87 |
+
### PytorchStreamReader failed
|
88 |
+
|
89 |
+
See also the section: **Model corrupted**
|
90 |
+
|
91 |
+
### Model corrupted
|
92 |
+
|
93 |
+
If you see Model Corrupted, then your model is corrupted. Fooocus will re-download corrupted models for you if your internet connection is good. Otherwise, you may also manually download models. You can find model url and their local location in the console each time a model download is requested.
|
94 |
+
|
95 |
+
### UserWarning: The operator 'aten::std_mean.correction' is not currently supported on the DML
|
96 |
+
|
97 |
+
This is a warning that you can ignore.
|
98 |
+
|
99 |
+
### Torch not compiled with CUDA enabled
|
100 |
+
|
101 |
+
You are not following the official installation guide.
|
102 |
+
|
103 |
+
Please do not trust those wrong tutorials on the internet, and please only trust the official installation guide.
|
104 |
+
|
105 |
+
### subprocess-exited-with-error
|
106 |
+
|
107 |
+
Please use python 3.10
|
108 |
+
|
109 |
+
Also, you are not following the official installation guide.
|
110 |
+
|
111 |
+
Please do not trust those wrong tutorials on the internet, and please only trust the official installation guide.
|
112 |
+
|
113 |
+
### SSL: CERTIFICATE_VERIFY_FAILED
|
114 |
+
|
115 |
+
Are you living in China? If yes, please consider turn off VPN, and/or try to download models manually.
|
116 |
+
|
117 |
+
If you get this error elsewhere in the world, then you may need to look at [this search](https://www.google.com/search?q=SSL+Certificate+Error). We cannot give very specific guide to fix this since the cause can vary a lot.
|
118 |
+
|
119 |
+
### CUDA kernel errors might be asynchronously reported at some other API call
|
120 |
+
|
121 |
+
A very small amount of devices does have this problem. The cause can be complicated but usually can be resolved after following these steps:
|
122 |
+
|
123 |
+
1. Make sure that you are using official version and latest version installed from [here](https://github.com/lllyasviel/Fooocus#download). (Some forks and other versions are more likely to cause this problem.)
|
124 |
+
2. Upgrade your Nvidia driver to the latest version. (Usually the version of your Nvidia driver should be 53X, not 3XX or 4XX.)
|
125 |
+
3. If things still do not work, then perhaps it is a problem with CUDA 12. You can use CUDA 11 and Xformers to try to solve this problem. We have prepared all files for you, and please do NOT install any CUDA or other environment on you own. The only one official way to do this is: (1) Backup and delete your `python_embeded` folder (near the `run.bat`); (2) Download the "previous_old_xformers_env.7z" from the [release page](https://github.com/lllyasviel/Fooocus/releases/tag/release), decompress it, and put the newly extracted `python_embeded` folder near your `run.bat`; (3) run Fooocus.
|
126 |
+
4. If it still does not work, please open an issue for us to take a look.
|
127 |
+
|
128 |
+
### Found no NVIDIA driver on your system
|
129 |
+
|
130 |
+
Please upgrade your Nvidia Driver.
|
131 |
+
|
132 |
+
If you are using AMD, please follow official installation guide.
|
133 |
+
|
134 |
+
### NVIDIA driver too old
|
135 |
+
|
136 |
+
Please upgrade your Nvidia Driver.
|
137 |
+
|
138 |
+
### I am using Mac, the speed is very slow.
|
139 |
+
|
140 |
+
Some MAC users may need `--disable-offload-from-vram` to speed up model loading.
|
141 |
+
|
142 |
+
Besides, the current support for MAC is very experimental, and we encourage users to also try Diffusionbee or Drawingthings: they are developed only for MAC.
|
143 |
+
|
144 |
+
### I am using Nvidia with 8GB VRAM, I get CUDA Out Of Memory
|
145 |
+
|
146 |
+
It is a BUG. Please let us know as soon as possible. Please make an issue. See also [minimal requirements](https://github.com/lllyasviel/Fooocus/tree/main?tab=readme-ov-file#minimal-requirement).
|
147 |
+
|
148 |
+
### I am using Nvidia with 6GB VRAM, I get CUDA Out Of Memory
|
149 |
+
|
150 |
+
It is very likely a BUG. Please let us know as soon as possible. Please make an issue. See also [minimal requirements](https://github.com/lllyasviel/Fooocus/tree/main?tab=readme-ov-file#minimal-requirement).
|
151 |
+
|
152 |
+
### I am using Nvidia with 4GB VRAM with Float16 support, like RTX 3050, I get CUDA Out Of Memory
|
153 |
+
|
154 |
+
It is a BUG. Please let us know as soon as possible. Please make an issue. See also [minimal requirements](https://github.com/lllyasviel/Fooocus/tree/main?tab=readme-ov-file#minimal-requirement).
|
155 |
+
|
156 |
+
### I am using Nvidia with 4GB VRAM without Float16 support, like GTX 960, I get CUDA Out Of Memory
|
157 |
+
|
158 |
+
Supporting GPU with 4GB VRAM without fp16 is extremely difficult, and you may not be able to use SDXL. However, you may still make an issue and let us know. You may try SD1.5 in Automatic1111 or other software for your device. See also [minimal requirements](https://github.com/lllyasviel/Fooocus/tree/main?tab=readme-ov-file#minimal-requirement).
|
159 |
+
|
160 |
+
### I am using AMD GPU on Windows, I get CUDA Out Of Memory
|
161 |
+
|
162 |
+
Current AMD support is very experimental for Windows. If you see this, then perhaps you cannot use Fooocus on this device on Windows.
|
163 |
+
|
164 |
+
However, if you re able to run SDXL on this same device on any other software, please let us know immediately, and we will support it as soon as possible. If no other software can enable your device to run SDXL on Windows, then we also do not have much to help.
|
165 |
+
|
166 |
+
Besides, the AMD support on Linux is slightly better because it will use ROCM. You may also try it if you are willing to change OS to linux. See also [minimal requirements](https://github.com/lllyasviel/Fooocus/tree/main?tab=readme-ov-file#minimal-requirement).
|
167 |
+
|
168 |
+
### I am using AMD GPU on Linux, I get CUDA Out Of Memory
|
169 |
+
|
170 |
+
Current AMD support for Linux is better than that for Windows, but still, very experimental. However, if you re able to run SDXL on this same device on any other software, please let us know immediately, and we will support it as soon as possible. If no other software can enable your device to run SDXL on Windows, then we also do not have much to help. See also [minimal requirements](https://github.com/lllyasviel/Fooocus/tree/main?tab=readme-ov-file#minimal-requirement).
|
171 |
+
|
172 |
+
### I tried flags like --lowvram or --gpu-only or --bf16 or so on, and things are not getting any better?
|
173 |
+
|
174 |
+
Please remove these flags if you are mislead by some wrong tutorials. In most cases these flags are making things worse and introducing more problems.
|
175 |
+
|
176 |
+
### Fooocus suddenly becomes very slow and I have not changed anything
|
177 |
+
|
178 |
+
Are you accidentally running two Fooocus at the same time?
|
update_log.md
ADDED
@@ -0,0 +1,750 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# [2.5.5](https://github.com/lllyasviel/Fooocus/releases/tag/v2.5.5)
|
2 |
+
|
3 |
+
* Fix colab inpaint issue by moving an import statement
|
4 |
+
|
5 |
+
# [2.5.4](https://github.com/lllyasviel/Fooocus/releases/tag/v2.5.4)
|
6 |
+
|
7 |
+
* Fix validation for default_ip_image_* and default_inpaint_mask_sam_model
|
8 |
+
* Fix enhance mask debugging in combination with image sorting
|
9 |
+
* Fix loading of checkpoints and LoRAs when using multiple directories in config and then switching presets
|
10 |
+
|
11 |
+
# [2.5.3](https://github.com/lllyasviel/Fooocus/releases/tag/v2.5.3)
|
12 |
+
|
13 |
+
* Only load weights from non-safetensors files, preventing harmful code injection
|
14 |
+
* Add checkbox for applying/resetting styles when describing images, also allowing multiple describe content types
|
15 |
+
|
16 |
+
# [2.5.2](https://github.com/lllyasviel/Fooocus/releases/tag/v2.5.2)
|
17 |
+
|
18 |
+
* Fix not adding positive prompt when styles didn't have a {prompt} placeholder in the positive prompt
|
19 |
+
* Extend config settings for input image, see list in [PR](https://github.com/lllyasviel/Fooocus/pull/3382)
|
20 |
+
|
21 |
+
# [2.5.1](https://github.com/lllyasviel/Fooocus/releases/tag/v2.5.1)
|
22 |
+
|
23 |
+
* Update download URL in readme
|
24 |
+
* Increase speed of metadata loading
|
25 |
+
* Fix reading of metadata from jpeg, jpg and webp (exif)
|
26 |
+
* Fix debug preprocessor
|
27 |
+
* Update attributes and add inline prompt features section to readme
|
28 |
+
* Add checkbox, config and handling for saving only the final enhanced image. Use config `default_save_only_final_enhanced_image`, default False.
|
29 |
+
* Add sorting of final images when enhanced is enabled. Use argument `--disable-enhance-output-sorting` to disable.
|
30 |
+
|
31 |
+
# [2.5.0](https://github.com/lllyasviel/Fooocus/releases/tag/v2.5.0)
|
32 |
+
|
33 |
+
This version includes various package updates. If the auto-update doesn't work you can do one of the following:
|
34 |
+
1. Open a terminal in the Fooocus folder (location of config.txt) and run `git pull`
|
35 |
+
2. Update packages
|
36 |
+
- Windows (installation through zip file): open a terminal in the Fooocus folder (location of config.txt) `..\python_embeded\python.exe -m pip install -r .\requirements_versions.txt` (Windows using embedded python, installation method zip file) or download Fooocus again (zip file attached to this release)
|
37 |
+
- other: manually update the packages using `python.exe -m pip install -r requirements_versions.txt` or use the docker image
|
38 |
+
|
39 |
+
---
|
40 |
+
|
41 |
+
* Update python dependencies, add segment_anything
|
42 |
+
* Add enhance feature, which offers easy image refinement steps (similar to adetailer, but based on dynamic image detection instead of specific mask detection models). See [documentation](https://github.com/lllyasviel/Fooocus/discussions/3281).
|
43 |
+
* Rewrite async worker code, make code much more reusable to allow iterations and improve reusability
|
44 |
+
* Improve GroundingDINO and SAM image masking
|
45 |
+
* Fix inference tensor version counter tracking issue for GroundingDINO after using Enhance (see [discussion](https://github.com/lllyasviel/Fooocus/discussions/3213))
|
46 |
+
* Move checkboxes Enable Mask Upload and Invert Mask When Generating from Developer Debug Mode to Inpaint Or Outpaint
|
47 |
+
* Add persistent model cache for metadata. Use `--rebuild-hash-cache X` (X = int, number of CPU cores, default all) to manually rebuild the cache for all non-cached hashes
|
48 |
+
* Rename `--enable-describe-uov-image` to `--enable-auto-describe-image`, now also works for enhance image upload
|
49 |
+
* Rename checkbox `Enable Mask Upload` to `Enable Advanced Masking Features` to better hint to mask auto-generation feature
|
50 |
+
* Get upscale model filepath by calling downloading_upscale_model() to ensure the model exists
|
51 |
+
* Rename tab titles and translations from singular to plural
|
52 |
+
* Rename document to documentation
|
53 |
+
* Update default models to latest versions
|
54 |
+
* animaPencilXL_v400 => animaPencilXL_v500
|
55 |
+
* DreamShaperXL_Turbo_dpmppSdeKarras => DreamShaperXL_Turbo_v2_1
|
56 |
+
* SDXL_FILM_PHOTOGRAPHY_STYLE_BetaV0.4 => SDXL_FILM_PHOTOGRAPHY_STYLE_V1
|
57 |
+
* Add preset for pony_v6 (using ponyDiffusionV6XL)
|
58 |
+
* Add style `Fooocus Pony`
|
59 |
+
* Add restart sampler ([paper](https://arxiv.org/abs/2306.14878))
|
60 |
+
* Add config option for default_inpaint_engine_version, sets inpaint engine for pony_v6 and playground_v2.5 to None for improved results (incompatible with inpaint engine)
|
61 |
+
* Add image editor functionality to mask upload (same as for inpaint, now correctly resizes and allows more detailed mask creation)
|
62 |
+
|
63 |
+
# [2.4.3](https://github.com/lllyasviel/Fooocus/releases/tag/v2.4.3)
|
64 |
+
|
65 |
+
* Fix alphas_cumprod setter for TCD sampler
|
66 |
+
* Add parser for env var strings to expected config value types to allow override of all non-path config keys
|
67 |
+
|
68 |
+
# [2.4.2](https://github.com/lllyasviel/Fooocus/releases/tag/v2.4.2)
|
69 |
+
|
70 |
+
* Fix some small bugs (tcd scheduler when gamma is 0, chown in Dockerfile, update cmd args in readme, translation for aspect ratios, vae default after file reload)
|
71 |
+
* Fix performance LoRA replacement when data is loaded from history log and inline prompt
|
72 |
+
* Add support and preset for playground v2.5 (only works with performance Quality or Speed, use with scheduler edm_playground_v2)
|
73 |
+
* Make textboxes (incl. positive prompt) resizable
|
74 |
+
* Hide intermediate images when performance of Gradio would bottleneck the generation process (Extreme Speed, Lightning, Hyper-SD)
|
75 |
+
|
76 |
+
# [2.4.1](https://github.com/lllyasviel/Fooocus/releases/tag/v2.4.1)
|
77 |
+
|
78 |
+
* Fix some small bugs (e.g. adjust clip skip default value from 1 to 2, add type check to aspect ratios js update function)
|
79 |
+
* Add automated docker build on push to main, tagged with `edge`. See [available docker images](https://github.com/lllyasviel/Fooocus/pkgs/container/fooocus).
|
80 |
+
|
81 |
+
# [2.4.0](https://github.com/lllyasviel/Fooocus/releases/tag/v2.4.0)
|
82 |
+
|
83 |
+
* Change settings tab elements to be more compact
|
84 |
+
* Add clip skip slider
|
85 |
+
* Add select for custom VAE
|
86 |
+
* Add new style "Random Style"
|
87 |
+
* Update default anime model to animaPencilXL_v310
|
88 |
+
* Add button to reconnect the UI after Fooocus crashed without having to configure everything again (no page reload required)
|
89 |
+
* Add performance "hyper-sd" (based on [Hyper-SDXL 4 step LoRA](https://huggingface.co/ByteDance/Hyper-SD/blob/main/Hyper-SDXL-4steps-lora.safetensors))
|
90 |
+
* Add [AlignYourSteps](https://research.nvidia.com/labs/toronto-ai/AlignYourSteps/) scheduler by Nvidia, see
|
91 |
+
* Add [TCD](https://github.com/jabir-zheng/TCD) sampler and scheduler (based on sgm_uniform)
|
92 |
+
* Add NSFW image censoring (disables intermediate image preview while generating). Set config value `default_black_out_nsfw` to True to always enable.
|
93 |
+
* Add argument `--enable-describe-uov-image` to automatically describe uploaded images for upscaling
|
94 |
+
* Add inline lora prompt references with subfolder support, example prompt: `colorful bird <lora:toucan:1.2>`
|
95 |
+
* Add size and aspect ratio recommendation on image describe
|
96 |
+
* Add inpaint brush color picker, helpful when image and mask brush have the same color
|
97 |
+
* Add automated Docker image build using Github Actions on each release.
|
98 |
+
* Add full raw prompts to history logs
|
99 |
+
* Change code ownership from @lllyasviel to @mashb1t for automated issue / MR notification
|
100 |
+
|
101 |
+
# [2.3.1](https://github.com/lllyasviel/Fooocus/releases/tag/2.3.1)
|
102 |
+
|
103 |
+
* Remove positive prompt from anime prefix to not reset prompt after switching presets
|
104 |
+
* Fix image number being reset to 1 when switching preset, now doesn't reset anymore
|
105 |
+
* Fix outpainting dimension calculation when extending left/right
|
106 |
+
* Fix LoRA compatibility for LoRAs in a1111 metadata scheme
|
107 |
+
|
108 |
+
# [2.3.0](https://github.com/lllyasviel/Fooocus/releases/tag/2.3.0)
|
109 |
+
|
110 |
+
* Add performance "lightning" (based on [SDXL-Lightning 4 step LoRA](https://huggingface.co/ByteDance/SDXL-Lightning/blob/main/sdxl_lightning_4step_lora.safetensors))
|
111 |
+
* Add preset selection to UI, disable with argument `--disable-preset-selection`. Use `--always-download-new-model` to download missing models on preset switch.
|
112 |
+
* Improve face swap consistency by switching later in the process to (synthetic) refiner
|
113 |
+
* Add temp path cleanup on startup
|
114 |
+
* Add support for wildcard subdirectories
|
115 |
+
* Add scrollable 2 column layout for styles for better structure
|
116 |
+
* Improve Colab resource needs for T4 instances (default), positively tested with all image prompt features
|
117 |
+
* Improve anime preset, now uses style `Fooocus Semi Realistic` instead of `Fooocus Negative` (less wet look images)
|
118 |
+
|
119 |
+
# [2.2.1](https://github.com/lllyasviel/Fooocus/releases/tag/2.2.1)
|
120 |
+
|
121 |
+
* Fix some small bugs (e.g. image grid, upscale fast 2x, LoRA weight width in Firefox)
|
122 |
+
* Allow prompt weights in array syntax
|
123 |
+
* Add steps override and metadata scheme to history log
|
124 |
+
|
125 |
+
# [2.2.0](https://github.com/lllyasviel/Fooocus/releases/tag/2.2.0)
|
126 |
+
|
127 |
+
* Isolate every image generation to truly allow multi-user usage
|
128 |
+
* Add array support, changes the main prompt when increasing the image number. Syntax: `[[red, green, blue]] flower`
|
129 |
+
* Add optional metadata to images, allowing you to regenerate and modify them later with the same parameters
|
130 |
+
* Now supports native PNG, JPG and WEBP image generation
|
131 |
+
* Add Docker support
|
132 |
+
|
133 |
+
# [2.1.865](https://github.com/lllyasviel/Fooocus/releases/tag/2.1.865)
|
134 |
+
|
135 |
+
* Various bugfixes
|
136 |
+
* Add authentication to --listen
|
137 |
+
|
138 |
+
# 2.1.864
|
139 |
+
|
140 |
+
* New model list. See also discussions.
|
141 |
+
|
142 |
+
# 2.1.861 (requested update)
|
143 |
+
|
144 |
+
(2023 Dec 21) Hi all, the feature updating of Fooocus will be paused for about two or three weeks because we have some other workloads. See you soon and we will come back in mid or late Jan. However, you may still see updates if other collaborators are fixing bugs or solving problems.
|
145 |
+
|
146 |
+
* Show image preview in Style when mouse hover.
|
147 |
+
|
148 |
+
# 2.1.860 (requested update)
|
149 |
+
|
150 |
+
* Allow upload inpaint mask in developer mode.
|
151 |
+
|
152 |
+
# 2.1.857 (requested update)
|
153 |
+
|
154 |
+
* Begin to support 8GB AMD GPU on Windows.
|
155 |
+
|
156 |
+
# 2.1.854
|
157 |
+
|
158 |
+
* Add a button to copy parameters to clipboard in log.
|
159 |
+
* Allow users to load parameters directly by pasting parameters to prompt.
|
160 |
+
|
161 |
+
# 2.1.853
|
162 |
+
|
163 |
+
* Add Marc K3nt3L's styles. Thanks [Marc K3nt3L](https://github.com/K3nt3L)!
|
164 |
+
|
165 |
+
# 2.1.852
|
166 |
+
|
167 |
+
* New Log System: Log system now uses tables. If this is breaking some other browser extension or javascript developments, see also [use previous version](https://github.com/lllyasviel/Fooocus/discussions/1405).
|
168 |
+
|
169 |
+
# 2.1.846
|
170 |
+
|
171 |
+
* Many users reported that image quality is different from 2.1.824. We reviewed all codes and fixed several precision problems in 2.1.846.
|
172 |
+
|
173 |
+
# 2.1.843
|
174 |
+
|
175 |
+
* Many improvements to Canvas. Thanks CanvasZoom author!
|
176 |
+
|
177 |
+
# 2.1.841
|
178 |
+
|
179 |
+
* Backend maintain.
|
180 |
+
* Fix some potential frozen after model mismatch.
|
181 |
+
* Fix crash when cfg=1 when using anime preset.
|
182 |
+
* Added some guidelines for troubleshoot the "CUDA kernel errors asynchronously" problem.
|
183 |
+
* Fix inpaint device problem in `--always-gpu` mode.
|
184 |
+
|
185 |
+
# 2.1.839
|
186 |
+
|
187 |
+
* Maintained some computation codes in backend for efficiency.
|
188 |
+
* Added a note about Seed Breaking Change.
|
189 |
+
|
190 |
+
**Seed Breaking Change**: Note that 2.1.825-2.1.839 is seed breaking change. The computation float point is changed and some seeds may give slightly different results. The minor change in 2.1.825-2.1.839 do not influence image quality. See also [use previous version](https://github.com/lllyasviel/Fooocus/discussions/1405).
|
191 |
+
|
192 |
+
# 2.1.837
|
193 |
+
|
194 |
+
* Fix some precision-related problems.
|
195 |
+
|
196 |
+
# 2.1.836
|
197 |
+
|
198 |
+
* Avoid blip tokenizer download from torch hub
|
199 |
+
|
200 |
+
# 2.1.831
|
201 |
+
|
202 |
+
* Input Image -> Describe (Midjourney Describe)
|
203 |
+
|
204 |
+
# 2.1.830
|
205 |
+
|
206 |
+
* SegmindVega support.
|
207 |
+
|
208 |
+
# 2.1.829
|
209 |
+
|
210 |
+
* Change SDE tree to CPU on AMD/DirectMl to avoid potential problems.
|
211 |
+
|
212 |
+
# 2.1.828
|
213 |
+
|
214 |
+
* Allow to disable gradio analytics.
|
215 |
+
* Use html table in log.
|
216 |
+
* fix some SSL problems.
|
217 |
+
|
218 |
+
# 2.1.826
|
219 |
+
|
220 |
+
* New backend.
|
221 |
+
* FP8 support (see also the new cmd flag list in Readme, eg, --unet-in-fp8-e4m3fn and --unet-in-fp8-e5m2).
|
222 |
+
* Fix some MPS problems.
|
223 |
+
* GLoRA support.
|
224 |
+
* Turbo scheduler.
|
225 |
+
|
226 |
+
# 2.1.823
|
227 |
+
|
228 |
+
(2023 Nov 26) Hi all, the feature updating of Fooocus will be paused for about two or three weeks because we have some other workloads. See you soon and we will come back in mid December. However, you may still see updates if other collaborators are fixing bugs or solving problems.
|
229 |
+
|
230 |
+
* Fix some potential problem when LoRAs has clip keys and user want to load those LoRAs to refiners.
|
231 |
+
|
232 |
+
# 2.1.822
|
233 |
+
|
234 |
+
* New inpaint system (inpaint beta test ends).
|
235 |
+
|
236 |
+
# 2.1.821
|
237 |
+
|
238 |
+
* New UI for LoRAs.
|
239 |
+
* Improved preset system: normalized preset keys and file names.
|
240 |
+
* Improved session system: now multiple users can use one Fooocus at the same time without seeing others' results.
|
241 |
+
* Improved some computation related to model precision.
|
242 |
+
* Improved config loading system with user-friendly prints.
|
243 |
+
|
244 |
+
# 2.1.820
|
245 |
+
|
246 |
+
* support "--disable-image-log" to prevent writing images and logs to hard drive.
|
247 |
+
|
248 |
+
# 2.1.819
|
249 |
+
|
250 |
+
* Allow disabling preview in dev tools.
|
251 |
+
|
252 |
+
# 2.1.818
|
253 |
+
|
254 |
+
* Fix preset lora failed to load when the weight is exactly one.
|
255 |
+
|
256 |
+
# 2.1.817
|
257 |
+
|
258 |
+
* support "--theme dark" and "--theme light".
|
259 |
+
* added preset files "default" and "lcm", these presets exist but will not create launcher files (will not be exposed to users) to keep entry clean. The "--preset lcm" is equivalent to select "Extreme Speed" in UI, but will likely to make some online service deploying easier.
|
260 |
+
|
261 |
+
# 2.1.815
|
262 |
+
|
263 |
+
* Multiple loras in preset.
|
264 |
+
|
265 |
+
# 2.1.814
|
266 |
+
|
267 |
+
* Allow using previous preset of official SAI SDXL by modify the args to '--preset sai'. ~Note that this preset will set inpaint engine back to previous v1 to get same results like before. To change the inpaint engine to v2.6, use the dev tools -> inpaint engine -> v2.6.~ (update: it is not needed now after some tests.)
|
268 |
+
|
269 |
+
# 2.1.813
|
270 |
+
|
271 |
+
* Allow preset to set default inpaint engine.
|
272 |
+
|
273 |
+
# 2.1.812
|
274 |
+
|
275 |
+
* Allow preset to set default performance.
|
276 |
+
* heunpp2 sampler.
|
277 |
+
|
278 |
+
# 2.1.810
|
279 |
+
|
280 |
+
* Added hints to config_modification_tutorial.txt
|
281 |
+
* Removed user hacked aspect ratios in I18N english templates, but it will still be read like before.
|
282 |
+
* fix some style sorting problem again (perhaps should try Gradio 4.0 later).
|
283 |
+
* Refreshed I18N english templates with more keys.
|
284 |
+
|
285 |
+
# 2.1.809
|
286 |
+
|
287 |
+
* fix some sorting problem.
|
288 |
+
|
289 |
+
# 2.1.808
|
290 |
+
|
291 |
+
* Aspect ratios now show aspect ratios.
|
292 |
+
* Added style search.
|
293 |
+
* Added style sorting/ordering/favorites.
|
294 |
+
|
295 |
+
# 2.1.807
|
296 |
+
|
297 |
+
* Click on image to see it in full screen.
|
298 |
+
|
299 |
+
# 2.1.806
|
300 |
+
|
301 |
+
* Fix some lora problems related to clip.
|
302 |
+
|
303 |
+
# 2.1.805
|
304 |
+
|
305 |
+
* Responsive UI for small screens.
|
306 |
+
* Added skip preprocessor in dev tools.
|
307 |
+
|
308 |
+
# 2.1.802
|
309 |
+
|
310 |
+
* Default inpaint engine changed to v2.6. You can still use inpaint engine v1 in dev tools.
|
311 |
+
* Fix some VRAM problems.
|
312 |
+
|
313 |
+
# 2.1.799
|
314 |
+
|
315 |
+
* Added 'Extreme Speed' performance mode (based on LCM). The previous complicated settings are not needed now.
|
316 |
+
|
317 |
+
# 2.1.798
|
318 |
+
|
319 |
+
* added lcm scheduler - LCM may need to set both sampler and scheduler to "lcm". Other than that, see the description in 2.1.782 logs.
|
320 |
+
|
321 |
+
# 2.1.797
|
322 |
+
|
323 |
+
* fixed some dependency problems with facexlib and filterpy.
|
324 |
+
|
325 |
+
# 2.1.793
|
326 |
+
|
327 |
+
* Added many javascripts to improve user experience. Now users with small screen will always see full canvas without needing to scroll.
|
328 |
+
|
329 |
+
# 2.1.790
|
330 |
+
|
331 |
+
* Face swap (in line with Midjourney InsightFace): Input Image -> Image Prompt -> Advanced -> FaceSwap
|
332 |
+
* The performance is super high. Use it carefully and never use it in any illegal things!
|
333 |
+
* This implementation will crop faces for you and you do NOT need to crop faces before feeding images into Fooocus. (If you previously manually crop faces from images for other software, you do not need to do that now in Fooocus.)
|
334 |
+
|
335 |
+
# 2.1.788
|
336 |
+
|
337 |
+
* Fixed some math problems in previous versions.
|
338 |
+
* Inpaint engine v2.6 join the beta test of Fooocus inpaint models. Use it in dev tools -> inpaint engine -> v2.6 .
|
339 |
+
|
340 |
+
# 2.1.785
|
341 |
+
|
342 |
+
* The `user_path_config.txt` is deprecated since 2.1.785. If you are using it right now, please use the new `config.txt` instead. See also the new documentation in the Readme.
|
343 |
+
* The paths in `user_path_config.txt` will still be loaded in recent versions, but it will be removed soon.
|
344 |
+
* We use very user-friendly method to automatically transfer your path settings from `user_path_config.txt` to `config.txt` and usually you do not need to do anything.
|
345 |
+
* The new `config.txt` will never save default values so the default value changes in scripts will not be prevented by old config files.
|
346 |
+
|
347 |
+
# 2.1.782
|
348 |
+
|
349 |
+
2.1.782 is mainly an update for a new LoRA system that supports both SDXL loras and SD1.5 loras.
|
350 |
+
|
351 |
+
Now when you load a lora, the following things will happen:
|
352 |
+
|
353 |
+
1. try to load the lora to the base model, if failed (model mismatch), then try to load the lora to refiner.
|
354 |
+
2. try to load the lora to refiner, if failed (model mismatch) then do nothing.
|
355 |
+
|
356 |
+
In this way, Fooocus 2.1.782 can benefit from all models and loras from CivitAI with both SDXL and SD1.5 ecosystem, using the unique Fooocus swap algorithm, to achieve extremely high quality results (although the default setting is already very high quality), especially in some anime use cases, if users really want to play with all these things.
|
357 |
+
|
358 |
+
Recently the community also developed LCM loras. Users can use it by setting the sampler as 'LCM', scheduler as 'sgm_uniform' (Update in 2.1.798: scheduler should also be "lcm"), the forced overwrite of sampling step as 4 to 8, and CFG guidance as 1.0, in dev tools. Do not forget to change the LCM lora weight to 1.0 (many people forget this and report failure cases). Also, set refiner to None. If LCM's feedback in the artists community is good (not the feedback in the programmer community of Stable Diffusion), Fooocus may add some other shortcuts in the future.
|
359 |
+
|
360 |
+
# 2.1.781
|
361 |
+
|
362 |
+
(2023 Oct 26) Hi all, the feature updating of Fooocus will (really, really, this time) be paused for about two or three weeks because we really have some other workloads. Thanks for the passion of you all (and we in fact have kept updating even after last pausing announcement a week ago, because of many great feedbacks) - see you soon and we will come back in mid November. However, you may still see updates if other collaborators are fixing bugs or solving problems.
|
363 |
+
|
364 |
+
* Disable refiner to speed up when new users mistakenly set same model to base and refiner.
|
365 |
+
|
366 |
+
# 2.1.779
|
367 |
+
|
368 |
+
* Disable image grid by default because many users reports performance issues. For example, https://github.com/lllyasviel/Fooocus/issues/829 and so on. The image grid will cause problem when user hard drive is not super fast, or when user internet connection is not very good (eg, run in remote). The option is moved to dev tools if users want to use it. We will take a look at it later.
|
369 |
+
|
370 |
+
# 2.1.776
|
371 |
+
|
372 |
+
* Support Ctrl+Up/Down Arrow to change prompt emphasizing weights.
|
373 |
+
|
374 |
+
# 2.1.750
|
375 |
+
|
376 |
+
* New UI: now you can get each image during generating.
|
377 |
+
|
378 |
+
# 2.1.743
|
379 |
+
|
380 |
+
* Improved GPT2 by removing some tokens that may corrupt styles.
|
381 |
+
|
382 |
+
# 2.1.741
|
383 |
+
|
384 |
+
Style Updates:
|
385 |
+
|
386 |
+
* "Default (Slightly Cinematic)" as renamed to "Fooocus Cinematic".
|
387 |
+
* "Default (Slightly Cinematic)" is canceled from default style selections.
|
388 |
+
* Added "Fooocus Sharp". This style combines many CivitAI prompts that reduces SDXL blurry and improves sharpness in a relatively natural way.
|
389 |
+
* Added "Fooocus Enhance". This style mainly use the very popular [default negative prompts from JuggernautXL](https://civitai.com/models/133005) and some other enhancing words. JuggernautXL's negative prompt has been proved to be very effective in many recent image posts on CivitAI to improve JuggernautXL and many other models.
|
390 |
+
* "Fooocus Sharp" and "Fooocus Enhance" and "Fooocus V2" becomes the new default set of styles.
|
391 |
+
* Removed the default text in the "negative prompt" input area since it is not necessary now.
|
392 |
+
* You can reproduce previous results by using "Fooocus Cinematic".
|
393 |
+
* "Fooocus Sharp" and "Fooocus Enhance" may undergo minor revision in future updates.
|
394 |
+
|
395 |
+
# 2.1.739
|
396 |
+
|
397 |
+
* Added support for authentication in --share mode (via auth.json).
|
398 |
+
|
399 |
+
# 2.1.737
|
400 |
+
|
401 |
+
* Allowed customizing resolutions in config.
|
402 |
+
|
403 |
+
Modifying this will make results worse if you do not understand how Positional Encoding works.
|
404 |
+
|
405 |
+
You have been warned.
|
406 |
+
|
407 |
+
If you do not know why numbers must be transformed with many Sin and Cos functions (yes, those Trigonometric functions that you learn in junior high school) before they are fed to SDXL, we do not encourage you to change this - you will become a victim of Positional Encoding. You are likely to suffer from an easy-to-fail tool, rather than getting more control.
|
408 |
+
|
409 |
+
Your knowledge gained from SD1.5 (for example, resolution numbers divided by 8 or 64 are good enough for UNet) does not work in SDXL. The SDXL uses Positional Encoding. The SD1.5 does not use Positional Encoding. They are completely different.
|
410 |
+
|
411 |
+
Your knowledge gained from other resources (for example, resolutions around 1024 are good enough for SDXL) is wrong. The SDXL uses Positional Encoding. People who say "all resolutions around 1024 are good" do not understand what is Positional Encoding. They are not intentionally misleading. They are just not aware of the fact that SDXL is using Positional Encoding.
|
412 |
+
|
413 |
+
The number 1152 must be exactly 1152, not 1152-1, not 1152+1, not 1152-8, not 1152+8. The number 1152 must be exactly 1152. Just Google what is a Positional Encoding.
|
414 |
+
|
415 |
+
Again, if you do not understand how Positional Encoding works, just do not change the resolution numbers.
|
416 |
+
|
417 |
+
# 2.1.735
|
418 |
+
|
419 |
+
* Fixed many problems related to torch autocast.
|
420 |
+
|
421 |
+
# 2.1.733
|
422 |
+
|
423 |
+
* Increased allowed random seed range.
|
424 |
+
|
425 |
+
# 2.1.728
|
426 |
+
|
427 |
+
* Fixed some potential numerical problems since 2.1.723
|
428 |
+
|
429 |
+
# 2.1.723
|
430 |
+
|
431 |
+
* Improve Fooocus Anime a bit by using better SD1.5 refining formulation.
|
432 |
+
|
433 |
+
# 2.1.722
|
434 |
+
|
435 |
+
* Now it is possible to translate 100% all texts in the UI.
|
436 |
+
|
437 |
+
# 2.1.721
|
438 |
+
|
439 |
+
* Added language/en.json to make translation easier.
|
440 |
+
|
441 |
+
# 2.1.720
|
442 |
+
|
443 |
+
* Added Canvas Zoom to inpaint canvas
|
444 |
+
* Fixed the problem that image will be cropped in UI when the uploaded image is too wide.
|
445 |
+
|
446 |
+
# 2.1.719
|
447 |
+
|
448 |
+
* I18N
|
449 |
+
|
450 |
+
# 2.1.718
|
451 |
+
|
452 |
+
* Corrected handling dash in wildcard names, more wildcards (extended-color).
|
453 |
+
|
454 |
+
# 2.1.717
|
455 |
+
|
456 |
+
* Corrected displaying multi-line prompts in Private Log.
|
457 |
+
|
458 |
+
# 2.1.716
|
459 |
+
|
460 |
+
* Added support for nested wildcards, more wildcards (flower, color_flower).
|
461 |
+
|
462 |
+
# 2.1.714
|
463 |
+
|
464 |
+
* Fixed resolution problems.
|
465 |
+
|
466 |
+
# 2.1.712
|
467 |
+
|
468 |
+
* Cleaned up Private Log (most users won't need information about raw prompts).
|
469 |
+
|
470 |
+
# 2.1.711
|
471 |
+
|
472 |
+
* Added more information about prompts in Private Log.
|
473 |
+
* Made wildcards in negative prompt use different seed.
|
474 |
+
|
475 |
+
# 2.1.710
|
476 |
+
|
477 |
+
* Added information about wildcards usage in console log.
|
478 |
+
|
479 |
+
# 2.1.709
|
480 |
+
|
481 |
+
* Allowed changing default values of advanced checkbox and image number.
|
482 |
+
|
483 |
+
# 2.1.707
|
484 |
+
|
485 |
+
* Updated Gradio to v3.41.2.
|
486 |
+
|
487 |
+
# 2.1.703
|
488 |
+
|
489 |
+
* Fixed many previous problems related to inpaint.
|
490 |
+
|
491 |
+
# 2.1.702
|
492 |
+
|
493 |
+
* Corrected reading empty negative prompt from config (it shouldn't turn into None).
|
494 |
+
|
495 |
+
# 2.1.701
|
496 |
+
|
497 |
+
* Updated FreeU node to v2 (gives less overcooked results).
|
498 |
+
|
499 |
+
# 2.1.699
|
500 |
+
|
501 |
+
* Disabled smart memory management (solves some memory issues).
|
502 |
+
|
503 |
+
# 2.1.698
|
504 |
+
|
505 |
+
* Added support for loading model files from subfolders.
|
506 |
+
|
507 |
+
# 2.1.696
|
508 |
+
|
509 |
+
* Improved wildcards implementation (using same wildcard multiple times will now return different values).
|
510 |
+
|
511 |
+
**(2023 Oct 18) Again, the feature updating of Fooocus will be paused for about two or three weeks because we have some other workloads - we will come back in early or mid November. However, you may still see updates if other collaborators are fixing bugs or solving problems.**
|
512 |
+
|
513 |
+
# 2.1.695 (requested emergency bug fix)
|
514 |
+
|
515 |
+
* Reduced 3.4GB RAM use when swapping base model.
|
516 |
+
* Reduced 372MB VRAM use in VAE decoding after using control model in image prompt.
|
517 |
+
* Note that Official ComfyUI (d44a2de) will run out of VRAM when using sdxl and control-lora on 2060 6GB that does not support float16 at resolution 1024. Fooocus 2.1.695 succeeded in outputting images without OOM using exactly same devices.
|
518 |
+
|
519 |
+
(2023 Oct 17) Announcement of update being paused.
|
520 |
+
|
521 |
+
# 2.1.693
|
522 |
+
|
523 |
+
* Putting custom styles before pre-defined styles.
|
524 |
+
* Avoided the consusion between Fooocus Anime preset and Fooocus Anime style (Fooocus Anime style is renamed to Fooocus Masterpiece because it does not make images Anime-looking if not using with Fooocus Anime preset).
|
525 |
+
* Fixed some minor bugs in Fooocus Anime preset's prompt emphasizing of commas.
|
526 |
+
* Supported and documented embedding grammar (and wildcards grammar).
|
527 |
+
* This release is a relative stable version and many features are determined now.
|
528 |
+
|
529 |
+
# 2.1.687
|
530 |
+
|
531 |
+
* Added support for wildcards (using files from wildcards folder - try prompts like `__color__ sports car` with different seeds).
|
532 |
+
|
533 |
+
# 2.1.682
|
534 |
+
|
535 |
+
* Added support for custom styles (loaded from JSON files placed in sdxl_styles folder).
|
536 |
+
|
537 |
+
# 2.1.681
|
538 |
+
|
539 |
+
* Added support for generate hotkey (CTRL+ENTER).
|
540 |
+
* Added support for generate forever (RMB on Generate button).
|
541 |
+
* Added support for playing sound when generation is finished ('notification.ogg' or 'notification.mp3').
|
542 |
+
|
543 |
+
# 2.1.62
|
544 |
+
|
545 |
+
* Preset system. Added anime and realistic support.
|
546 |
+
|
547 |
+
# 2.1.52
|
548 |
+
|
549 |
+
* removed pygit2 dependency (expect auto update) so that people will never have permission denied problems.
|
550 |
+
|
551 |
+
# 2.1.50
|
552 |
+
|
553 |
+
* Begin to support sd1.5 as refiner. This method scale sigmas given SD15/Xl latent scale and is probably the most correct way to do it. I am going to write a discussion soon.
|
554 |
+
|
555 |
+
# 2.1.25
|
556 |
+
|
557 |
+
AMD support on Linux and Windows.
|
558 |
+
|
559 |
+
# 2.1.0
|
560 |
+
|
561 |
+
* Image Prompt
|
562 |
+
* Finished the "Moving from Midjourney" Table
|
563 |
+
|
564 |
+
# 2.0.85
|
565 |
+
|
566 |
+
* Speed Up Again
|
567 |
+
|
568 |
+
# 2.0.80
|
569 |
+
|
570 |
+
* Improved the scheduling of ADM guidance and CFG mimicking for better visual quality in high frequency domain and small objects.
|
571 |
+
|
572 |
+
# 2.0.80
|
573 |
+
|
574 |
+
* Rework many patches and some UI details.
|
575 |
+
* Speed up processing.
|
576 |
+
* Move Colab to independent branch.
|
577 |
+
* Implemented CFG Scale and TSNR correction when CFG is bigger than 10.
|
578 |
+
* Implemented Developer Mode with more options to debug.
|
579 |
+
|
580 |
+
### 2.0.72
|
581 |
+
|
582 |
+
(2023 sep 21) The feature updating of Fooocus will be paused for about two or three weeks because we have some events and travelling - we will come back in early or mid October.
|
583 |
+
|
584 |
+
### 2.0.72
|
585 |
+
|
586 |
+
* Allow users to choose path of models.
|
587 |
+
|
588 |
+
### 2.0.65
|
589 |
+
|
590 |
+
* Inpaint model released.
|
591 |
+
|
592 |
+
### 2.0.50
|
593 |
+
|
594 |
+
* Variation/Upscale (Midjourney Toolbar) implemented.
|
595 |
+
|
596 |
+
### 2.0.16
|
597 |
+
|
598 |
+
* Virtual memory system implemented. Now Colab can run both base model and refiner model with 7.8GB RAM + 5.3GB VRAM, and it never crashes.
|
599 |
+
* If you are lucky enough to read this line, keep in mind that ComfyUI cannot do this. This is very reasonable that Fooocus is more optimized because it only need to handle a fixed pipeline, but ComfyUI need to consider arbitrary pipelines.
|
600 |
+
* But if we just consider the optimization of this fixed workload, after 2.0.16, Fooocus has become the most optimized SDXL app, outperforming ComfyUI.
|
601 |
+
|
602 |
+
### 2.0.0
|
603 |
+
|
604 |
+
* V2 released.
|
605 |
+
* completely rewrite text processing pipeline (higher image quality and prompt understanding).
|
606 |
+
* support multi-style.
|
607 |
+
* In 100 tests (prompts written by ChatGPT), V2 default results outperform V1 default results in 87 cases, evaluated by two human.
|
608 |
+
* In 100 tests (prompts written by ChatGPT), V2 prompt understanding outperform V1 prompt understanding in 81 cases, evaluated by two human, in both default setting and multi/single style mode.
|
609 |
+
* Because the above number is above 80%, we view this as a major update and directly jump to 2.0.0.
|
610 |
+
* Some other things are renamed.
|
611 |
+
|
612 |
+
### 1.0.67
|
613 |
+
|
614 |
+
* Use dynamic weighting and lower weights for prompt expansion.
|
615 |
+
|
616 |
+
### 1.0.64
|
617 |
+
|
618 |
+
* Fixed a small OOM problem.
|
619 |
+
|
620 |
+
### 1.0.62
|
621 |
+
|
622 |
+
* Change prompt expansion to suffix mode for better balance of semantic and style (and debugging).
|
623 |
+
|
624 |
+
### 1.0.60
|
625 |
+
|
626 |
+
* Tune the balance between style and Prompt Expansion.
|
627 |
+
|
628 |
+
### 1.0.56
|
629 |
+
|
630 |
+
* Begin to use magic split.
|
631 |
+
|
632 |
+
### 1.0.55
|
633 |
+
|
634 |
+
* Minor changes of Prompt Expansion.
|
635 |
+
|
636 |
+
### 1.0.52
|
637 |
+
|
638 |
+
* Reduce the semantic corruption of Prompt Expansion.
|
639 |
+
|
640 |
+
### 1.0.51
|
641 |
+
|
642 |
+
* Speed up Prompt Expansion a bit.
|
643 |
+
|
644 |
+
### 1.0.50
|
645 |
+
|
646 |
+
* Prompt expansion and a "Raw mode" to turn it off (similar to Midjourney's "raw").
|
647 |
+
|
648 |
+
### 1.0.45
|
649 |
+
|
650 |
+
* Reworked SAG, removed unnecessary patch
|
651 |
+
* Reworked anisotropic filters for faster compute.
|
652 |
+
* Replaced with guided anisotropic filter for less distortion.
|
653 |
+
|
654 |
+
### 1.0.41
|
655 |
+
|
656 |
+
(The update of Fooocus will be paused for a period of time for AUTOMATIC1111 sd-webui 1.6.X, and some features will also be implemented as webui extensions)
|
657 |
+
|
658 |
+
### 1.0.40
|
659 |
+
|
660 |
+
* Behaviors reverted to 1.0.36 again (refiner steps). The 1.0.36 is too perfect and too typical; beating 1.0.36 is just impossible.
|
661 |
+
|
662 |
+
### 1.0.39
|
663 |
+
|
664 |
+
* Reverted unstable changes between 1.0.37 and 1.0.38 .
|
665 |
+
* Increased refiner steps to half of sampling steps.
|
666 |
+
|
667 |
+
### 1.0.36
|
668 |
+
|
669 |
+
* Change gaussian kernel to anisotropic kernel.
|
670 |
+
|
671 |
+
### 1.0.34
|
672 |
+
|
673 |
+
* Random seed restoring.
|
674 |
+
|
675 |
+
### 1.0.33
|
676 |
+
|
677 |
+
* Hide items in log when images are removed.
|
678 |
+
|
679 |
+
### 1.0.32
|
680 |
+
|
681 |
+
* Fooocus private log
|
682 |
+
|
683 |
+
### 1.0.31
|
684 |
+
|
685 |
+
* Fix typo and UI.
|
686 |
+
|
687 |
+
### 1.0.29
|
688 |
+
|
689 |
+
* Added "Advanced->Advanced->Advanced" block for future development.
|
690 |
+
|
691 |
+
### 1.0.29
|
692 |
+
|
693 |
+
* Fix overcook problem in 1.0.28
|
694 |
+
|
695 |
+
### 1.0.28
|
696 |
+
|
697 |
+
* SAG implemented
|
698 |
+
|
699 |
+
### 1.0.27
|
700 |
+
|
701 |
+
* Fix small problem in textbox css
|
702 |
+
|
703 |
+
### 1.0.25
|
704 |
+
|
705 |
+
* support sys.argv --listen --share --port
|
706 |
+
|
707 |
+
### 1.0.24
|
708 |
+
|
709 |
+
* Taller input textbox.
|
710 |
+
|
711 |
+
### 1.0.23
|
712 |
+
|
713 |
+
* Added some hints on linux after UI start so users know the App does not fail.
|
714 |
+
|
715 |
+
### 1.0.20
|
716 |
+
|
717 |
+
* Support linux.
|
718 |
+
|
719 |
+
### 1.0.20
|
720 |
+
|
721 |
+
* Speed-up text encoder.
|
722 |
+
|
723 |
+
### 1.0.20
|
724 |
+
|
725 |
+
* Re-write UI to use async codes: (1) for faster start, and (2) for better live preview.
|
726 |
+
* Removed opencv dependency
|
727 |
+
* Plan to support Linux soon
|
728 |
+
|
729 |
+
### 1.0.19
|
730 |
+
|
731 |
+
* Unlock to allow changing model.
|
732 |
+
|
733 |
+
### 1.0.17
|
734 |
+
|
735 |
+
* Change default model to SDXL-1.0-vae-0.9. (This means the models will be downloaded again, but we should do it as early as possible so that all new users only need to download once. Really sorry for day-0 users. But frankly this is not too late considering that the project is just publicly available in less than 24 hours - if it has been a week then we will prefer more lightweight tricks to update.)
|
736 |
+
|
737 |
+
### 1.0.16
|
738 |
+
|
739 |
+
* Implemented "Fooocus/outputs" folder for saving user results.
|
740 |
+
* Ignored cv2 errors when preview fails.
|
741 |
+
* Mentioned future AMD support in Readme.
|
742 |
+
* Created this log.
|
743 |
+
|
744 |
+
### 1.0.15
|
745 |
+
|
746 |
+
Publicly available.
|
747 |
+
|
748 |
+
### 1.0.0
|
749 |
+
|
750 |
+
Initial Version.
|
webui.py
ADDED
@@ -0,0 +1,1128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import random
|
3 |
+
import os
|
4 |
+
import json
|
5 |
+
import time
|
6 |
+
import shared
|
7 |
+
import modules.config
|
8 |
+
import fooocus_version
|
9 |
+
import modules.html
|
10 |
+
import modules.async_worker as worker
|
11 |
+
import modules.constants as constants
|
12 |
+
import modules.flags as flags
|
13 |
+
import modules.gradio_hijack as grh
|
14 |
+
import modules.style_sorter as style_sorter
|
15 |
+
import modules.meta_parser
|
16 |
+
import args_manager
|
17 |
+
import copy
|
18 |
+
import launch
|
19 |
+
from extras.inpaint_mask import SAMOptions
|
20 |
+
|
21 |
+
from modules.sdxl_styles import legal_style_names
|
22 |
+
from modules.private_logger import get_current_html_path
|
23 |
+
from modules.ui_gradio_extensions import reload_javascript
|
24 |
+
from modules.auth import auth_enabled, check_auth
|
25 |
+
from modules.util import is_json
|
26 |
+
|
27 |
+
def get_task(*args):
|
28 |
+
args = list(args)
|
29 |
+
args.pop(0)
|
30 |
+
|
31 |
+
return worker.AsyncTask(args=args)
|
32 |
+
|
33 |
+
def generate_clicked(task: worker.AsyncTask):
|
34 |
+
import ldm_patched.modules.model_management as model_management
|
35 |
+
|
36 |
+
with model_management.interrupt_processing_mutex:
|
37 |
+
model_management.interrupt_processing = False
|
38 |
+
# outputs=[progress_html, progress_window, progress_gallery, gallery]
|
39 |
+
|
40 |
+
if len(task.args) == 0:
|
41 |
+
return
|
42 |
+
|
43 |
+
execution_start_time = time.perf_counter()
|
44 |
+
finished = False
|
45 |
+
|
46 |
+
yield gr.update(visible=True, value=modules.html.make_progress_html(1, 'Waiting for task to start ...')), \
|
47 |
+
gr.update(visible=True, value=None), \
|
48 |
+
gr.update(visible=False, value=None), \
|
49 |
+
gr.update(visible=False)
|
50 |
+
|
51 |
+
worker.async_tasks.append(task)
|
52 |
+
|
53 |
+
while not finished:
|
54 |
+
time.sleep(0.01)
|
55 |
+
if len(task.yields) > 0:
|
56 |
+
flag, product = task.yields.pop(0)
|
57 |
+
if flag == 'preview':
|
58 |
+
|
59 |
+
# help bad internet connection by skipping duplicated preview
|
60 |
+
if len(task.yields) > 0: # if we have the next item
|
61 |
+
if task.yields[0][0] == 'preview': # if the next item is also a preview
|
62 |
+
# print('Skipped one preview for better internet connection.')
|
63 |
+
continue
|
64 |
+
|
65 |
+
percentage, title, image = product
|
66 |
+
yield gr.update(visible=True, value=modules.html.make_progress_html(percentage, title)), \
|
67 |
+
gr.update(visible=True, value=image) if image is not None else gr.update(), \
|
68 |
+
gr.update(), \
|
69 |
+
gr.update(visible=False)
|
70 |
+
if flag == 'results':
|
71 |
+
yield gr.update(visible=True), \
|
72 |
+
gr.update(visible=True), \
|
73 |
+
gr.update(visible=True, value=product), \
|
74 |
+
gr.update(visible=False)
|
75 |
+
if flag == 'finish':
|
76 |
+
if not args_manager.args.disable_enhance_output_sorting:
|
77 |
+
product = sort_enhance_images(product, task)
|
78 |
+
|
79 |
+
yield gr.update(visible=False), \
|
80 |
+
gr.update(visible=False), \
|
81 |
+
gr.update(visible=False), \
|
82 |
+
gr.update(visible=True, value=product)
|
83 |
+
finished = True
|
84 |
+
|
85 |
+
# delete Fooocus temp images, only keep gradio temp images
|
86 |
+
if args_manager.args.disable_image_log:
|
87 |
+
for filepath in product:
|
88 |
+
if isinstance(filepath, str) and os.path.exists(filepath):
|
89 |
+
os.remove(filepath)
|
90 |
+
|
91 |
+
execution_time = time.perf_counter() - execution_start_time
|
92 |
+
print(f'Total time: {execution_time:.2f} seconds')
|
93 |
+
return
|
94 |
+
|
95 |
+
|
96 |
+
def sort_enhance_images(images, task):
|
97 |
+
if not task.should_enhance or len(images) <= task.images_to_enhance_count:
|
98 |
+
return images
|
99 |
+
|
100 |
+
sorted_images = []
|
101 |
+
walk_index = task.images_to_enhance_count
|
102 |
+
|
103 |
+
for index, enhanced_img in enumerate(images[:task.images_to_enhance_count]):
|
104 |
+
sorted_images.append(enhanced_img)
|
105 |
+
if index not in task.enhance_stats:
|
106 |
+
continue
|
107 |
+
target_index = walk_index + task.enhance_stats[index]
|
108 |
+
if walk_index < len(images) and target_index <= len(images):
|
109 |
+
sorted_images += images[walk_index:target_index]
|
110 |
+
walk_index += task.enhance_stats[index]
|
111 |
+
|
112 |
+
return sorted_images
|
113 |
+
|
114 |
+
|
115 |
+
def inpaint_mode_change(mode, inpaint_engine_version):
|
116 |
+
assert mode in modules.flags.inpaint_options
|
117 |
+
|
118 |
+
# inpaint_additional_prompt, outpaint_selections, example_inpaint_prompts,
|
119 |
+
# inpaint_disable_initial_latent, inpaint_engine,
|
120 |
+
# inpaint_strength, inpaint_respective_field
|
121 |
+
|
122 |
+
if mode == modules.flags.inpaint_option_detail:
|
123 |
+
return [
|
124 |
+
gr.update(visible=True), gr.update(visible=False, value=[]),
|
125 |
+
gr.Dataset.update(visible=True, samples=modules.config.example_inpaint_prompts),
|
126 |
+
False, 'None', 0.5, 0.0
|
127 |
+
]
|
128 |
+
|
129 |
+
if inpaint_engine_version == 'empty':
|
130 |
+
inpaint_engine_version = modules.config.default_inpaint_engine_version
|
131 |
+
|
132 |
+
if mode == modules.flags.inpaint_option_modify:
|
133 |
+
return [
|
134 |
+
gr.update(visible=True), gr.update(visible=False, value=[]),
|
135 |
+
gr.Dataset.update(visible=False, samples=modules.config.example_inpaint_prompts),
|
136 |
+
True, inpaint_engine_version, 1.0, 0.0
|
137 |
+
]
|
138 |
+
|
139 |
+
return [
|
140 |
+
gr.update(visible=False, value=''), gr.update(visible=True),
|
141 |
+
gr.Dataset.update(visible=False, samples=modules.config.example_inpaint_prompts),
|
142 |
+
False, inpaint_engine_version, 1.0, 0.618
|
143 |
+
]
|
144 |
+
|
145 |
+
|
146 |
+
reload_javascript()
|
147 |
+
|
148 |
+
title = f'Fooocus {fooocus_version.version}'
|
149 |
+
|
150 |
+
if isinstance(args_manager.args.preset, str):
|
151 |
+
title += ' ' + args_manager.args.preset
|
152 |
+
|
153 |
+
shared.gradio_root = gr.Blocks(title=title).queue()
|
154 |
+
|
155 |
+
with shared.gradio_root:
|
156 |
+
currentTask = gr.State(worker.AsyncTask(args=[]))
|
157 |
+
inpaint_engine_state = gr.State('empty')
|
158 |
+
with gr.Row():
|
159 |
+
with gr.Column(scale=2):
|
160 |
+
with gr.Row():
|
161 |
+
progress_window = grh.Image(label='Preview', show_label=True, visible=False, height=768,
|
162 |
+
elem_classes=['main_view'])
|
163 |
+
progress_gallery = gr.Gallery(label='Finished Images', show_label=True, object_fit='contain',
|
164 |
+
height=768, visible=False, elem_classes=['main_view', 'image_gallery'])
|
165 |
+
progress_html = gr.HTML(value=modules.html.make_progress_html(32, 'Progress 32%'), visible=False,
|
166 |
+
elem_id='progress-bar', elem_classes='progress-bar')
|
167 |
+
gallery = gr.Gallery(label='Gallery', show_label=False, object_fit='contain', visible=True, height=768,
|
168 |
+
elem_classes=['resizable_area', 'main_view', 'final_gallery', 'image_gallery'],
|
169 |
+
elem_id='final_gallery')
|
170 |
+
with gr.Row():
|
171 |
+
with gr.Column(scale=17):
|
172 |
+
prompt = gr.Textbox(show_label=False, placeholder="Type prompt here or paste parameters.", elem_id='positive_prompt',
|
173 |
+
autofocus=True, lines=3)
|
174 |
+
|
175 |
+
default_prompt = modules.config.default_prompt
|
176 |
+
if isinstance(default_prompt, str) and default_prompt != '':
|
177 |
+
shared.gradio_root.load(lambda: default_prompt, outputs=prompt)
|
178 |
+
|
179 |
+
with gr.Column(scale=3, min_width=0):
|
180 |
+
generate_button = gr.Button(label="Generate", value="Generate", elem_classes='type_row', elem_id='generate_button', visible=True)
|
181 |
+
reset_button = gr.Button(label="Reconnect", value="Reconnect", elem_classes='type_row', elem_id='reset_button', visible=False)
|
182 |
+
load_parameter_button = gr.Button(label="Load Parameters", value="Load Parameters", elem_classes='type_row', elem_id='load_parameter_button', visible=False)
|
183 |
+
skip_button = gr.Button(label="Skip", value="Skip", elem_classes='type_row_half', elem_id='skip_button', visible=False)
|
184 |
+
stop_button = gr.Button(label="Stop", value="Stop", elem_classes='type_row_half', elem_id='stop_button', visible=False)
|
185 |
+
|
186 |
+
def stop_clicked(currentTask):
|
187 |
+
import ldm_patched.modules.model_management as model_management
|
188 |
+
currentTask.last_stop = 'stop'
|
189 |
+
if (currentTask.processing):
|
190 |
+
model_management.interrupt_current_processing()
|
191 |
+
return currentTask
|
192 |
+
|
193 |
+
def skip_clicked(currentTask):
|
194 |
+
import ldm_patched.modules.model_management as model_management
|
195 |
+
currentTask.last_stop = 'skip'
|
196 |
+
if (currentTask.processing):
|
197 |
+
model_management.interrupt_current_processing()
|
198 |
+
return currentTask
|
199 |
+
|
200 |
+
stop_button.click(stop_clicked, inputs=currentTask, outputs=currentTask, queue=False, show_progress=False, _js='cancelGenerateForever')
|
201 |
+
skip_button.click(skip_clicked, inputs=currentTask, outputs=currentTask, queue=False, show_progress=False)
|
202 |
+
with gr.Row(elem_classes='advanced_check_row'):
|
203 |
+
input_image_checkbox = gr.Checkbox(label='Input Image', value=modules.config.default_image_prompt_checkbox, container=False, elem_classes='min_check')
|
204 |
+
enhance_checkbox = gr.Checkbox(label='Enhance', value=modules.config.default_enhance_checkbox, container=False, elem_classes='min_check')
|
205 |
+
advanced_checkbox = gr.Checkbox(label='Advanced', value=modules.config.default_advanced_checkbox, container=False, elem_classes='min_check')
|
206 |
+
with gr.Row(visible=modules.config.default_image_prompt_checkbox) as image_input_panel:
|
207 |
+
with gr.Tabs(selected=modules.config.default_selected_image_input_tab_id):
|
208 |
+
with gr.Tab(label='Upscale or Variation', id='uov_tab') as uov_tab:
|
209 |
+
with gr.Row():
|
210 |
+
with gr.Column():
|
211 |
+
uov_input_image = grh.Image(label='Image', source='upload', type='numpy', show_label=False)
|
212 |
+
with gr.Column():
|
213 |
+
uov_method = gr.Radio(label='Upscale or Variation:', choices=flags.uov_list, value=modules.config.default_uov_method)
|
214 |
+
gr.HTML('<a href="https://github.com/lllyasviel/Fooocus/discussions/390" target="_blank">\U0001F4D4 Documentation</a>')
|
215 |
+
with gr.Tab(label='Image Prompt', id='ip_tab') as ip_tab:
|
216 |
+
with gr.Row():
|
217 |
+
ip_images = []
|
218 |
+
ip_types = []
|
219 |
+
ip_stops = []
|
220 |
+
ip_weights = []
|
221 |
+
ip_ctrls = []
|
222 |
+
ip_ad_cols = []
|
223 |
+
for image_count in range(modules.config.default_controlnet_image_count):
|
224 |
+
image_count += 1
|
225 |
+
with gr.Column():
|
226 |
+
ip_image = grh.Image(label='Image', source='upload', type='numpy', show_label=False, height=300, value=modules.config.default_ip_images[image_count])
|
227 |
+
ip_images.append(ip_image)
|
228 |
+
ip_ctrls.append(ip_image)
|
229 |
+
with gr.Column(visible=modules.config.default_image_prompt_advanced_checkbox) as ad_col:
|
230 |
+
with gr.Row():
|
231 |
+
ip_stop = gr.Slider(label='Stop At', minimum=0.0, maximum=1.0, step=0.001, value=modules.config.default_ip_stop_ats[image_count])
|
232 |
+
ip_stops.append(ip_stop)
|
233 |
+
ip_ctrls.append(ip_stop)
|
234 |
+
|
235 |
+
ip_weight = gr.Slider(label='Weight', minimum=0.0, maximum=2.0, step=0.001, value=modules.config.default_ip_weights[image_count])
|
236 |
+
ip_weights.append(ip_weight)
|
237 |
+
ip_ctrls.append(ip_weight)
|
238 |
+
|
239 |
+
ip_type = gr.Radio(label='Type', choices=flags.ip_list, value=modules.config.default_ip_types[image_count], container=False)
|
240 |
+
ip_types.append(ip_type)
|
241 |
+
ip_ctrls.append(ip_type)
|
242 |
+
|
243 |
+
ip_type.change(lambda x: flags.default_parameters[x], inputs=[ip_type], outputs=[ip_stop, ip_weight], queue=False, show_progress=False)
|
244 |
+
ip_ad_cols.append(ad_col)
|
245 |
+
ip_advanced = gr.Checkbox(label='Advanced', value=modules.config.default_image_prompt_advanced_checkbox, container=False)
|
246 |
+
gr.HTML('* \"Image Prompt\" is powered by Fooocus Image Mixture Engine (v1.0.1). <a href="https://github.com/lllyasviel/Fooocus/discussions/557" target="_blank">\U0001F4D4 Documentation</a>')
|
247 |
+
|
248 |
+
def ip_advance_checked(x):
|
249 |
+
return [gr.update(visible=x)] * len(ip_ad_cols) + \
|
250 |
+
[flags.default_ip] * len(ip_types) + \
|
251 |
+
[flags.default_parameters[flags.default_ip][0]] * len(ip_stops) + \
|
252 |
+
[flags.default_parameters[flags.default_ip][1]] * len(ip_weights)
|
253 |
+
|
254 |
+
ip_advanced.change(ip_advance_checked, inputs=ip_advanced,
|
255 |
+
outputs=ip_ad_cols + ip_types + ip_stops + ip_weights,
|
256 |
+
queue=False, show_progress=False)
|
257 |
+
|
258 |
+
with gr.Tab(label='Inpaint or Outpaint', id='inpaint_tab') as inpaint_tab:
|
259 |
+
with gr.Row():
|
260 |
+
with gr.Column():
|
261 |
+
inpaint_input_image = grh.Image(label='Image', source='upload', type='numpy', tool='sketch', height=500, brush_color="#FFFFFF", elem_id='inpaint_canvas', show_label=False)
|
262 |
+
inpaint_advanced_masking_checkbox = gr.Checkbox(label='Enable Advanced Masking Features', value=modules.config.default_inpaint_advanced_masking_checkbox)
|
263 |
+
inpaint_mode = gr.Dropdown(choices=modules.flags.inpaint_options, value=modules.config.default_inpaint_method, label='Method')
|
264 |
+
inpaint_additional_prompt = gr.Textbox(placeholder="Describe what you want to inpaint.", elem_id='inpaint_additional_prompt', label='Inpaint Additional Prompt', visible=False)
|
265 |
+
outpaint_selections = gr.CheckboxGroup(choices=['Left', 'Right', 'Top', 'Bottom'], value=[], label='Outpaint Direction')
|
266 |
+
example_inpaint_prompts = gr.Dataset(samples=modules.config.example_inpaint_prompts,
|
267 |
+
label='Additional Prompt Quick List',
|
268 |
+
components=[inpaint_additional_prompt],
|
269 |
+
visible=False)
|
270 |
+
gr.HTML('* Powered by Fooocus Inpaint Engine <a href="https://github.com/lllyasviel/Fooocus/discussions/414" target="_blank">\U0001F4D4 Documentation</a>')
|
271 |
+
example_inpaint_prompts.click(lambda x: x[0], inputs=example_inpaint_prompts, outputs=inpaint_additional_prompt, show_progress=False, queue=False)
|
272 |
+
|
273 |
+
with gr.Column(visible=modules.config.default_inpaint_advanced_masking_checkbox) as inpaint_mask_generation_col:
|
274 |
+
inpaint_mask_image = grh.Image(label='Mask Upload', source='upload', type='numpy', tool='sketch', height=500, brush_color="#FFFFFF", mask_opacity=1, elem_id='inpaint_mask_canvas')
|
275 |
+
invert_mask_checkbox = gr.Checkbox(label='Invert Mask When Generating', value=modules.config.default_invert_mask_checkbox)
|
276 |
+
inpaint_mask_model = gr.Dropdown(label='Mask generation model',
|
277 |
+
choices=flags.inpaint_mask_models,
|
278 |
+
value=modules.config.default_inpaint_mask_model)
|
279 |
+
inpaint_mask_cloth_category = gr.Dropdown(label='Cloth category',
|
280 |
+
choices=flags.inpaint_mask_cloth_category,
|
281 |
+
value=modules.config.default_inpaint_mask_cloth_category,
|
282 |
+
visible=False)
|
283 |
+
inpaint_mask_dino_prompt_text = gr.Textbox(label='Detection prompt', value='', visible=False, info='Use singular whenever possible', placeholder='Describe what you want to detect.')
|
284 |
+
example_inpaint_mask_dino_prompt_text = gr.Dataset(
|
285 |
+
samples=modules.config.example_enhance_detection_prompts,
|
286 |
+
label='Detection Prompt Quick List',
|
287 |
+
components=[inpaint_mask_dino_prompt_text],
|
288 |
+
visible=modules.config.default_inpaint_mask_model == 'sam')
|
289 |
+
example_inpaint_mask_dino_prompt_text.click(lambda x: x[0],
|
290 |
+
inputs=example_inpaint_mask_dino_prompt_text,
|
291 |
+
outputs=inpaint_mask_dino_prompt_text,
|
292 |
+
show_progress=False, queue=False)
|
293 |
+
|
294 |
+
with gr.Accordion("Advanced options", visible=False, open=False) as inpaint_mask_advanced_options:
|
295 |
+
inpaint_mask_sam_model = gr.Dropdown(label='SAM model', choices=flags.inpaint_mask_sam_model, value=modules.config.default_inpaint_mask_sam_model)
|
296 |
+
inpaint_mask_box_threshold = gr.Slider(label="Box Threshold", minimum=0.0, maximum=1.0, value=0.3, step=0.05)
|
297 |
+
inpaint_mask_text_threshold = gr.Slider(label="Text Threshold", minimum=0.0, maximum=1.0, value=0.25, step=0.05)
|
298 |
+
inpaint_mask_sam_max_detections = gr.Slider(label="Maximum number of detections", info="Set to 0 to detect all", minimum=0, maximum=10, value=modules.config.default_sam_max_detections, step=1, interactive=True)
|
299 |
+
generate_mask_button = gr.Button(value='Generate mask from image')
|
300 |
+
|
301 |
+
def generate_mask(image, mask_model, cloth_category, dino_prompt_text, sam_model, box_threshold, text_threshold, sam_max_detections, dino_erode_or_dilate, dino_debug):
|
302 |
+
from extras.inpaint_mask import generate_mask_from_image
|
303 |
+
|
304 |
+
extras = {}
|
305 |
+
sam_options = None
|
306 |
+
if mask_model == 'u2net_cloth_seg':
|
307 |
+
extras['cloth_category'] = cloth_category
|
308 |
+
elif mask_model == 'sam':
|
309 |
+
sam_options = SAMOptions(
|
310 |
+
dino_prompt=dino_prompt_text,
|
311 |
+
dino_box_threshold=box_threshold,
|
312 |
+
dino_text_threshold=text_threshold,
|
313 |
+
dino_erode_or_dilate=dino_erode_or_dilate,
|
314 |
+
dino_debug=dino_debug,
|
315 |
+
max_detections=sam_max_detections,
|
316 |
+
model_type=sam_model
|
317 |
+
)
|
318 |
+
|
319 |
+
mask, _, _, _ = generate_mask_from_image(image, mask_model, extras, sam_options)
|
320 |
+
|
321 |
+
return mask
|
322 |
+
|
323 |
+
|
324 |
+
inpaint_mask_model.change(lambda x: [gr.update(visible=x == 'u2net_cloth_seg')] +
|
325 |
+
[gr.update(visible=x == 'sam')] * 2 +
|
326 |
+
[gr.Dataset.update(visible=x == 'sam',
|
327 |
+
samples=modules.config.example_enhance_detection_prompts)],
|
328 |
+
inputs=inpaint_mask_model,
|
329 |
+
outputs=[inpaint_mask_cloth_category,
|
330 |
+
inpaint_mask_dino_prompt_text,
|
331 |
+
inpaint_mask_advanced_options,
|
332 |
+
example_inpaint_mask_dino_prompt_text],
|
333 |
+
queue=False, show_progress=False)
|
334 |
+
|
335 |
+
with gr.Tab(label='Describe', id='describe_tab') as describe_tab:
|
336 |
+
with gr.Row():
|
337 |
+
with gr.Column():
|
338 |
+
describe_input_image = grh.Image(label='Image', source='upload', type='numpy', show_label=False)
|
339 |
+
with gr.Column():
|
340 |
+
describe_methods = gr.CheckboxGroup(
|
341 |
+
label='Content Type',
|
342 |
+
choices=flags.describe_types,
|
343 |
+
value=modules.config.default_describe_content_type)
|
344 |
+
describe_apply_styles = gr.Checkbox(label='Apply Styles', value=modules.config.default_describe_apply_prompts_checkbox)
|
345 |
+
describe_btn = gr.Button(value='Describe this Image into Prompt')
|
346 |
+
describe_image_size = gr.Textbox(label='Image Size and Recommended Size', elem_id='describe_image_size', visible=False)
|
347 |
+
gr.HTML('<a href="https://github.com/lllyasviel/Fooocus/discussions/1363" target="_blank">\U0001F4D4 Documentation</a>')
|
348 |
+
|
349 |
+
def trigger_show_image_properties(image):
|
350 |
+
value = modules.util.get_image_size_info(image, modules.flags.sdxl_aspect_ratios)
|
351 |
+
return gr.update(value=value, visible=True)
|
352 |
+
|
353 |
+
describe_input_image.upload(trigger_show_image_properties, inputs=describe_input_image,
|
354 |
+
outputs=describe_image_size, show_progress=False, queue=False)
|
355 |
+
|
356 |
+
with gr.Tab(label='Enhance', id='enhance_tab') as enhance_tab:
|
357 |
+
with gr.Row():
|
358 |
+
with gr.Column():
|
359 |
+
enhance_input_image = grh.Image(label='Use with Enhance, skips image generation', source='upload', type='numpy')
|
360 |
+
gr.HTML('<a href="https://github.com/lllyasviel/Fooocus/discussions/3281" target="_blank">\U0001F4D4 Documentation</a>')
|
361 |
+
|
362 |
+
with gr.Tab(label='Metadata', id='metadata_tab') as metadata_tab:
|
363 |
+
with gr.Column():
|
364 |
+
metadata_input_image = grh.Image(label='For images created by Fooocus', source='upload', type='pil')
|
365 |
+
metadata_json = gr.JSON(label='Metadata')
|
366 |
+
metadata_import_button = gr.Button(value='Apply Metadata')
|
367 |
+
|
368 |
+
def trigger_metadata_preview(file):
|
369 |
+
parameters, metadata_scheme = modules.meta_parser.read_info_from_image(file)
|
370 |
+
|
371 |
+
results = {}
|
372 |
+
if parameters is not None:
|
373 |
+
results['parameters'] = parameters
|
374 |
+
|
375 |
+
if isinstance(metadata_scheme, flags.MetadataScheme):
|
376 |
+
results['metadata_scheme'] = metadata_scheme.value
|
377 |
+
|
378 |
+
return results
|
379 |
+
|
380 |
+
metadata_input_image.upload(trigger_metadata_preview, inputs=metadata_input_image,
|
381 |
+
outputs=metadata_json, queue=False, show_progress=True)
|
382 |
+
|
383 |
+
with gr.Row(visible=modules.config.default_enhance_checkbox) as enhance_input_panel:
|
384 |
+
with gr.Tabs():
|
385 |
+
with gr.Tab(label='Upscale or Variation'):
|
386 |
+
with gr.Row():
|
387 |
+
with gr.Column():
|
388 |
+
enhance_uov_method = gr.Radio(label='Upscale or Variation:', choices=flags.uov_list,
|
389 |
+
value=modules.config.default_enhance_uov_method)
|
390 |
+
enhance_uov_processing_order = gr.Radio(label='Order of Processing',
|
391 |
+
info='Use before to enhance small details and after to enhance large areas.',
|
392 |
+
choices=flags.enhancement_uov_processing_order,
|
393 |
+
value=modules.config.default_enhance_uov_processing_order)
|
394 |
+
enhance_uov_prompt_type = gr.Radio(label='Prompt',
|
395 |
+
info='Choose which prompt to use for Upscale or Variation.',
|
396 |
+
choices=flags.enhancement_uov_prompt_types,
|
397 |
+
value=modules.config.default_enhance_uov_prompt_type,
|
398 |
+
visible=modules.config.default_enhance_uov_processing_order == flags.enhancement_uov_after)
|
399 |
+
|
400 |
+
enhance_uov_processing_order.change(lambda x: gr.update(visible=x == flags.enhancement_uov_after),
|
401 |
+
inputs=enhance_uov_processing_order,
|
402 |
+
outputs=enhance_uov_prompt_type,
|
403 |
+
queue=False, show_progress=False)
|
404 |
+
gr.HTML('<a href="https://github.com/lllyasviel/Fooocus/discussions/3281" target="_blank">\U0001F4D4 Documentation</a>')
|
405 |
+
enhance_ctrls = []
|
406 |
+
enhance_inpaint_mode_ctrls = []
|
407 |
+
enhance_inpaint_engine_ctrls = []
|
408 |
+
enhance_inpaint_update_ctrls = []
|
409 |
+
for index in range(modules.config.default_enhance_tabs):
|
410 |
+
with gr.Tab(label=f'#{index + 1}') as enhance_tab_item:
|
411 |
+
enhance_enabled = gr.Checkbox(label='Enable', value=False, elem_classes='min_check',
|
412 |
+
container=False)
|
413 |
+
|
414 |
+
enhance_mask_dino_prompt_text = gr.Textbox(label='Detection prompt',
|
415 |
+
info='Use singular whenever possible',
|
416 |
+
placeholder='Describe what you want to detect.',
|
417 |
+
interactive=True,
|
418 |
+
visible=modules.config.default_enhance_inpaint_mask_model == 'sam')
|
419 |
+
example_enhance_mask_dino_prompt_text = gr.Dataset(
|
420 |
+
samples=modules.config.example_enhance_detection_prompts,
|
421 |
+
label='Detection Prompt Quick List',
|
422 |
+
components=[enhance_mask_dino_prompt_text],
|
423 |
+
visible=modules.config.default_enhance_inpaint_mask_model == 'sam')
|
424 |
+
example_enhance_mask_dino_prompt_text.click(lambda x: x[0],
|
425 |
+
inputs=example_enhance_mask_dino_prompt_text,
|
426 |
+
outputs=enhance_mask_dino_prompt_text,
|
427 |
+
show_progress=False, queue=False)
|
428 |
+
|
429 |
+
enhance_prompt = gr.Textbox(label="Enhancement positive prompt",
|
430 |
+
placeholder="Uses original prompt instead if empty.",
|
431 |
+
elem_id='enhance_prompt')
|
432 |
+
enhance_negative_prompt = gr.Textbox(label="Enhancement negative prompt",
|
433 |
+
placeholder="Uses original negative prompt instead if empty.",
|
434 |
+
elem_id='enhance_negative_prompt')
|
435 |
+
|
436 |
+
with gr.Accordion("Detection", open=False):
|
437 |
+
enhance_mask_model = gr.Dropdown(label='Mask generation model',
|
438 |
+
choices=flags.inpaint_mask_models,
|
439 |
+
value=modules.config.default_enhance_inpaint_mask_model)
|
440 |
+
enhance_mask_cloth_category = gr.Dropdown(label='Cloth category',
|
441 |
+
choices=flags.inpaint_mask_cloth_category,
|
442 |
+
value=modules.config.default_inpaint_mask_cloth_category,
|
443 |
+
visible=modules.config.default_enhance_inpaint_mask_model == 'u2net_cloth_seg',
|
444 |
+
interactive=True)
|
445 |
+
|
446 |
+
with gr.Accordion("SAM Options",
|
447 |
+
visible=modules.config.default_enhance_inpaint_mask_model == 'sam',
|
448 |
+
open=False) as sam_options:
|
449 |
+
enhance_mask_sam_model = gr.Dropdown(label='SAM model',
|
450 |
+
choices=flags.inpaint_mask_sam_model,
|
451 |
+
value=modules.config.default_inpaint_mask_sam_model,
|
452 |
+
interactive=True)
|
453 |
+
enhance_mask_box_threshold = gr.Slider(label="Box Threshold", minimum=0.0,
|
454 |
+
maximum=1.0, value=0.3, step=0.05,
|
455 |
+
interactive=True)
|
456 |
+
enhance_mask_text_threshold = gr.Slider(label="Text Threshold", minimum=0.0,
|
457 |
+
maximum=1.0, value=0.25, step=0.05,
|
458 |
+
interactive=True)
|
459 |
+
enhance_mask_sam_max_detections = gr.Slider(label="Maximum number of detections",
|
460 |
+
info="Set to 0 to detect all",
|
461 |
+
minimum=0, maximum=10,
|
462 |
+
value=modules.config.default_sam_max_detections,
|
463 |
+
step=1, interactive=True)
|
464 |
+
|
465 |
+
with gr.Accordion("Inpaint", visible=True, open=False):
|
466 |
+
enhance_inpaint_mode = gr.Dropdown(choices=modules.flags.inpaint_options,
|
467 |
+
value=modules.config.default_inpaint_method,
|
468 |
+
label='Method', interactive=True)
|
469 |
+
enhance_inpaint_disable_initial_latent = gr.Checkbox(
|
470 |
+
label='Disable initial latent in inpaint', value=False)
|
471 |
+
enhance_inpaint_engine = gr.Dropdown(label='Inpaint Engine',
|
472 |
+
value=modules.config.default_inpaint_engine_version,
|
473 |
+
choices=flags.inpaint_engine_versions,
|
474 |
+
info='Version of Fooocus inpaint model. If set, use performance Quality or Speed (no performance LoRAs) for best results.')
|
475 |
+
enhance_inpaint_strength = gr.Slider(label='Inpaint Denoising Strength',
|
476 |
+
minimum=0.0, maximum=1.0, step=0.001,
|
477 |
+
value=1.0,
|
478 |
+
info='Same as the denoising strength in A1111 inpaint. '
|
479 |
+
'Only used in inpaint, not used in outpaint. '
|
480 |
+
'(Outpaint always use 1.0)')
|
481 |
+
enhance_inpaint_respective_field = gr.Slider(label='Inpaint Respective Field',
|
482 |
+
minimum=0.0, maximum=1.0, step=0.001,
|
483 |
+
value=0.618,
|
484 |
+
info='The area to inpaint. '
|
485 |
+
'Value 0 is same as "Only Masked" in A1111. '
|
486 |
+
'Value 1 is same as "Whole Image" in A1111. '
|
487 |
+
'Only used in inpaint, not used in outpaint. '
|
488 |
+
'(Outpaint always use 1.0)')
|
489 |
+
enhance_inpaint_erode_or_dilate = gr.Slider(label='Mask Erode or Dilate',
|
490 |
+
minimum=-64, maximum=64, step=1, value=0,
|
491 |
+
info='Positive value will make white area in the mask larger, '
|
492 |
+
'negative value will make white area smaller. '
|
493 |
+
'(default is 0, always processed before any mask invert)')
|
494 |
+
enhance_mask_invert = gr.Checkbox(label='Invert Mask', value=False)
|
495 |
+
|
496 |
+
gr.HTML('<a href="https://github.com/lllyasviel/Fooocus/discussions/3281" target="_blank">\U0001F4D4 Documentation</a>')
|
497 |
+
|
498 |
+
enhance_ctrls += [
|
499 |
+
enhance_enabled,
|
500 |
+
enhance_mask_dino_prompt_text,
|
501 |
+
enhance_prompt,
|
502 |
+
enhance_negative_prompt,
|
503 |
+
enhance_mask_model,
|
504 |
+
enhance_mask_cloth_category,
|
505 |
+
enhance_mask_sam_model,
|
506 |
+
enhance_mask_text_threshold,
|
507 |
+
enhance_mask_box_threshold,
|
508 |
+
enhance_mask_sam_max_detections,
|
509 |
+
enhance_inpaint_disable_initial_latent,
|
510 |
+
enhance_inpaint_engine,
|
511 |
+
enhance_inpaint_strength,
|
512 |
+
enhance_inpaint_respective_field,
|
513 |
+
enhance_inpaint_erode_or_dilate,
|
514 |
+
enhance_mask_invert
|
515 |
+
]
|
516 |
+
|
517 |
+
enhance_inpaint_mode_ctrls += [enhance_inpaint_mode]
|
518 |
+
enhance_inpaint_engine_ctrls += [enhance_inpaint_engine]
|
519 |
+
|
520 |
+
enhance_inpaint_update_ctrls += [[
|
521 |
+
enhance_inpaint_mode, enhance_inpaint_disable_initial_latent, enhance_inpaint_engine,
|
522 |
+
enhance_inpaint_strength, enhance_inpaint_respective_field
|
523 |
+
]]
|
524 |
+
|
525 |
+
enhance_inpaint_mode.change(inpaint_mode_change, inputs=[enhance_inpaint_mode, inpaint_engine_state], outputs=[
|
526 |
+
inpaint_additional_prompt, outpaint_selections, example_inpaint_prompts,
|
527 |
+
enhance_inpaint_disable_initial_latent, enhance_inpaint_engine,
|
528 |
+
enhance_inpaint_strength, enhance_inpaint_respective_field
|
529 |
+
], show_progress=False, queue=False)
|
530 |
+
|
531 |
+
enhance_mask_model.change(
|
532 |
+
lambda x: [gr.update(visible=x == 'u2net_cloth_seg')] +
|
533 |
+
[gr.update(visible=x == 'sam')] * 2 +
|
534 |
+
[gr.Dataset.update(visible=x == 'sam',
|
535 |
+
samples=modules.config.example_enhance_detection_prompts)],
|
536 |
+
inputs=enhance_mask_model,
|
537 |
+
outputs=[enhance_mask_cloth_category, enhance_mask_dino_prompt_text, sam_options,
|
538 |
+
example_enhance_mask_dino_prompt_text],
|
539 |
+
queue=False, show_progress=False)
|
540 |
+
|
541 |
+
switch_js = "(x) => {if(x){viewer_to_bottom(100);viewer_to_bottom(500);}else{viewer_to_top();} return x;}"
|
542 |
+
down_js = "() => {viewer_to_bottom();}"
|
543 |
+
|
544 |
+
input_image_checkbox.change(lambda x: gr.update(visible=x), inputs=input_image_checkbox,
|
545 |
+
outputs=image_input_panel, queue=False, show_progress=False, _js=switch_js)
|
546 |
+
ip_advanced.change(lambda: None, queue=False, show_progress=False, _js=down_js)
|
547 |
+
|
548 |
+
current_tab = gr.Textbox(value='uov', visible=False)
|
549 |
+
uov_tab.select(lambda: 'uov', outputs=current_tab, queue=False, _js=down_js, show_progress=False)
|
550 |
+
inpaint_tab.select(lambda: 'inpaint', outputs=current_tab, queue=False, _js=down_js, show_progress=False)
|
551 |
+
ip_tab.select(lambda: 'ip', outputs=current_tab, queue=False, _js=down_js, show_progress=False)
|
552 |
+
describe_tab.select(lambda: 'desc', outputs=current_tab, queue=False, _js=down_js, show_progress=False)
|
553 |
+
enhance_tab.select(lambda: 'enhance', outputs=current_tab, queue=False, _js=down_js, show_progress=False)
|
554 |
+
metadata_tab.select(lambda: 'metadata', outputs=current_tab, queue=False, _js=down_js, show_progress=False)
|
555 |
+
enhance_checkbox.change(lambda x: gr.update(visible=x), inputs=enhance_checkbox,
|
556 |
+
outputs=enhance_input_panel, queue=False, show_progress=False, _js=switch_js)
|
557 |
+
|
558 |
+
with gr.Column(scale=1, visible=modules.config.default_advanced_checkbox) as advanced_column:
|
559 |
+
with gr.Tab(label='Settings'):
|
560 |
+
if not args_manager.args.disable_preset_selection:
|
561 |
+
preset_selection = gr.Dropdown(label='Preset',
|
562 |
+
choices=modules.config.available_presets,
|
563 |
+
value=args_manager.args.preset if args_manager.args.preset else "initial",
|
564 |
+
interactive=True)
|
565 |
+
|
566 |
+
performance_selection = gr.Radio(label='Performance',
|
567 |
+
choices=flags.Performance.values(),
|
568 |
+
value=modules.config.default_performance,
|
569 |
+
elem_classes=['performance_selection'])
|
570 |
+
|
571 |
+
with gr.Accordion(label='Aspect Ratios', open=False, elem_id='aspect_ratios_accordion') as aspect_ratios_accordion:
|
572 |
+
aspect_ratios_selection = gr.Radio(label='Aspect Ratios', show_label=False,
|
573 |
+
choices=modules.config.available_aspect_ratios_labels,
|
574 |
+
value=modules.config.default_aspect_ratio,
|
575 |
+
info='width × height',
|
576 |
+
elem_classes='aspect_ratios')
|
577 |
+
|
578 |
+
aspect_ratios_selection.change(lambda x: None, inputs=aspect_ratios_selection, queue=False, show_progress=False, _js='(x)=>{refresh_aspect_ratios_label(x);}')
|
579 |
+
shared.gradio_root.load(lambda x: None, inputs=aspect_ratios_selection, queue=False, show_progress=False, _js='(x)=>{refresh_aspect_ratios_label(x);}')
|
580 |
+
|
581 |
+
image_number = gr.Slider(label='Image Number', minimum=1, maximum=modules.config.default_max_image_number, step=1, value=modules.config.default_image_number)
|
582 |
+
|
583 |
+
output_format = gr.Radio(label='Output Format',
|
584 |
+
choices=flags.OutputFormat.list(),
|
585 |
+
value=modules.config.default_output_format)
|
586 |
+
|
587 |
+
negative_prompt = gr.Textbox(label='Negative Prompt', show_label=True, placeholder="Type prompt here.",
|
588 |
+
info='Describing what you do not want to see.', lines=2,
|
589 |
+
elem_id='negative_prompt',
|
590 |
+
value=modules.config.default_prompt_negative)
|
591 |
+
seed_random = gr.Checkbox(label='Random', value=True)
|
592 |
+
image_seed = gr.Textbox(label='Seed', value=0, max_lines=1, visible=False) # workaround for https://github.com/gradio-app/gradio/issues/5354
|
593 |
+
|
594 |
+
def random_checked(r):
|
595 |
+
return gr.update(visible=not r)
|
596 |
+
|
597 |
+
def refresh_seed(r, seed_string):
|
598 |
+
if r:
|
599 |
+
return random.randint(constants.MIN_SEED, constants.MAX_SEED)
|
600 |
+
else:
|
601 |
+
try:
|
602 |
+
seed_value = int(seed_string)
|
603 |
+
if constants.MIN_SEED <= seed_value <= constants.MAX_SEED:
|
604 |
+
return seed_value
|
605 |
+
except ValueError:
|
606 |
+
pass
|
607 |
+
return random.randint(constants.MIN_SEED, constants.MAX_SEED)
|
608 |
+
|
609 |
+
seed_random.change(random_checked, inputs=[seed_random], outputs=[image_seed],
|
610 |
+
queue=False, show_progress=False)
|
611 |
+
|
612 |
+
def update_history_link():
|
613 |
+
if args_manager.args.disable_image_log:
|
614 |
+
return gr.update(value='')
|
615 |
+
|
616 |
+
return gr.update(value=f'<a href="file={get_current_html_path(output_format)}" target="_blank">\U0001F4DA History Log</a>')
|
617 |
+
|
618 |
+
history_link = gr.HTML()
|
619 |
+
shared.gradio_root.load(update_history_link, outputs=history_link, queue=False, show_progress=False)
|
620 |
+
|
621 |
+
with gr.Tab(label='Styles', elem_classes=['style_selections_tab']):
|
622 |
+
style_sorter.try_load_sorted_styles(
|
623 |
+
style_names=legal_style_names,
|
624 |
+
default_selected=modules.config.default_styles)
|
625 |
+
|
626 |
+
style_search_bar = gr.Textbox(show_label=False, container=False,
|
627 |
+
placeholder="\U0001F50E Type here to search styles ...",
|
628 |
+
value="",
|
629 |
+
label='Search Styles')
|
630 |
+
style_selections = gr.CheckboxGroup(show_label=False, container=False,
|
631 |
+
choices=copy.deepcopy(style_sorter.all_styles),
|
632 |
+
value=copy.deepcopy(modules.config.default_styles),
|
633 |
+
label='Selected Styles',
|
634 |
+
elem_classes=['style_selections'])
|
635 |
+
gradio_receiver_style_selections = gr.Textbox(elem_id='gradio_receiver_style_selections', visible=False)
|
636 |
+
|
637 |
+
shared.gradio_root.load(lambda: gr.update(choices=copy.deepcopy(style_sorter.all_styles)),
|
638 |
+
outputs=style_selections)
|
639 |
+
|
640 |
+
style_search_bar.change(style_sorter.search_styles,
|
641 |
+
inputs=[style_selections, style_search_bar],
|
642 |
+
outputs=style_selections,
|
643 |
+
queue=False,
|
644 |
+
show_progress=False).then(
|
645 |
+
lambda: None, _js='()=>{refresh_style_localization();}')
|
646 |
+
|
647 |
+
gradio_receiver_style_selections.input(style_sorter.sort_styles,
|
648 |
+
inputs=style_selections,
|
649 |
+
outputs=style_selections,
|
650 |
+
queue=False,
|
651 |
+
show_progress=False).then(
|
652 |
+
lambda: None, _js='()=>{refresh_style_localization();}')
|
653 |
+
|
654 |
+
with gr.Tab(label='Models'):
|
655 |
+
with gr.Group():
|
656 |
+
with gr.Row():
|
657 |
+
base_model = gr.Dropdown(label='Base Model (SDXL only)', choices=modules.config.model_filenames, value=modules.config.default_base_model_name, show_label=True)
|
658 |
+
refiner_model = gr.Dropdown(label='Refiner (SDXL or SD 1.5)', choices=['None'] + modules.config.model_filenames, value=modules.config.default_refiner_model_name, show_label=True)
|
659 |
+
|
660 |
+
refiner_switch = gr.Slider(label='Refiner Switch At', minimum=0.1, maximum=1.0, step=0.0001,
|
661 |
+
info='Use 0.4 for SD1.5 realistic models; '
|
662 |
+
'or 0.667 for SD1.5 anime models; '
|
663 |
+
'or 0.8 for XL-refiners; '
|
664 |
+
'or any value for switching two SDXL models.',
|
665 |
+
value=modules.config.default_refiner_switch,
|
666 |
+
visible=modules.config.default_refiner_model_name != 'None')
|
667 |
+
|
668 |
+
refiner_model.change(lambda x: gr.update(visible=x != 'None'),
|
669 |
+
inputs=refiner_model, outputs=refiner_switch, show_progress=False, queue=False)
|
670 |
+
|
671 |
+
with gr.Group():
|
672 |
+
lora_ctrls = []
|
673 |
+
|
674 |
+
for i, (enabled, filename, weight) in enumerate(modules.config.default_loras):
|
675 |
+
with gr.Row():
|
676 |
+
lora_enabled = gr.Checkbox(label='Enable', value=enabled,
|
677 |
+
elem_classes=['lora_enable', 'min_check'], scale=1)
|
678 |
+
lora_model = gr.Dropdown(label=f'LoRA {i + 1}',
|
679 |
+
choices=['None'] + modules.config.lora_filenames, value=filename,
|
680 |
+
elem_classes='lora_model', scale=5)
|
681 |
+
lora_weight = gr.Slider(label='Weight', minimum=modules.config.default_loras_min_weight,
|
682 |
+
maximum=modules.config.default_loras_max_weight, step=0.01, value=weight,
|
683 |
+
elem_classes='lora_weight', scale=5)
|
684 |
+
lora_ctrls += [lora_enabled, lora_model, lora_weight]
|
685 |
+
|
686 |
+
with gr.Row():
|
687 |
+
refresh_files = gr.Button(label='Refresh', value='\U0001f504 Refresh All Files', variant='secondary', elem_classes='refresh_button')
|
688 |
+
with gr.Tab(label='Advanced'):
|
689 |
+
guidance_scale = gr.Slider(label='Guidance Scale', minimum=1.0, maximum=30.0, step=0.01,
|
690 |
+
value=modules.config.default_cfg_scale,
|
691 |
+
info='Higher value means style is cleaner, vivider, and more artistic.')
|
692 |
+
sharpness = gr.Slider(label='Image Sharpness', minimum=0.0, maximum=30.0, step=0.001,
|
693 |
+
value=modules.config.default_sample_sharpness,
|
694 |
+
info='Higher value means image and texture are sharper.')
|
695 |
+
gr.HTML('<a href="https://github.com/lllyasviel/Fooocus/discussions/117" target="_blank">\U0001F4D4 Documentation</a>')
|
696 |
+
dev_mode = gr.Checkbox(label='Developer Debug Mode', value=modules.config.default_developer_debug_mode_checkbox, container=False)
|
697 |
+
|
698 |
+
with gr.Column(visible=modules.config.default_developer_debug_mode_checkbox) as dev_tools:
|
699 |
+
with gr.Tab(label='Debug Tools'):
|
700 |
+
adm_scaler_positive = gr.Slider(label='Positive ADM Guidance Scaler', minimum=0.1, maximum=3.0,
|
701 |
+
step=0.001, value=1.5, info='The scaler multiplied to positive ADM (use 1.0 to disable). ')
|
702 |
+
adm_scaler_negative = gr.Slider(label='Negative ADM Guidance Scaler', minimum=0.1, maximum=3.0,
|
703 |
+
step=0.001, value=0.8, info='The scaler multiplied to negative ADM (use 1.0 to disable). ')
|
704 |
+
adm_scaler_end = gr.Slider(label='ADM Guidance End At Step', minimum=0.0, maximum=1.0,
|
705 |
+
step=0.001, value=0.3,
|
706 |
+
info='When to end the guidance from positive/negative ADM. ')
|
707 |
+
|
708 |
+
refiner_swap_method = gr.Dropdown(label='Refiner swap method', value=flags.refiner_swap_method,
|
709 |
+
choices=['joint', 'separate', 'vae'])
|
710 |
+
|
711 |
+
adaptive_cfg = gr.Slider(label='CFG Mimicking from TSNR', minimum=1.0, maximum=30.0, step=0.01,
|
712 |
+
value=modules.config.default_cfg_tsnr,
|
713 |
+
info='Enabling Fooocus\'s implementation of CFG mimicking for TSNR '
|
714 |
+
'(effective when real CFG > mimicked CFG).')
|
715 |
+
clip_skip = gr.Slider(label='CLIP Skip', minimum=1, maximum=flags.clip_skip_max, step=1,
|
716 |
+
value=modules.config.default_clip_skip,
|
717 |
+
info='Bypass CLIP layers to avoid overfitting (use 1 to not skip any layers, 2 is recommended).')
|
718 |
+
sampler_name = gr.Dropdown(label='Sampler', choices=flags.sampler_list,
|
719 |
+
value=modules.config.default_sampler)
|
720 |
+
scheduler_name = gr.Dropdown(label='Scheduler', choices=flags.scheduler_list,
|
721 |
+
value=modules.config.default_scheduler)
|
722 |
+
vae_name = gr.Dropdown(label='VAE', choices=[modules.flags.default_vae] + modules.config.vae_filenames,
|
723 |
+
value=modules.config.default_vae, show_label=True)
|
724 |
+
|
725 |
+
generate_image_grid = gr.Checkbox(label='Generate Image Grid for Each Batch',
|
726 |
+
info='(Experimental) This may cause performance problems on some computers and certain internet conditions.',
|
727 |
+
value=False)
|
728 |
+
|
729 |
+
overwrite_step = gr.Slider(label='Forced Overwrite of Sampling Step',
|
730 |
+
minimum=-1, maximum=200, step=1,
|
731 |
+
value=modules.config.default_overwrite_step,
|
732 |
+
info='Set as -1 to disable. For developer debugging.')
|
733 |
+
overwrite_switch = gr.Slider(label='Forced Overwrite of Refiner Switch Step',
|
734 |
+
minimum=-1, maximum=200, step=1,
|
735 |
+
value=modules.config.default_overwrite_switch,
|
736 |
+
info='Set as -1 to disable. For developer debugging.')
|
737 |
+
overwrite_width = gr.Slider(label='Forced Overwrite of Generating Width',
|
738 |
+
minimum=-1, maximum=2048, step=1, value=-1,
|
739 |
+
info='Set as -1 to disable. For developer debugging. '
|
740 |
+
'Results will be worse for non-standard numbers that SDXL is not trained on.')
|
741 |
+
overwrite_height = gr.Slider(label='Forced Overwrite of Generating Height',
|
742 |
+
minimum=-1, maximum=2048, step=1, value=-1,
|
743 |
+
info='Set as -1 to disable. For developer debugging. '
|
744 |
+
'Results will be worse for non-standard numbers that SDXL is not trained on.')
|
745 |
+
overwrite_vary_strength = gr.Slider(label='Forced Overwrite of Denoising Strength of "Vary"',
|
746 |
+
minimum=-1, maximum=1.0, step=0.001, value=-1,
|
747 |
+
info='Set as negative number to disable. For developer debugging.')
|
748 |
+
overwrite_upscale_strength = gr.Slider(label='Forced Overwrite of Denoising Strength of "Upscale"',
|
749 |
+
minimum=-1, maximum=1.0, step=0.001,
|
750 |
+
value=modules.config.default_overwrite_upscale,
|
751 |
+
info='Set as negative number to disable. For developer debugging.')
|
752 |
+
|
753 |
+
disable_preview = gr.Checkbox(label='Disable Preview', value=modules.config.default_black_out_nsfw,
|
754 |
+
interactive=not modules.config.default_black_out_nsfw,
|
755 |
+
info='Disable preview during generation.')
|
756 |
+
disable_intermediate_results = gr.Checkbox(label='Disable Intermediate Results',
|
757 |
+
value=flags.Performance.has_restricted_features(modules.config.default_performance),
|
758 |
+
info='Disable intermediate results during generation, only show final gallery.')
|
759 |
+
|
760 |
+
disable_seed_increment = gr.Checkbox(label='Disable seed increment',
|
761 |
+
info='Disable automatic seed increment when image number is > 1.',
|
762 |
+
value=False)
|
763 |
+
read_wildcards_in_order = gr.Checkbox(label="Read wildcards in order", value=False)
|
764 |
+
|
765 |
+
black_out_nsfw = gr.Checkbox(label='Black Out NSFW', value=modules.config.default_black_out_nsfw,
|
766 |
+
interactive=not modules.config.default_black_out_nsfw,
|
767 |
+
info='Use black image if NSFW is detected.')
|
768 |
+
|
769 |
+
black_out_nsfw.change(lambda x: gr.update(value=x, interactive=not x),
|
770 |
+
inputs=black_out_nsfw, outputs=disable_preview, queue=False,
|
771 |
+
show_progress=False)
|
772 |
+
|
773 |
+
if not args_manager.args.disable_image_log:
|
774 |
+
save_final_enhanced_image_only = gr.Checkbox(label='Save only final enhanced image',
|
775 |
+
value=modules.config.default_save_only_final_enhanced_image)
|
776 |
+
|
777 |
+
if not args_manager.args.disable_metadata:
|
778 |
+
save_metadata_to_images = gr.Checkbox(label='Save Metadata to Images', value=modules.config.default_save_metadata_to_images,
|
779 |
+
info='Adds parameters to generated images allowing manual regeneration.')
|
780 |
+
metadata_scheme = gr.Radio(label='Metadata Scheme', choices=flags.metadata_scheme, value=modules.config.default_metadata_scheme,
|
781 |
+
info='Image Prompt parameters are not included. Use png and a1111 for compatibility with Civitai.',
|
782 |
+
visible=modules.config.default_save_metadata_to_images)
|
783 |
+
|
784 |
+
save_metadata_to_images.change(lambda x: gr.update(visible=x), inputs=[save_metadata_to_images], outputs=[metadata_scheme],
|
785 |
+
queue=False, show_progress=False)
|
786 |
+
|
787 |
+
with gr.Tab(label='Control'):
|
788 |
+
debugging_cn_preprocessor = gr.Checkbox(label='Debug Preprocessors', value=False,
|
789 |
+
info='See the results from preprocessors.')
|
790 |
+
skipping_cn_preprocessor = gr.Checkbox(label='Skip Preprocessors', value=False,
|
791 |
+
info='Do not preprocess images. (Inputs are already canny/depth/cropped-face/etc.)')
|
792 |
+
|
793 |
+
mixing_image_prompt_and_vary_upscale = gr.Checkbox(label='Mixing Image Prompt and Vary/Upscale',
|
794 |
+
value=False)
|
795 |
+
mixing_image_prompt_and_inpaint = gr.Checkbox(label='Mixing Image Prompt and Inpaint',
|
796 |
+
value=False)
|
797 |
+
|
798 |
+
controlnet_softness = gr.Slider(label='Softness of ControlNet', minimum=0.0, maximum=1.0,
|
799 |
+
step=0.001, value=0.25,
|
800 |
+
info='Similar to the Control Mode in A1111 (use 0.0 to disable). ')
|
801 |
+
|
802 |
+
with gr.Tab(label='Canny'):
|
803 |
+
canny_low_threshold = gr.Slider(label='Canny Low Threshold', minimum=1, maximum=255,
|
804 |
+
step=1, value=64)
|
805 |
+
canny_high_threshold = gr.Slider(label='Canny High Threshold', minimum=1, maximum=255,
|
806 |
+
step=1, value=128)
|
807 |
+
|
808 |
+
with gr.Tab(label='Inpaint'):
|
809 |
+
debugging_inpaint_preprocessor = gr.Checkbox(label='Debug Inpaint Preprocessing', value=False)
|
810 |
+
debugging_enhance_masks_checkbox = gr.Checkbox(label='Debug Enhance Masks', value=False,
|
811 |
+
info='Show enhance masks in preview and final results')
|
812 |
+
debugging_dino = gr.Checkbox(label='Debug GroundingDINO', value=False,
|
813 |
+
info='Use GroundingDINO boxes instead of more detailed SAM masks')
|
814 |
+
inpaint_disable_initial_latent = gr.Checkbox(label='Disable initial latent in inpaint', value=False)
|
815 |
+
inpaint_engine = gr.Dropdown(label='Inpaint Engine',
|
816 |
+
value=modules.config.default_inpaint_engine_version,
|
817 |
+
choices=flags.inpaint_engine_versions,
|
818 |
+
info='Version of Fooocus inpaint model. If set, use performance Quality or Speed (no performance LoRAs) for best results.')
|
819 |
+
inpaint_strength = gr.Slider(label='Inpaint Denoising Strength',
|
820 |
+
minimum=0.0, maximum=1.0, step=0.001, value=1.0,
|
821 |
+
info='Same as the denoising strength in A1111 inpaint. '
|
822 |
+
'Only used in inpaint, not used in outpaint. '
|
823 |
+
'(Outpaint always use 1.0)')
|
824 |
+
inpaint_respective_field = gr.Slider(label='Inpaint Respective Field',
|
825 |
+
minimum=0.0, maximum=1.0, step=0.001, value=0.618,
|
826 |
+
info='The area to inpaint. '
|
827 |
+
'Value 0 is same as "Only Masked" in A1111. '
|
828 |
+
'Value 1 is same as "Whole Image" in A1111. '
|
829 |
+
'Only used in inpaint, not used in outpaint. '
|
830 |
+
'(Outpaint always use 1.0)')
|
831 |
+
inpaint_erode_or_dilate = gr.Slider(label='Mask Erode or Dilate',
|
832 |
+
minimum=-64, maximum=64, step=1, value=0,
|
833 |
+
info='Positive value will make white area in the mask larger, '
|
834 |
+
'negative value will make white area smaller. '
|
835 |
+
'(default is 0, always processed before any mask invert)')
|
836 |
+
dino_erode_or_dilate = gr.Slider(label='GroundingDINO Box Erode or Dilate',
|
837 |
+
minimum=-64, maximum=64, step=1, value=0,
|
838 |
+
info='Positive value will make white area in the mask larger, '
|
839 |
+
'negative value will make white area smaller. '
|
840 |
+
'(default is 0, processed before SAM)')
|
841 |
+
|
842 |
+
inpaint_mask_color = gr.ColorPicker(label='Inpaint brush color', value='#FFFFFF', elem_id='inpaint_brush_color')
|
843 |
+
|
844 |
+
inpaint_ctrls = [debugging_inpaint_preprocessor, inpaint_disable_initial_latent, inpaint_engine,
|
845 |
+
inpaint_strength, inpaint_respective_field,
|
846 |
+
inpaint_advanced_masking_checkbox, invert_mask_checkbox, inpaint_erode_or_dilate]
|
847 |
+
|
848 |
+
inpaint_advanced_masking_checkbox.change(lambda x: [gr.update(visible=x)] * 2,
|
849 |
+
inputs=inpaint_advanced_masking_checkbox,
|
850 |
+
outputs=[inpaint_mask_image, inpaint_mask_generation_col],
|
851 |
+
queue=False, show_progress=False)
|
852 |
+
|
853 |
+
inpaint_mask_color.change(lambda x: gr.update(brush_color=x), inputs=inpaint_mask_color,
|
854 |
+
outputs=inpaint_input_image,
|
855 |
+
queue=False, show_progress=False)
|
856 |
+
|
857 |
+
with gr.Tab(label='FreeU'):
|
858 |
+
freeu_enabled = gr.Checkbox(label='Enabled', value=False)
|
859 |
+
freeu_b1 = gr.Slider(label='B1', minimum=0, maximum=2, step=0.01, value=1.01)
|
860 |
+
freeu_b2 = gr.Slider(label='B2', minimum=0, maximum=2, step=0.01, value=1.02)
|
861 |
+
freeu_s1 = gr.Slider(label='S1', minimum=0, maximum=4, step=0.01, value=0.99)
|
862 |
+
freeu_s2 = gr.Slider(label='S2', minimum=0, maximum=4, step=0.01, value=0.95)
|
863 |
+
freeu_ctrls = [freeu_enabled, freeu_b1, freeu_b2, freeu_s1, freeu_s2]
|
864 |
+
|
865 |
+
def dev_mode_checked(r):
|
866 |
+
return gr.update(visible=r)
|
867 |
+
|
868 |
+
dev_mode.change(dev_mode_checked, inputs=[dev_mode], outputs=[dev_tools],
|
869 |
+
queue=False, show_progress=False)
|
870 |
+
|
871 |
+
def refresh_files_clicked():
|
872 |
+
modules.config.update_files()
|
873 |
+
results = [gr.update(choices=modules.config.model_filenames)]
|
874 |
+
results += [gr.update(choices=['None'] + modules.config.model_filenames)]
|
875 |
+
results += [gr.update(choices=[flags.default_vae] + modules.config.vae_filenames)]
|
876 |
+
if not args_manager.args.disable_preset_selection:
|
877 |
+
results += [gr.update(choices=modules.config.available_presets)]
|
878 |
+
for i in range(modules.config.default_max_lora_number):
|
879 |
+
results += [gr.update(interactive=True),
|
880 |
+
gr.update(choices=['None'] + modules.config.lora_filenames), gr.update()]
|
881 |
+
return results
|
882 |
+
|
883 |
+
refresh_files_output = [base_model, refiner_model, vae_name]
|
884 |
+
if not args_manager.args.disable_preset_selection:
|
885 |
+
refresh_files_output += [preset_selection]
|
886 |
+
refresh_files.click(refresh_files_clicked, [], refresh_files_output + lora_ctrls,
|
887 |
+
queue=False, show_progress=False)
|
888 |
+
|
889 |
+
state_is_generating = gr.State(False)
|
890 |
+
|
891 |
+
load_data_outputs = [advanced_checkbox, image_number, prompt, negative_prompt, style_selections,
|
892 |
+
performance_selection, overwrite_step, overwrite_switch, aspect_ratios_selection,
|
893 |
+
overwrite_width, overwrite_height, guidance_scale, sharpness, adm_scaler_positive,
|
894 |
+
adm_scaler_negative, adm_scaler_end, refiner_swap_method, adaptive_cfg, clip_skip,
|
895 |
+
base_model, refiner_model, refiner_switch, sampler_name, scheduler_name, vae_name,
|
896 |
+
seed_random, image_seed, inpaint_engine, inpaint_engine_state,
|
897 |
+
inpaint_mode] + enhance_inpaint_mode_ctrls + [generate_button,
|
898 |
+
load_parameter_button] + freeu_ctrls + lora_ctrls
|
899 |
+
|
900 |
+
if not args_manager.args.disable_preset_selection:
|
901 |
+
def preset_selection_change(preset, is_generating, inpaint_mode):
|
902 |
+
preset_content = modules.config.try_get_preset_content(preset) if preset != 'initial' else {}
|
903 |
+
preset_prepared = modules.meta_parser.parse_meta_from_preset(preset_content)
|
904 |
+
|
905 |
+
default_model = preset_prepared.get('base_model')
|
906 |
+
previous_default_models = preset_prepared.get('previous_default_models', [])
|
907 |
+
checkpoint_downloads = preset_prepared.get('checkpoint_downloads', {})
|
908 |
+
embeddings_downloads = preset_prepared.get('embeddings_downloads', {})
|
909 |
+
lora_downloads = preset_prepared.get('lora_downloads', {})
|
910 |
+
vae_downloads = preset_prepared.get('vae_downloads', {})
|
911 |
+
|
912 |
+
preset_prepared['base_model'], preset_prepared['checkpoint_downloads'] = launch.download_models(
|
913 |
+
default_model, previous_default_models, checkpoint_downloads, embeddings_downloads, lora_downloads,
|
914 |
+
vae_downloads)
|
915 |
+
|
916 |
+
if 'prompt' in preset_prepared and preset_prepared.get('prompt') == '':
|
917 |
+
del preset_prepared['prompt']
|
918 |
+
|
919 |
+
return modules.meta_parser.load_parameter_button_click(json.dumps(preset_prepared), is_generating, inpaint_mode)
|
920 |
+
|
921 |
+
|
922 |
+
def inpaint_engine_state_change(inpaint_engine_version, *args):
|
923 |
+
if inpaint_engine_version == 'empty':
|
924 |
+
inpaint_engine_version = modules.config.default_inpaint_engine_version
|
925 |
+
|
926 |
+
result = []
|
927 |
+
for inpaint_mode in args:
|
928 |
+
if inpaint_mode != modules.flags.inpaint_option_detail:
|
929 |
+
result.append(gr.update(value=inpaint_engine_version))
|
930 |
+
else:
|
931 |
+
result.append(gr.update())
|
932 |
+
|
933 |
+
return result
|
934 |
+
|
935 |
+
preset_selection.change(preset_selection_change, inputs=[preset_selection, state_is_generating, inpaint_mode], outputs=load_data_outputs, queue=False, show_progress=True) \
|
936 |
+
.then(fn=style_sorter.sort_styles, inputs=style_selections, outputs=style_selections, queue=False, show_progress=False) \
|
937 |
+
.then(lambda: None, _js='()=>{refresh_style_localization();}') \
|
938 |
+
.then(inpaint_engine_state_change, inputs=[inpaint_engine_state] + enhance_inpaint_mode_ctrls, outputs=enhance_inpaint_engine_ctrls, queue=False, show_progress=False)
|
939 |
+
|
940 |
+
performance_selection.change(lambda x: [gr.update(interactive=not flags.Performance.has_restricted_features(x))] * 11 +
|
941 |
+
[gr.update(visible=not flags.Performance.has_restricted_features(x))] * 1 +
|
942 |
+
[gr.update(value=flags.Performance.has_restricted_features(x))] * 1,
|
943 |
+
inputs=performance_selection,
|
944 |
+
outputs=[
|
945 |
+
guidance_scale, sharpness, adm_scaler_end, adm_scaler_positive,
|
946 |
+
adm_scaler_negative, refiner_switch, refiner_model, sampler_name,
|
947 |
+
scheduler_name, adaptive_cfg, refiner_swap_method, negative_prompt, disable_intermediate_results
|
948 |
+
], queue=False, show_progress=False)
|
949 |
+
|
950 |
+
output_format.input(lambda x: gr.update(output_format=x), inputs=output_format)
|
951 |
+
|
952 |
+
advanced_checkbox.change(lambda x: gr.update(visible=x), advanced_checkbox, advanced_column,
|
953 |
+
queue=False, show_progress=False) \
|
954 |
+
.then(fn=lambda: None, _js='refresh_grid_delayed', queue=False, show_progress=False)
|
955 |
+
|
956 |
+
inpaint_mode.change(inpaint_mode_change, inputs=[inpaint_mode, inpaint_engine_state], outputs=[
|
957 |
+
inpaint_additional_prompt, outpaint_selections, example_inpaint_prompts,
|
958 |
+
inpaint_disable_initial_latent, inpaint_engine,
|
959 |
+
inpaint_strength, inpaint_respective_field
|
960 |
+
], show_progress=False, queue=False)
|
961 |
+
|
962 |
+
# load configured default_inpaint_method
|
963 |
+
default_inpaint_ctrls = [inpaint_mode, inpaint_disable_initial_latent, inpaint_engine, inpaint_strength, inpaint_respective_field]
|
964 |
+
for mode, disable_initial_latent, engine, strength, respective_field in [default_inpaint_ctrls] + enhance_inpaint_update_ctrls:
|
965 |
+
shared.gradio_root.load(inpaint_mode_change, inputs=[mode, inpaint_engine_state], outputs=[
|
966 |
+
inpaint_additional_prompt, outpaint_selections, example_inpaint_prompts, disable_initial_latent,
|
967 |
+
engine, strength, respective_field
|
968 |
+
], show_progress=False, queue=False)
|
969 |
+
|
970 |
+
generate_mask_button.click(fn=generate_mask,
|
971 |
+
inputs=[inpaint_input_image, inpaint_mask_model, inpaint_mask_cloth_category,
|
972 |
+
inpaint_mask_dino_prompt_text, inpaint_mask_sam_model,
|
973 |
+
inpaint_mask_box_threshold, inpaint_mask_text_threshold,
|
974 |
+
inpaint_mask_sam_max_detections, dino_erode_or_dilate, debugging_dino],
|
975 |
+
outputs=inpaint_mask_image, show_progress=True, queue=True)
|
976 |
+
|
977 |
+
ctrls = [currentTask, generate_image_grid]
|
978 |
+
ctrls += [
|
979 |
+
prompt, negative_prompt, style_selections,
|
980 |
+
performance_selection, aspect_ratios_selection, image_number, output_format, image_seed,
|
981 |
+
read_wildcards_in_order, sharpness, guidance_scale
|
982 |
+
]
|
983 |
+
|
984 |
+
ctrls += [base_model, refiner_model, refiner_switch] + lora_ctrls
|
985 |
+
ctrls += [input_image_checkbox, current_tab]
|
986 |
+
ctrls += [uov_method, uov_input_image]
|
987 |
+
ctrls += [outpaint_selections, inpaint_input_image, inpaint_additional_prompt, inpaint_mask_image]
|
988 |
+
ctrls += [disable_preview, disable_intermediate_results, disable_seed_increment, black_out_nsfw]
|
989 |
+
ctrls += [adm_scaler_positive, adm_scaler_negative, adm_scaler_end, adaptive_cfg, clip_skip]
|
990 |
+
ctrls += [sampler_name, scheduler_name, vae_name]
|
991 |
+
ctrls += [overwrite_step, overwrite_switch, overwrite_width, overwrite_height, overwrite_vary_strength]
|
992 |
+
ctrls += [overwrite_upscale_strength, mixing_image_prompt_and_vary_upscale, mixing_image_prompt_and_inpaint]
|
993 |
+
ctrls += [debugging_cn_preprocessor, skipping_cn_preprocessor, canny_low_threshold, canny_high_threshold]
|
994 |
+
ctrls += [refiner_swap_method, controlnet_softness]
|
995 |
+
ctrls += freeu_ctrls
|
996 |
+
ctrls += inpaint_ctrls
|
997 |
+
|
998 |
+
if not args_manager.args.disable_image_log:
|
999 |
+
ctrls += [save_final_enhanced_image_only]
|
1000 |
+
|
1001 |
+
if not args_manager.args.disable_metadata:
|
1002 |
+
ctrls += [save_metadata_to_images, metadata_scheme]
|
1003 |
+
|
1004 |
+
ctrls += ip_ctrls
|
1005 |
+
ctrls += [debugging_dino, dino_erode_or_dilate, debugging_enhance_masks_checkbox,
|
1006 |
+
enhance_input_image, enhance_checkbox, enhance_uov_method, enhance_uov_processing_order,
|
1007 |
+
enhance_uov_prompt_type]
|
1008 |
+
ctrls += enhance_ctrls
|
1009 |
+
|
1010 |
+
def parse_meta(raw_prompt_txt, is_generating):
|
1011 |
+
loaded_json = None
|
1012 |
+
if is_json(raw_prompt_txt):
|
1013 |
+
loaded_json = json.loads(raw_prompt_txt)
|
1014 |
+
|
1015 |
+
if loaded_json is None:
|
1016 |
+
if is_generating:
|
1017 |
+
return gr.update(), gr.update(), gr.update()
|
1018 |
+
else:
|
1019 |
+
return gr.update(), gr.update(visible=True), gr.update(visible=False)
|
1020 |
+
|
1021 |
+
return json.dumps(loaded_json), gr.update(visible=False), gr.update(visible=True)
|
1022 |
+
|
1023 |
+
prompt.input(parse_meta, inputs=[prompt, state_is_generating], outputs=[prompt, generate_button, load_parameter_button], queue=False, show_progress=False)
|
1024 |
+
|
1025 |
+
load_parameter_button.click(modules.meta_parser.load_parameter_button_click, inputs=[prompt, state_is_generating, inpaint_mode], outputs=load_data_outputs, queue=False, show_progress=False)
|
1026 |
+
|
1027 |
+
def trigger_metadata_import(file, state_is_generating):
|
1028 |
+
parameters, metadata_scheme = modules.meta_parser.read_info_from_image(file)
|
1029 |
+
if parameters is None:
|
1030 |
+
print('Could not find metadata in the image!')
|
1031 |
+
parsed_parameters = {}
|
1032 |
+
else:
|
1033 |
+
metadata_parser = modules.meta_parser.get_metadata_parser(metadata_scheme)
|
1034 |
+
parsed_parameters = metadata_parser.to_json(parameters)
|
1035 |
+
|
1036 |
+
return modules.meta_parser.load_parameter_button_click(parsed_parameters, state_is_generating, inpaint_mode)
|
1037 |
+
|
1038 |
+
metadata_import_button.click(trigger_metadata_import, inputs=[metadata_input_image, state_is_generating], outputs=load_data_outputs, queue=False, show_progress=True) \
|
1039 |
+
.then(style_sorter.sort_styles, inputs=style_selections, outputs=style_selections, queue=False, show_progress=False)
|
1040 |
+
|
1041 |
+
generate_button.click(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=True, interactive=True), gr.update(visible=False, interactive=False), [], True),
|
1042 |
+
outputs=[stop_button, skip_button, generate_button, gallery, state_is_generating]) \
|
1043 |
+
.then(fn=refresh_seed, inputs=[seed_random, image_seed], outputs=image_seed) \
|
1044 |
+
.then(fn=get_task, inputs=ctrls, outputs=currentTask) \
|
1045 |
+
.then(fn=generate_clicked, inputs=currentTask, outputs=[progress_html, progress_window, progress_gallery, gallery]) \
|
1046 |
+
.then(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=False, interactive=False), gr.update(visible=False, interactive=False), False),
|
1047 |
+
outputs=[generate_button, stop_button, skip_button, state_is_generating]) \
|
1048 |
+
.then(fn=update_history_link, outputs=history_link) \
|
1049 |
+
.then(fn=lambda: None, _js='playNotification').then(fn=lambda: None, _js='refresh_grid_delayed')
|
1050 |
+
|
1051 |
+
reset_button.click(lambda: [worker.AsyncTask(args=[]), False, gr.update(visible=True, interactive=True)] +
|
1052 |
+
[gr.update(visible=False)] * 6 +
|
1053 |
+
[gr.update(visible=True, value=[])],
|
1054 |
+
outputs=[currentTask, state_is_generating, generate_button,
|
1055 |
+
reset_button, stop_button, skip_button,
|
1056 |
+
progress_html, progress_window, progress_gallery, gallery],
|
1057 |
+
queue=False)
|
1058 |
+
|
1059 |
+
for notification_file in ['notification.ogg', 'notification.mp3']:
|
1060 |
+
if os.path.exists(notification_file):
|
1061 |
+
gr.Audio(interactive=False, value=notification_file, elem_id='audio_notification', visible=False)
|
1062 |
+
break
|
1063 |
+
|
1064 |
+
def trigger_describe(modes, img, apply_styles):
|
1065 |
+
describe_prompts = []
|
1066 |
+
styles = set()
|
1067 |
+
|
1068 |
+
if flags.describe_type_photo in modes:
|
1069 |
+
from extras.interrogate import default_interrogator as default_interrogator_photo
|
1070 |
+
describe_prompts.append(default_interrogator_photo(img))
|
1071 |
+
styles.update(["Fooocus V2", "Fooocus Enhance", "Fooocus Sharp"])
|
1072 |
+
|
1073 |
+
if flags.describe_type_anime in modes:
|
1074 |
+
from extras.wd14tagger import default_interrogator as default_interrogator_anime
|
1075 |
+
describe_prompts.append(default_interrogator_anime(img))
|
1076 |
+
styles.update(["Fooocus V2", "Fooocus Masterpiece"])
|
1077 |
+
|
1078 |
+
if len(styles) == 0 or not apply_styles:
|
1079 |
+
styles = gr.update()
|
1080 |
+
else:
|
1081 |
+
styles = list(styles)
|
1082 |
+
|
1083 |
+
if len(describe_prompts) == 0:
|
1084 |
+
describe_prompt = gr.update()
|
1085 |
+
else:
|
1086 |
+
describe_prompt = ', '.join(describe_prompts)
|
1087 |
+
|
1088 |
+
return describe_prompt, styles
|
1089 |
+
|
1090 |
+
describe_btn.click(trigger_describe, inputs=[describe_methods, describe_input_image, describe_apply_styles],
|
1091 |
+
outputs=[prompt, style_selections], show_progress=True, queue=True) \
|
1092 |
+
.then(fn=style_sorter.sort_styles, inputs=style_selections, outputs=style_selections, queue=False, show_progress=False) \
|
1093 |
+
.then(lambda: None, _js='()=>{refresh_style_localization();}')
|
1094 |
+
|
1095 |
+
if args_manager.args.enable_auto_describe_image:
|
1096 |
+
def trigger_auto_describe(mode, img, prompt, apply_styles):
|
1097 |
+
# keep prompt if not empty
|
1098 |
+
if prompt == '':
|
1099 |
+
return trigger_describe(mode, img, apply_styles)
|
1100 |
+
return gr.update(), gr.update()
|
1101 |
+
|
1102 |
+
uov_input_image.upload(trigger_auto_describe, inputs=[describe_methods, uov_input_image, prompt, describe_apply_styles],
|
1103 |
+
outputs=[prompt, style_selections], show_progress=True, queue=True) \
|
1104 |
+
.then(fn=style_sorter.sort_styles, inputs=style_selections, outputs=style_selections, queue=False, show_progress=False) \
|
1105 |
+
.then(lambda: None, _js='()=>{refresh_style_localization();}')
|
1106 |
+
|
1107 |
+
enhance_input_image.upload(lambda: gr.update(value=True), outputs=enhance_checkbox, queue=False, show_progress=False) \
|
1108 |
+
.then(trigger_auto_describe, inputs=[describe_methods, enhance_input_image, prompt, describe_apply_styles],
|
1109 |
+
outputs=[prompt, style_selections], show_progress=True, queue=True) \
|
1110 |
+
.then(fn=style_sorter.sort_styles, inputs=style_selections, outputs=style_selections, queue=False, show_progress=False) \
|
1111 |
+
.then(lambda: None, _js='()=>{refresh_style_localization();}')
|
1112 |
+
|
1113 |
+
def dump_default_english_config():
|
1114 |
+
from modules.localization import dump_english_config
|
1115 |
+
dump_english_config(grh.all_components)
|
1116 |
+
|
1117 |
+
|
1118 |
+
# dump_default_english_config()
|
1119 |
+
|
1120 |
+
shared.gradio_root.launch(
|
1121 |
+
inbrowser=args_manager.args.in_browser,
|
1122 |
+
server_name=args_manager.args.listen,
|
1123 |
+
server_port=args_manager.args.port,
|
1124 |
+
share=args_manager.args.share,
|
1125 |
+
auth=check_auth if (args_manager.args.share or args_manager.args.listen) and auth_enabled else None,
|
1126 |
+
allowed_paths=[modules.config.path_outputs],
|
1127 |
+
blocked_paths=[constants.AUTH_FILENAME]
|
1128 |
+
)
|