feat: add detect-compute.py — hardware probing for ML feasibility #24
No reviewers
Labels
No labels
community-feedback
enhancement
skill-upgrade
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
magnus/agent-skills!24
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/detect-compute-script"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase 1 of #22
Adds
scripts/detect-compute.py— a standalone CLI that probes the environment and outputs structured JSON recommendations for:Test results: 12/12 passing (7 local + 5 Docker)
Key design decisions:
--minimalflag for quick agent injectionTo test:
bash scripts/test_detect_compute.shCode Review — detect-compute.py
Overall: Solid implementation. The graceful degradation pattern is well-executed, the subprocess probe approach correctly avoids import-side-effect contamination, and the Docker test coverage is a nice touch. A few issues to address:
1. Default output mode mismatch (detect-compute.py:390-403)
The docstring says default is "Pretty-printed system overview" but the else branch (line 401) does
json.dumps(info, indent=2, default=str)— the same as--json. The default should run_format_verbose(info)or a trimmed human-readable version, not dump JSON. Either fix the output or fix the docstring.2. Scope creep — epub unrelated to detect-compute (AGENTS.md, README.md)
AGENTS.md and README.md are modified to add epub skill references. These are unrelated to the PR title "feat: add detect-compute.py" from issue #22. Should be a separate PR.
3. Redundant import shutil inside
_get_disk_free_mb(detect-compute.py:~225)shutilis already imported at module level (line 14). The try/except re-import inside the function is unnecessary —shutil.disk_usageis always available from the module-level import.4. Redundant .strip() on already-stripped stdout (detect-compute.py:~143)
_run()already strips stdout before returning. Thestdout.strip()in the_nvidia_smiparsing loop is redundant.5. Dockerfile uses slim image (test_detect_compute.sh)
Minor:
python:3.12-slimmay not havepippre-installed in all versions. Considerpython:3.12-slim-bookwormwhich has it.Recommendation: Address issues 1-2 before merge. Issues 3-5 are minor.
Jasper (automated review)
Code Review Summary — PR #24
What it does
Adds
data-scientist/scripts/detect-compute.py— a standalone hardware/software probe for ML feasibility. Outputs structured JSON with model size tier, feasible techniques, batch size guidance, quantization options, and distillation feasibility. 12/12 tests passing.Strengths
--json,--minimal,--verbose,--list-gpus,--helpIssues Found (5 inline comments posted)
import shutil— already imported at module levelnotesfield concatenation can produce leading space" PyTorch..."when no threshold note was setsys.executableisolation — may miss torch in venvs if script runs from system Python--list-gpusvs FLAGS keylist_gpusinconsistency;--list_gpussilently ignoredAdditional Observations
--minimal --jsonreturns recommendations JSON nested underinfo["recommendations"];--minimalwithout--jsondoes the same thing — consistent behavior ✓_get_disk_free_mb()returns KB fromdffallback (column 3) not MB, because the result isfree // (1024 * 1024)whiledf -Palready outputs KB. The fallback returns 0 instead of a correct value. (Divide by 1024, not 1024*1024.)Verdict
Clean, well-structured addition. Issues are minor — none block merge. The disk-free calculation in the
dffallback path is the only substantive bug.Reviewer: Jasper (automated review)