From f6b6636bf38583d3b6c0ae8e5032dd63425c3f50 Mon Sep 17 00:00:00 2001 From: Maifee Ul Asad Date: Wed, 8 Oct 2025 14:40:29 +0600 Subject: [PATCH] feat(gds): implement GDS loading fallback in load_torch_file function; - need to work with tensorflow and other formats - afaik, almost all models shared now is in torch format - converting types should not be that big of a deal --- comfy/utils.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/comfy/utils.py b/comfy/utils.py index fab28cf08..c13dd7390 100644 --- a/comfy/utils.py +++ b/comfy/utils.py @@ -51,6 +51,18 @@ else: logging.info("Warning, you are using an old pytorch version and some ckpt/pt files might be loaded unsafely. Upgrading to 2.4 or above is recommended.") def load_torch_file(ckpt, safe_load=False, device=None, return_metadata=False): + # Try GDS loading first if available and device is GPU + if device is not None and device.type == 'cuda': + try: + from . import gds_loader + gds_result = gds_loader.load_torch_file_gds(ckpt, safe_load=safe_load, device=device) + if return_metadata: + # For GDS, we return empty metadata for now (can be enhanced) + return (gds_result, {}) + return gds_result + except Exception as e: + logging.debug(f"GDS loading failed, using fallback: {e}") + if device is None: device = torch.device("cpu") metadata = None