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