From fa437d2dc34629d8025288d94353b53072db996b Mon Sep 17 00:00:00 2001 From: John Pollock Date: Tue, 14 Oct 2025 13:49:16 -0500 Subject: [PATCH] Updating distorch_2.py: 1. Replacing ad-hoc print() with structured logging 2. Simplifying device detection (fail-fast approach) 3. Maintaining the implemented backward compatibility for GGUF/ModelPatcher by max-solo23 4. Following the repository's logging conventions Co-authored-by: max-solo23 --- distorch_2.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/distorch_2.py b/distorch_2.py index b966528..1922875 100644 --- a/distorch_2.py +++ b/distorch_2.py @@ -54,15 +54,14 @@ def register_patched_safetensor_modelpatcher(): model_type = type(m).__name__ if ("GGUF" in model_type or "ModelPatcher" in model_type) and hasattr(m, "model_patches_to"): - print(f"[MultiGPU] {type(m).__name__} missing 'model_patches_models' attribute, using 'model_patches_to' fallback.") - target_device = getattr(m, "load_device", - f"cuda:{torch.cuda.current_device()}" if torch.cuda.is_available() else "cpu") - print(f"Target device: {target_device}") + logger.info(f"[MultiGPU DisTorch V2] {type(m).__name__} missing 'model_patches_models' attribute, using 'model_patches_to' fallback.") + target_device = m.load_device + logger.debug(f"[MultiGPU DisTorch V2] Target device: {target_device}") patches = m.model_patches_to(target_device) if patches: - print(f"[MultiGPU] Found {len(patches)} mm_patch(es) for {type(m).__name__} on device {target_device}") + logger.debug(f"[MultiGPU DisTorch V2] Found {len(patches)} mm_patch(es) for {type(m).__name__} on device {target_device}") for mm_patch in patches: - print(f"[MultiGPU] Registering mm_patch: {type(mm_patch).__name__}") + logger.debug(f"[MultiGPU DisTorch V2] Registering mm_patch: {type(mm_patch).__name__}") models_temp.add(mm_patch) continue