computefence 0.3.1__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {computefence-0.3.1 → computefence-0.3.2}/PKG-INFO +2 -1
- computefence-0.3.2/computefence/__init__.py +1 -0
- {computefence-0.3.1 → computefence-0.3.2}/computefence/checks/dataset.py +53 -27
- {computefence-0.3.1 → computefence-0.3.2}/computefence/checks/environment.py +80 -1
- {computefence-0.3.1 → computefence-0.3.2}/computefence/cli.py +9 -8
- {computefence-0.3.1 → computefence-0.3.2}/computefence/drift.py +64 -23
- {computefence-0.3.1 → computefence-0.3.2}/computefence.egg-info/PKG-INFO +2 -1
- {computefence-0.3.1 → computefence-0.3.2}/computefence.egg-info/requires.txt +1 -0
- {computefence-0.3.1 → computefence-0.3.2}/pyproject.toml +3 -2
- computefence-0.3.1/computefence/__init__.py +0 -1
- {computefence-0.3.1 → computefence-0.3.2}/LICENSE +0 -0
- {computefence-0.3.1 → computefence-0.3.2}/README.md +0 -0
- {computefence-0.3.1 → computefence-0.3.2}/computefence/checks/__init__.py +0 -0
- {computefence-0.3.1 → computefence-0.3.2}/computefence/checks/storage.py +0 -0
- {computefence-0.3.1 → computefence-0.3.2}/computefence/telemetry.py +0 -0
- {computefence-0.3.1 → computefence-0.3.2}/computefence.egg-info/SOURCES.txt +0 -0
- {computefence-0.3.1 → computefence-0.3.2}/computefence.egg-info/dependency_links.txt +0 -0
- {computefence-0.3.1 → computefence-0.3.2}/computefence.egg-info/entry_points.txt +0 -0
- {computefence-0.3.1 → computefence-0.3.2}/computefence.egg-info/top_level.txt +0 -0
- {computefence-0.3.1 → computefence-0.3.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: computefence
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Don't lose another RunPod checkpoint to ephemeral disk before your job bills.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Keywords: runpod,vast.ai,gpu training,hf_home,cuda,preflight,machine learning,mlops,checkpoint
|
|
@@ -11,6 +11,7 @@ Requires-Dist: rich>=13.0.0
|
|
|
11
11
|
Requires-Dist: pandas>=1.5.0
|
|
12
12
|
Requires-Dist: typer>=0.9.0
|
|
13
13
|
Requires-Dist: requests>=2.28.0
|
|
14
|
+
Requires-Dist: PyYAML>=5.1
|
|
14
15
|
Dynamic: license-file
|
|
15
16
|
|
|
16
17
|
[](https://github.com/Francisco-Booth/computefence-action)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.2"
|
|
@@ -74,52 +74,78 @@ def check_dataset(dataset_path=None, input_column=None, label_column=None):
|
|
|
74
74
|
"message": "No missing values detected"
|
|
75
75
|
})
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
# BUG-1: convert to str before duplicated() — prevents crash on list columns
|
|
78
|
+
# (chat-format JSON datasets have list-valued columns which are unhashable)
|
|
79
|
+
try:
|
|
80
|
+
duplicate_count = df.astype(str).duplicated().sum()
|
|
81
|
+
if duplicate_count > 0:
|
|
82
|
+
pct = (duplicate_count / row_count) * 100
|
|
83
|
+
results.append({
|
|
84
|
+
"id": "dataset_duplicates",
|
|
85
|
+
"status": "warn",
|
|
86
|
+
"message": f"{duplicate_count:,} duplicate rows detected ({pct:.1f}% of dataset)",
|
|
87
|
+
"fix": "Remove duplicates with df.drop_duplicates() before training"
|
|
88
|
+
})
|
|
89
|
+
else:
|
|
90
|
+
results.append({
|
|
91
|
+
"id": "dataset_duplicates",
|
|
92
|
+
"status": "pass",
|
|
93
|
+
"message": "No duplicate rows detected"
|
|
94
|
+
})
|
|
95
|
+
except Exception as e:
|
|
80
96
|
results.append({
|
|
81
97
|
"id": "dataset_duplicates",
|
|
82
98
|
"status": "warn",
|
|
83
|
-
"message": f"
|
|
84
|
-
"fix": "
|
|
85
|
-
})
|
|
86
|
-
else:
|
|
87
|
-
results.append({
|
|
88
|
-
"id": "dataset_duplicates",
|
|
89
|
-
"status": "pass",
|
|
90
|
-
"message": "No duplicate rows detected"
|
|
99
|
+
"message": f"Could not check for duplicates: {e}",
|
|
100
|
+
"fix": "Check your dataset format"
|
|
91
101
|
})
|
|
92
102
|
|
|
93
103
|
if input_column and label_column:
|
|
104
|
+
# BUG-2: escape column names before they appear in messages
|
|
105
|
+
from rich.markup import escape
|
|
106
|
+
safe_input = escape(str(input_column))
|
|
107
|
+
safe_label = escape(str(label_column))
|
|
108
|
+
safe_cols = escape(", ".join(str(c) for c in df.columns.tolist()))
|
|
109
|
+
|
|
94
110
|
if input_column not in df.columns:
|
|
95
111
|
results.append({
|
|
96
112
|
"id": "dataset_input_column",
|
|
97
113
|
"status": "fail",
|
|
98
|
-
"message": f"Input column '{
|
|
99
|
-
"fix": f"Available columns: {
|
|
114
|
+
"message": f"Input column '{safe_input}' not found in dataset",
|
|
115
|
+
"fix": f"Available columns: {safe_cols}"
|
|
100
116
|
})
|
|
101
117
|
elif label_column not in df.columns:
|
|
102
118
|
results.append({
|
|
103
119
|
"id": "dataset_label_column",
|
|
104
120
|
"status": "fail",
|
|
105
|
-
"message": f"Label column '{
|
|
106
|
-
"fix": f"Available columns: {
|
|
121
|
+
"message": f"Label column '{safe_label}' not found in dataset",
|
|
122
|
+
"fix": f"Available columns: {safe_cols}"
|
|
107
123
|
})
|
|
108
124
|
else:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
125
|
+
# BUG-1: convert to str before groupby() — same unhashable list fix
|
|
126
|
+
try:
|
|
127
|
+
str_df = df.astype(str)
|
|
128
|
+
conflicts = str_df.groupby(input_column)[label_column].nunique()
|
|
129
|
+
conflicting = conflicts[conflicts > 1].count()
|
|
130
|
+
if conflicting > 0:
|
|
131
|
+
results.append({
|
|
132
|
+
"id": "dataset_label_conflicts",
|
|
133
|
+
"status": "warn",
|
|
134
|
+
"message": f"{conflicting:,} inputs have conflicting labels",
|
|
135
|
+
"fix": "Review and resolve label conflicts before training"
|
|
136
|
+
})
|
|
137
|
+
else:
|
|
138
|
+
results.append({
|
|
139
|
+
"id": "dataset_label_conflicts",
|
|
140
|
+
"status": "pass",
|
|
141
|
+
"message": "No conflicting labels detected"
|
|
142
|
+
})
|
|
143
|
+
except Exception as e:
|
|
112
144
|
results.append({
|
|
113
145
|
"id": "dataset_label_conflicts",
|
|
114
146
|
"status": "warn",
|
|
115
|
-
"message": f"
|
|
116
|
-
"fix": "
|
|
117
|
-
})
|
|
118
|
-
else:
|
|
119
|
-
results.append({
|
|
120
|
-
"id": "dataset_label_conflicts",
|
|
121
|
-
"status": "pass",
|
|
122
|
-
"message": "No conflicting labels detected"
|
|
147
|
+
"message": f"Could not check label conflicts: {e}",
|
|
148
|
+
"fix": "Check your dataset format"
|
|
123
149
|
})
|
|
124
150
|
|
|
125
151
|
class_counts = df[label_column].value_counts()
|
|
@@ -140,4 +166,4 @@ def check_dataset(dataset_path=None, input_column=None, label_column=None):
|
|
|
140
166
|
"message": f"Class distribution looks reasonable — ratio {imbalance_ratio:.1f}:1"
|
|
141
167
|
})
|
|
142
168
|
|
|
143
|
-
return results
|
|
169
|
+
return results
|
|
@@ -64,6 +64,83 @@ def detect_torch():
|
|
|
64
64
|
return result
|
|
65
65
|
|
|
66
66
|
|
|
67
|
+
def check_gpu_arch_compat(torch_info):
|
|
68
|
+
"""Check that each visible GPU's compute capability is supported by this PyTorch build."""
|
|
69
|
+
results = []
|
|
70
|
+
try:
|
|
71
|
+
import torch
|
|
72
|
+
if not torch_info["cuda_available"]:
|
|
73
|
+
return results
|
|
74
|
+
|
|
75
|
+
try:
|
|
76
|
+
supported = torch.cuda.get_arch_list()
|
|
77
|
+
except Exception:
|
|
78
|
+
return results
|
|
79
|
+
|
|
80
|
+
# Parse supported list: ["sm_50", "sm_60", ...] → {(5,0), (6,0), ...}
|
|
81
|
+
supported_caps = set()
|
|
82
|
+
for arch in supported:
|
|
83
|
+
if arch.startswith("sm_") and len(arch) > 3:
|
|
84
|
+
digits = arch[3:]
|
|
85
|
+
if len(digits) >= 2:
|
|
86
|
+
try:
|
|
87
|
+
major = int(digits[:-1])
|
|
88
|
+
minor = int(digits[-1])
|
|
89
|
+
supported_caps.add((major, minor))
|
|
90
|
+
except ValueError:
|
|
91
|
+
pass
|
|
92
|
+
|
|
93
|
+
if not supported_caps:
|
|
94
|
+
return results
|
|
95
|
+
|
|
96
|
+
max_supported = max(supported_caps)
|
|
97
|
+
|
|
98
|
+
for i in range(torch_info["device_count"]):
|
|
99
|
+
name = torch_info["device_names"][i] if i < len(torch_info["device_names"]) else f"GPU {i}"
|
|
100
|
+
try:
|
|
101
|
+
cap = torch.cuda.get_device_capability(i)
|
|
102
|
+
except Exception:
|
|
103
|
+
continue
|
|
104
|
+
|
|
105
|
+
# GPU is compatible if its exact capability is listed, or if it's
|
|
106
|
+
# within the same major version and not newer than max supported
|
|
107
|
+
compatible = (cap in supported_caps) or (
|
|
108
|
+
cap[0] == max_supported[0] and cap <= max_supported
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
if not compatible:
|
|
112
|
+
supported_str = ", ".join(
|
|
113
|
+
f"sm_{m}{n}" for m, n in sorted(supported_caps)
|
|
114
|
+
)
|
|
115
|
+
results.append({
|
|
116
|
+
"id": f"gpu_arch_compat_{i}",
|
|
117
|
+
"status": "fail",
|
|
118
|
+
"message": (
|
|
119
|
+
f"{name} has compute capability sm_{cap[0]}{cap[1]}, "
|
|
120
|
+
f"which is not supported by this PyTorch build "
|
|
121
|
+
f"(supports up to sm_{max_supported[0]}{max_supported[1]})"
|
|
122
|
+
),
|
|
123
|
+
"fix": (
|
|
124
|
+
f"Install a PyTorch build that supports sm_{cap[0]}{cap[1]}: "
|
|
125
|
+
f"see https://pytorch.org/get-started/locally/"
|
|
126
|
+
),
|
|
127
|
+
})
|
|
128
|
+
else:
|
|
129
|
+
results.append({
|
|
130
|
+
"id": f"gpu_arch_compat_{i}",
|
|
131
|
+
"status": "pass",
|
|
132
|
+
"message": (
|
|
133
|
+
f"{name} compute capability sm_{cap[0]}{cap[1]} "
|
|
134
|
+
f"is supported by this PyTorch build"
|
|
135
|
+
),
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
except Exception:
|
|
139
|
+
pass
|
|
140
|
+
|
|
141
|
+
return results
|
|
142
|
+
|
|
143
|
+
|
|
67
144
|
def check_environment():
|
|
68
145
|
results = []
|
|
69
146
|
|
|
@@ -137,6 +214,8 @@ def check_environment():
|
|
|
137
214
|
"message": "CUDA not available — PyTorch cannot see any GPUs",
|
|
138
215
|
"fix": "Check your CUDA installation and PyTorch version match"
|
|
139
216
|
})
|
|
217
|
+
else:
|
|
218
|
+
results.extend(check_gpu_arch_compat(torch_info))
|
|
140
219
|
|
|
141
220
|
results.extend(check_accelerate(torch_info=torch_info))
|
|
142
221
|
|
|
@@ -225,4 +304,4 @@ def check_accelerate(config_path=None, torch_info=None):
|
|
|
225
304
|
"fix": "Check your Accelerate config file is valid YAML"
|
|
226
305
|
})
|
|
227
306
|
|
|
228
|
-
return results
|
|
307
|
+
return results
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
import json
|
|
3
3
|
from rich.console import Console
|
|
4
|
+
from rich.markup import escape
|
|
4
5
|
from computefence import __version__
|
|
5
6
|
from computefence.checks.environment import check_environment
|
|
6
7
|
from computefence.checks.storage import check_disk_headroom, check_output_dir, check_storage
|
|
@@ -12,18 +13,18 @@ console = Console()
|
|
|
12
13
|
|
|
13
14
|
def print_result(result):
|
|
14
15
|
status = result.get("status")
|
|
15
|
-
message = result.get("message")
|
|
16
|
+
message = escape(result.get("message", ""))
|
|
16
17
|
fix = result.get("fix")
|
|
17
18
|
if status == "pass":
|
|
18
19
|
console.print(f" [green]✓[/green] {message}")
|
|
19
20
|
elif status == "warn":
|
|
20
21
|
console.print(f" [yellow]⚠[/yellow] {message}")
|
|
21
22
|
if fix:
|
|
22
|
-
console.print(f" [dim]Fix: {fix}[/dim]")
|
|
23
|
+
console.print(f" [dim]Fix: {escape(fix)}[/dim]")
|
|
23
24
|
elif status == "fail":
|
|
24
25
|
console.print(f" [red]✗[/red] {message}")
|
|
25
26
|
if fix:
|
|
26
|
-
console.print(f" [dim]Fix: {fix}[/dim]")
|
|
27
|
+
console.print(f" [dim]Fix: {escape(fix)}[/dim]")
|
|
27
28
|
|
|
28
29
|
def doctor():
|
|
29
30
|
dataset = None
|
|
@@ -148,12 +149,11 @@ def doctor():
|
|
|
148
149
|
console.print("[yellow]" + str(len(warnings)) + " warning(s) found. Review before launching.[/yellow]")
|
|
149
150
|
else:
|
|
150
151
|
console.print("[green]All checks passed. Safe to launch.[/green]")
|
|
151
|
-
console.print(f"[dim]✓ ComputeFence: {len(passed)} checks passed — ~$430 protected.[/dim]")
|
|
152
152
|
console.print()
|
|
153
153
|
console.print("[dim]Tip: add this to your launch script to run automatically every time:[/dim]")
|
|
154
154
|
console.print('[dim] alias train="computefence doctor && python train.py"[/dim]')
|
|
155
155
|
console.print(
|
|
156
|
-
"[dim]
|
|
156
|
+
"[dim]Pseudonymous run stats are not collected by default. "
|
|
157
157
|
"To opt in: touch ~/.computefence_telemetry[/dim]"
|
|
158
158
|
)
|
|
159
159
|
console.print()
|
|
@@ -165,10 +165,10 @@ def doctor():
|
|
|
165
165
|
else:
|
|
166
166
|
success, msg = save_env(output_dir=output_dir, path_override=path_override)
|
|
167
167
|
if success:
|
|
168
|
-
console.print(f"[green]✓ Baseline saved to {msg}[/green]")
|
|
168
|
+
console.print(f"[green]✓ Baseline saved to {escape(msg)}[/green]")
|
|
169
169
|
console.print("[dim]Commit this file to your training repo. On any new pod, clone your repo and run --check-drift to verify the environment matches your last known-good run.[/dim]")
|
|
170
170
|
else:
|
|
171
|
-
console.print(f"[yellow]⚠ Could not save fingerprint: {msg}[/yellow]")
|
|
171
|
+
console.print(f"[yellow]⚠ Could not save fingerprint: {escape(msg)}[/yellow]")
|
|
172
172
|
console.print()
|
|
173
173
|
|
|
174
174
|
record_run(all_results)
|
|
@@ -183,8 +183,9 @@ def main():
|
|
|
183
183
|
if not args or args[0] == "doctor":
|
|
184
184
|
doctor()
|
|
185
185
|
else:
|
|
186
|
-
console.print(f"[red]Unknown command: {args[0]}[/red]")
|
|
186
|
+
console.print(f"[red]Unknown command: {escape(args[0])}[/red]")
|
|
187
187
|
console.print("Usage: computefence doctor")
|
|
188
|
+
sys.exit(1)
|
|
188
189
|
|
|
189
190
|
if __name__ == "__main__":
|
|
190
191
|
main()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Drift detection for ComputeFence v0.2.
|
|
2
|
+
Drift detection for ComputeFence v0.3.2.
|
|
3
3
|
|
|
4
4
|
--save-env : capture a 4-vector environment fingerprint after a clean run
|
|
5
5
|
and write it to .computefence-lock.json in the persistent volume.
|
|
@@ -9,6 +9,8 @@ Drift detection for ComputeFence v0.2.13.
|
|
|
9
9
|
|
|
10
10
|
import json
|
|
11
11
|
import os
|
|
12
|
+
import shutil
|
|
13
|
+
import tempfile
|
|
12
14
|
from pathlib import Path
|
|
13
15
|
|
|
14
16
|
|
|
@@ -36,19 +38,29 @@ def _find_persistent_volume(path_override=None):
|
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
def _get_lock_path(path_override=None):
|
|
39
|
-
#
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
# --path always wins
|
|
42
|
+
if path_override:
|
|
43
|
+
vol = _find_persistent_volume(path_override)
|
|
44
|
+
if vol is None:
|
|
45
|
+
return None
|
|
46
|
+
return vol / LOCK_FILENAME
|
|
47
|
+
|
|
48
|
+
# Secondary: git repo root (project-level persistence)
|
|
49
|
+
git_bin = shutil.which("git")
|
|
50
|
+
if git_bin:
|
|
51
|
+
try:
|
|
52
|
+
import subprocess
|
|
53
|
+
result = subprocess.run(
|
|
54
|
+
[git_bin, "rev-parse", "--show-toplevel"],
|
|
55
|
+
capture_output=True, text=True, timeout=3
|
|
56
|
+
)
|
|
57
|
+
if result.returncode == 0:
|
|
58
|
+
return Path(result.stdout.strip()) / "computefence.lock"
|
|
59
|
+
except Exception:
|
|
60
|
+
pass
|
|
61
|
+
|
|
50
62
|
# Fallback: persistent volume (pod-level persistence)
|
|
51
|
-
vol = _find_persistent_volume(
|
|
63
|
+
vol = _find_persistent_volume()
|
|
52
64
|
if vol is None:
|
|
53
65
|
return None
|
|
54
66
|
return vol / LOCK_FILENAME
|
|
@@ -120,16 +132,34 @@ def save_env(output_dir=None, path_override=None):
|
|
|
120
132
|
"No persistent volume found. Cannot save environment fingerprint. "
|
|
121
133
|
"Use --path /your/persistent/dir to specify one."
|
|
122
134
|
)
|
|
135
|
+
|
|
136
|
+
# SEC-1: refuse symlinks
|
|
137
|
+
if lock_path.is_symlink():
|
|
138
|
+
return False, f"Refusing to write: {lock_path} is a symlink."
|
|
139
|
+
|
|
123
140
|
fingerprint = capture_fingerprint(output_dir)
|
|
124
141
|
try:
|
|
125
|
-
|
|
126
|
-
|
|
142
|
+
# SEC-1: atomic write via temp file + os.replace()
|
|
143
|
+
dir_ = lock_path.parent
|
|
144
|
+
fd, tmp_path = tempfile.mkstemp(dir=dir_, prefix=".computefence-tmp-")
|
|
145
|
+
try:
|
|
146
|
+
with os.fdopen(fd, "w") as f:
|
|
147
|
+
json.dump(fingerprint, f, indent=2)
|
|
148
|
+
os.replace(tmp_path, lock_path)
|
|
149
|
+
except Exception:
|
|
150
|
+
try:
|
|
151
|
+
os.unlink(tmp_path)
|
|
152
|
+
except OSError:
|
|
153
|
+
pass
|
|
154
|
+
raise
|
|
127
155
|
return True, str(lock_path)
|
|
128
156
|
except Exception as e:
|
|
129
157
|
return False, f"Failed to write {lock_path}: {e}"
|
|
130
158
|
|
|
131
159
|
|
|
132
160
|
def _diff_vectors(saved, current):
|
|
161
|
+
from rich.markup import escape
|
|
162
|
+
|
|
133
163
|
results = []
|
|
134
164
|
|
|
135
165
|
s_torch = saved.get("torch", {})
|
|
@@ -137,13 +167,13 @@ def _diff_vectors(saved, current):
|
|
|
137
167
|
if s_torch.get("torch_version") != c_torch.get("torch_version"):
|
|
138
168
|
results.append({
|
|
139
169
|
"status": "warn",
|
|
140
|
-
"message": f"[Drift] PyTorch version changed: {s_torch.get('torch_version')} → {c_torch.get('torch_version')}",
|
|
170
|
+
"message": f"[Drift] PyTorch version changed: {escape(str(s_torch.get('torch_version')))} → {escape(str(c_torch.get('torch_version')))}",
|
|
141
171
|
"fix": "Pin torch version in your requirements or Dockerfile.",
|
|
142
172
|
})
|
|
143
173
|
if s_torch.get("cuda_version") != c_torch.get("cuda_version"):
|
|
144
174
|
results.append({
|
|
145
175
|
"status": "warn",
|
|
146
|
-
"message": f"[Drift] CUDA version changed: {s_torch.get('cuda_version')} → {c_torch.get('cuda_version')}",
|
|
176
|
+
"message": f"[Drift] CUDA version changed: {escape(str(s_torch.get('cuda_version')))} → {escape(str(c_torch.get('cuda_version')))}",
|
|
147
177
|
"fix": "Ensure your pod template uses the same CUDA base image.",
|
|
148
178
|
})
|
|
149
179
|
|
|
@@ -152,7 +182,7 @@ def _diff_vectors(saved, current):
|
|
|
152
182
|
if s_stor.get("hf_home") != c_stor.get("hf_home"):
|
|
153
183
|
results.append({
|
|
154
184
|
"status": "warn",
|
|
155
|
-
"message": f"[Drift] HF_HOME changed: {s_stor.get('hf_home')} → {c_stor.get('hf_home')}",
|
|
185
|
+
"message": f"[Drift] HF_HOME changed: {escape(str(s_stor.get('hf_home')))} → {escape(str(c_stor.get('hf_home')))}",
|
|
156
186
|
"fix": "Set HF_HOME consistently in your startup script.",
|
|
157
187
|
})
|
|
158
188
|
if s_stor.get("output_dir_persistent") and not c_stor.get("output_dir_persistent"):
|
|
@@ -167,13 +197,13 @@ def _diff_vectors(saved, current):
|
|
|
167
197
|
if s_gpu.get("gpu_count") != c_gpu.get("gpu_count"):
|
|
168
198
|
results.append({
|
|
169
199
|
"status": "warn",
|
|
170
|
-
"message": f"[Drift] GPU count changed: {s_gpu.get('gpu_count')} → {c_gpu.get('gpu_count')}",
|
|
200
|
+
"message": f"[Drift] GPU count changed: {escape(str(s_gpu.get('gpu_count')))} → {escape(str(c_gpu.get('gpu_count')))}",
|
|
171
201
|
"fix": "Check your pod configuration matches the saved environment.",
|
|
172
202
|
})
|
|
173
203
|
if s_gpu.get("compute_capabilities") != c_gpu.get("compute_capabilities"):
|
|
174
204
|
results.append({
|
|
175
205
|
"status": "warn",
|
|
176
|
-
"message": f"[Drift] GPU compute capability changed: {s_gpu.get('compute_capabilities')} → {c_gpu.get('compute_capabilities')}",
|
|
206
|
+
"message": f"[Drift] GPU compute capability changed: {escape(str(s_gpu.get('compute_capabilities')))} → {escape(str(c_gpu.get('compute_capabilities')))}",
|
|
177
207
|
"fix": "Different GPU hardware detected. Verify model compatibility.",
|
|
178
208
|
})
|
|
179
209
|
|
|
@@ -185,7 +215,7 @@ def _diff_vectors(saved, current):
|
|
|
185
215
|
if sv != cv:
|
|
186
216
|
results.append({
|
|
187
217
|
"status": "warn",
|
|
188
|
-
"message": f"[Drift] {lib} version changed: {sv} → {cv}",
|
|
218
|
+
"message": f"[Drift] {escape(lib)} version changed: {escape(str(sv))} → {escape(str(cv))}",
|
|
189
219
|
"fix": f"Pin {lib} version in your requirements.",
|
|
190
220
|
})
|
|
191
221
|
|
|
@@ -206,11 +236,22 @@ def check_drift(output_dir=None, path_override=None):
|
|
|
206
236
|
if not lock_path.exists():
|
|
207
237
|
return [{"status": "warn", "message": f"No saved fingerprint at {lock_path}.", "fix": "Run: computefence doctor --save-env"}]
|
|
208
238
|
|
|
239
|
+
# SEC-1: refuse symlinks on read path too
|
|
240
|
+
if lock_path.is_symlink():
|
|
241
|
+
return [{"status": "warn", "message": f"Refusing to read: {lock_path} is a symlink.", "fix": "Delete the symlink and re-run: computefence doctor --save-env"}]
|
|
242
|
+
|
|
209
243
|
try:
|
|
210
244
|
with open(lock_path) as f:
|
|
211
245
|
saved = json.load(f)
|
|
212
246
|
except Exception as e:
|
|
213
247
|
return [{"status": "warn", "message": f"Could not read fingerprint: {e}", "fix": "Delete the file and re-run: computefence doctor --save-env"}]
|
|
214
248
|
|
|
215
|
-
|
|
216
|
-
|
|
249
|
+
# BUG-3: validate lockfile shape before comparing
|
|
250
|
+
if not isinstance(saved, dict) or "torch" not in saved:
|
|
251
|
+
return [{"status": "warn", "message": "Saved fingerprint has unexpected format.", "fix": "Delete the file and re-run: computefence doctor --save-env"}]
|
|
252
|
+
|
|
253
|
+
try:
|
|
254
|
+
current = capture_fingerprint(output_dir)
|
|
255
|
+
return _diff_vectors(saved, current)
|
|
256
|
+
except Exception as e:
|
|
257
|
+
return [{"status": "warn", "message": f"Drift comparison failed: {e}", "fix": "Re-run: computefence doctor --save-env"}]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: computefence
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Don't lose another RunPod checkpoint to ephemeral disk before your job bills.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Keywords: runpod,vast.ai,gpu training,hf_home,cuda,preflight,machine learning,mlops,checkpoint
|
|
@@ -11,6 +11,7 @@ Requires-Dist: rich>=13.0.0
|
|
|
11
11
|
Requires-Dist: pandas>=1.5.0
|
|
12
12
|
Requires-Dist: typer>=0.9.0
|
|
13
13
|
Requires-Dist: requests>=2.28.0
|
|
14
|
+
Requires-Dist: PyYAML>=5.1
|
|
14
15
|
Dynamic: license-file
|
|
15
16
|
|
|
16
17
|
[](https://github.com/Francisco-Booth/computefence-action)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools>=
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
@@ -15,10 +15,11 @@ dependencies = [
|
|
|
15
15
|
"pandas>=1.5.0",
|
|
16
16
|
"typer>=0.9.0",
|
|
17
17
|
"requests>=2.28.0",
|
|
18
|
+
"PyYAML>=5.1",
|
|
18
19
|
]
|
|
19
20
|
|
|
20
21
|
[project.scripts]
|
|
21
22
|
computefence = "computefence.cli:main"
|
|
22
23
|
|
|
23
24
|
[tool.setuptools.dynamic]
|
|
24
|
-
version = {attr = "computefence.__version__"}
|
|
25
|
+
version = {attr = "computefence.__version__"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|