sumitrwk commited on
Commit
70dfeb7
·
verified ·
1 Parent(s): cb61920

Delete model_diagnostics.py

Browse files
Files changed (1) hide show
  1. model_diagnostics.py +0 -44
model_diagnostics.py DELETED
@@ -1,44 +0,0 @@
1
- import re
2
-
3
- class ModelDiagnostics:
4
- @staticmethod
5
- def estimate_vram(param_str):
6
- """
7
- Estimates VRAM usage based on parameter string (e.g., '7B', '0.5B').
8
- Formula: (Params * Precision Bytes) + 20% Overhead for Context/Activations
9
- """
10
- try:
11
- # Clean string and extract number
12
- clean_str = param_str.lower().replace('b', '').replace('m', '')
13
- val = float(clean_str)
14
-
15
- # Normalize to Billions
16
- if 'm' in param_str.lower():
17
- val = val / 1000.0
18
-
19
- # Constants
20
- overhead = 1.2 # 20% overhead for context window/activations
21
-
22
- # Calculations
23
- fp16_gb = (val * 2 * overhead) # 2 bytes per param
24
- int8_gb = (val * 1 * overhead) # 1 byte per param
25
- fp32_gb = (val * 4 * overhead) # 4 bytes per param
26
-
27
- return {
28
- "FP32 (Training/Full)": f"{fp32_gb:.2f} GB",
29
- "FP16 (Inference)": f"{fp16_gb:.2f} GB",
30
- "INT8 (Quantized)": f"{int8_gb:.2f} GB",
31
- "params_in_billions": val
32
- }
33
- except Exception as e:
34
- return None
35
-
36
- @staticmethod
37
- def get_layer_structure(model):
38
- """
39
- Returns the raw string representation of the PyTorch model modules.
40
- """
41
- if model:
42
- # We strip the outer wrapper to get straight to the layers
43
- return str(model)
44
- return "Model not loaded."