refactor: Introduce DisTorch V2 architecture
This commit introduces a major architectural refactoring, laying the groundwork for DisTorch V2. The changes focus on improving modularity, memory management, and diagnostics. Key changes include: - Renaming `distorch_safetensor.py` to `distorch_2.py` to house the new core logic. - Deleting the legacy `block_swap.py` module. - Adding `device_memory_audit.py` for more sophisticated analysis of GPU memory usage. - Implementing a centralized and configurable logging system in `__init__.py` to provide standardized and level-controlled (DEBUG/INFO) output for better debugging.
This commit is contained in:
+4
-4
@@ -11,7 +11,7 @@ def log_memory_usage(label=""):
|
||||
ram_used_gb = status.get('ram_used', 0) / (1024**3)
|
||||
ram_total_gb = status.get('ram_total', 0) / (1024**3)
|
||||
|
||||
log_message = f"[MEM_DEBUG] {label} | RAM Used: {ram_used_gb:.2f}/{ram_total_gb:.2f} GB"
|
||||
log_message = f"[MultiGPU] {label} | RAM Used: {ram_used_gb:.2f}/{ram_total_gb:.2f} GB"
|
||||
|
||||
if 'gpus' in status:
|
||||
for i, gpu in enumerate(status['gpus']):
|
||||
@@ -19,9 +19,9 @@ def log_memory_usage(label=""):
|
||||
vram_total_gb = gpu.get('vram_total', 0) / (1024**3)
|
||||
log_message += f" | VRAM cuda:{i}: {vram_used_gb:.2f}/{vram_total_gb:.2f} GB"
|
||||
|
||||
logging.info(log_message)
|
||||
logging.debug(log_message)
|
||||
|
||||
except ImportError:
|
||||
logging.warning("[MEM_DEBUG] Could not import local CHardwareInfo. Cannot log memory usage.")
|
||||
logging.warning("[MultiGPU] Could not import local CHardwareInfo. Cannot log memory usage.")
|
||||
except Exception as e:
|
||||
logging.error(f"[MEM_DEBUG] Error getting memory usage: {e}")
|
||||
logging.error(f"[MultiGPU] Error getting memory usage: {e}")
|
||||
|
||||
Reference in New Issue
Block a user