lllyasviel / Fooocus

Focus on prompting and generating
GNU General Public License v3.0
41.51k stars 5.9k forks source link

Still don't understand where to type PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0 to disable the upper limit to fix the problem #1271

Closed briandamkroger21 closed 10 months ago

briandamkroger21 commented 11 months ago

Discussed in https://github.com/lllyasviel/Fooocus/discussions/1156

Originally posted by **GondorGitaros** December 3, 2023 I am a total noob and I don't know where to type PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0 and i get this error: RuntimeError: MPS backend out of memory (MPS allocated: 8.89 GB, other allocations: 172.98 MB, max allowed: 9.07 GB). Tried to allocate 6.25 MB on private pool. Use PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0 to disable upper limit for memory allocations (may cause system failure). Total time: 129.38 seconds
briandamkroger21 commented 11 months ago

Sorry to be dense, but I still don't understand where to type the following: PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0 in my launch.py file.

When I open the file using TextEdit I see the following:

from modules import launch_utils

args = launch_utils.args python = launch_utils.python git = launch_utils.git index_url = launch_utils.index_url dir_repos = launch_utils.dir_repos

commit_hash = launch_utils.commit_hash git_tag = launch_utils.git_tag

run = launch_utils.run is_installed = launch_utils.is_installed repo_dir = launch_utils.repo_dir

run_pip = launch_utils.run_pip check_run_python = launch_utils.check_run_python git_clone = launch_utils.git_clone git_pull_recursive = launch_utils.git_pull_recursive list_extensions = launch_utils.list_extensions run_extension_installer = launch_utils.run_extension_installer prepare_environment = launch_utils.prepare_environment configure_for_tests = launch_utils.configure_for_tests start = launch_utils.start

def main(): if args.dump_sysinfo: filename = launch_utils.dump_sysinfo()

print(f"Sysinfo saved as {filename}. Exiting...")

exit(0)

launch_utils.startup_timer.record("initial startup")

with launch_utils.startup_timer.subcategory("prepare environment"): if not args.skip_prepare_environment: prepare_environment()

if args.test_server: configure_for_tests()

start() if name == "main": main()

So, where, exactly do I type PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0

Thanks, Brian

xeosnar commented 11 months ago

add os.environ["PYTORCH_MPS_HIGH_WATERMARK_RATIO"] = "0.0" below os.environ["GRADIO_SERVER_PORT"] = "7865" in lunch.py file

briandamkroger21 commented 11 months ago

Thanks, but I can't find the string "os.environ["GRADIO_SERVER_PORT'] = "7865" in any of the "launch.py" files on my MAC

mashb1t commented 10 months ago

@briandamkroger21 it is in https://github.com/lllyasviel/Fooocus/blob/eb0b4d51ef3f46f57d7f20e870aa89a4b5de48ef/launch.py#L13. I assume you found it by now, closing this issue.

ratheraarif commented 4 months ago

try this export PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0