div18 commited on
Commit ·
1c2f24f
1
Parent(s): e890160
fix: total_mem -> total_memory for torch CUDA device properties
Browse files- training/model_utils.py +2 -2
training/model_utils.py
CHANGED
|
@@ -24,7 +24,7 @@ def detect_gpu_tier() -> str:
|
|
| 24 |
if not torch.cuda.is_available():
|
| 25 |
print("[model_utils] No CUDA detected — will be extremely slow")
|
| 26 |
return "t4"
|
| 27 |
-
vram_gb = torch.cuda.get_device_properties(0).
|
| 28 |
name = torch.cuda.get_device_name(0).lower()
|
| 29 |
if "a100" in name or vram_gb >= 70:
|
| 30 |
return "a100"
|
|
@@ -134,7 +134,7 @@ def attach_lora(model, cfg: Dict[str, Any], seed: int = 42):
|
|
| 134 |
|
| 135 |
if torch.cuda.is_available():
|
| 136 |
vram_used = torch.cuda.memory_allocated() / 1e9
|
| 137 |
-
vram_total = torch.cuda.get_device_properties(0).
|
| 138 |
print(f"[model_utils] VRAM: {vram_used:.2f} / {vram_total:.2f} GiB")
|
| 139 |
|
| 140 |
trainable = sum(p.numel() for p in model.parameters() if p.requires_grad)
|
|
|
|
| 24 |
if not torch.cuda.is_available():
|
| 25 |
print("[model_utils] No CUDA detected — will be extremely slow")
|
| 26 |
return "t4"
|
| 27 |
+
vram_gb = torch.cuda.get_device_properties(0).total_memory / 1e9
|
| 28 |
name = torch.cuda.get_device_name(0).lower()
|
| 29 |
if "a100" in name or vram_gb >= 70:
|
| 30 |
return "a100"
|
|
|
|
| 134 |
|
| 135 |
if torch.cuda.is_available():
|
| 136 |
vram_used = torch.cuda.memory_allocated() / 1e9
|
| 137 |
+
vram_total = torch.cuda.get_device_properties(0).total_memory / 1e9
|
| 138 |
print(f"[model_utils] VRAM: {vram_used:.2f} / {vram_total:.2f} GiB")
|
| 139 |
|
| 140 |
trainable = sum(p.numel() for p in model.parameters() if p.requires_grad)
|