Skip to content

Commit

Permalink
amd support (lllyasviel#607)
Browse files Browse the repository at this point in the history
* amd support

* amd support
  • Loading branch information
lllyasviel authored Oct 9, 2023
1 parent 7cbfb1b commit 0a2c1c4
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 17 deletions.
12 changes: 12 additions & 0 deletions args_manager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from comfy.options import enable_args_parsing
enable_args_parsing(False)
import comfy.cli_args as comfy_cli


comfy_cli.parser.add_argument("--share", action='store_true', help="Set whether to share on Gradio.")

comfy_cli.args = comfy_cli.parser.parse_args()
comfy_cli.args.disable_cuda_malloc = True
comfy_cli.args.auto_launch = True

args = comfy_cli.args
12 changes: 2 additions & 10 deletions launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,12 @@ def download_models():


def ini_comfy_args():
argv = sys.argv
sys.argv = [sys.argv[0]]

from comfy.cli_args import args as comfy_args
comfy_args.disable_cuda_malloc = True
comfy_args.auto_launch = False

sys.argv = argv
from args_manager import args
return args


prepare_environment()

ini_comfy_args()

download_models()

from webui import *
13 changes: 12 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,18 @@ Same with the above instructions. You need to change torch to AMD version

AMD is not intensively tested, however.

### Mac/Windows(AMD GPUs)
### Windows(AMD GPUs)

Same with Windows. Download the software, edit the content of `run.bat` as:

.\python_embeded\python.exe -m pip uninstall torch torchvision torchaudio torchtext functorch xformers -y
.\python_embeded\python.exe -m pip install torch-directml
.\python_embeded\python.exe -s Fooocus\entry_with_update.py --directml
pause

Then run the `run.bat`.

### Mac

Coming soon ...

Expand Down
4 changes: 4 additions & 0 deletions update_log.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.1.25

AMD support on Linux and Windows.

# 2.1.0

* Image Prompt
Expand Down
13 changes: 7 additions & 6 deletions webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import modules.flags as flags
import modules.gradio_hijack as grh
import modules.advanced_parameters as advanced_parameters
import args_manager

from modules.sdxl_styles import style_keys, aspect_ratios, fooocus_expansion, default_styles, default_aspect_ratio

Expand Down Expand Up @@ -310,9 +311,9 @@ def model_refresh_clicked():
.then(lambda: (gr.update(visible=True), gr.update(visible=False)), outputs=[run_button, stop_button])


parser = argparse.ArgumentParser()
parser.add_argument("--port", type=int, default=None, help="Set the listen port.")
parser.add_argument("--share", action='store_true', help="Set whether to share on Gradio.")
parser.add_argument("--listen", type=str, default=None, metavar="IP", nargs="?", const="0.0.0.0", help="Set the listen interface.")
args = parser.parse_args()
shared.gradio_root.launch(inbrowser=True, server_name=args.listen, server_port=args.port, share=args.share)
shared.gradio_root.launch(
inbrowser=args_manager.args.auto_launch,
server_name=args_manager.args.listen,
server_port=args_manager.args.port,
share=args_manager.args.share
)

0 comments on commit 0a2c1c4

Please sign in to comment.