The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Add --deterministic option to make pytorch use deterministic algorithms.
comfyanonymous2f9d6a97ec7e
diff --git a/comfy/cli_args.py b/comfy/cli_args.pyindex d9c8668f4..8de0adb53 100644--- a/comfy/cli_args.py+++ b/comfy/cli_args.py@@ -102,7 +102,7 @@ vram_group.add_argument("--cpu", action="store_true", help="To use the CPU for eparser.add_argument("--disable-smart-memory", action="store_true", help="Force ComfyUI to agressively offload to regular ram instead of keeping models in vram when it can.")-+parser.add_argument("--deterministic", action="store_true", help="Make pytorch use slower deterministic algorithms when it can. Note that this might not make images deterministic in all cases.")parser.add_argument("--dont-print-server", action="store_true", help="Don't print server output.")parser.add_argument("--quick-test-for-ci", action="store_true", help="Quick test for CI.")diff --git a/comfy/model_management.py b/comfy/model_management.pyindex b6a9471bf..23f39c985 100644--- a/comfy/model_management.py+++ b/comfy/model_management.py@@ -28,6 +28,10 @@ total_vram = 0lowvram_available = Truexpu_available = False+if args.deterministic:+ print("Using deterministic algorithms for pytorch")+ torch.use_deterministic_algorithms(True, warn_only=True)+directml_enabled = Falseif args.directml is not None:import torch_directmldiff --git a/main.py b/main.pyindex 1f9c5f443..f6aeceed2 100644--- a/main.py+++ b/main.py@@ -64,6 +64,10 @@ if __name__ == "__main__":os.environ['CUDA_VISIBLE_DEVICES'] = str(args.cuda_device)print("Set cuda device to:", args.cuda_device)+ if args.deterministic:+ if 'CUBLAS_WORKSPACE_CONFIG' not in os.environ:+ os.environ['CUBLAS_WORKSPACE_CONFIG'] = ":4096:8"+import cuda_mallocimport comfy.utils