-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Conversation
|
No actionable comments were generated in the recent review. 🎉 i️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds ChangesMPS Availability and Benchmarking
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
phases/00-setup-and-tooling/03-gpu-setup-and-cloud/code/mps_check.py (1)
9-11: ⚡ Quick winCache MPS availability once to reduce repeated backend checks.
You call
torch.backends.mps.is_available()multiple times. Store it once (mps_available) and reuse for output/branching to keep the control flow cleaner.Also applies to: 30-30
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@phases/00-setup-and-tooling/03-gpu-setup-and-cloud/code/mps_check.py` around lines 9 - 11, Cache the result of torch.backends.mps.is_available() in a local variable (e.g., mps_available) and reuse it for both the print and the subsequent if-check instead of calling torch.backends.mps.is_available() twice; update the print call and the if statement to reference mps_available to simplify control flow and avoid repeated backend queries (apply same change in the similar occurrence around lines 30-30).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@phases/00-setup-and-tooling/03-gpu-setup-and-cloud/code/mps_check.py`:
- Line 3: Remove the psutil import and any psutil-based RAM probes in this file
and replace them with a stdlib solution using os.sysconf; specifically, delete
the "import psutil" and modify the RAM-check logic (wherever
psutil.virtual_memory() or psutil.total is used) to call
os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') (or os.sysconf_names
variant) to compute total RAM, keeping the same variable names and checks so
functions like the module-level RAM check or any function that references the
previous psutil-derived value continue to work without changing external
behavior.
---
Nitpick comments:
In `@phases/00-setup-and-tooling/03-gpu-setup-and-cloud/code/mps_check.py`:
- Around line 9-11: Cache the result of torch.backends.mps.is_available() in a
local variable (e.g., mps_available) and reuse it for both the print and the
subsequent if-check instead of calling torch.backends.mps.is_available() twice;
update the print call and the if statement to reference mps_available to
simplify control flow and avoid repeated backend queries (apply same change in
the similar occurrence around lines 30-30).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
i️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: f097dd9a-f8a3-41b1-88dc-96eb1b128478
📒 Files selected for processing (1)
phases/00-setup-and-tooling/03-gpu-setup-and-cloud/code/mps_check.py
What this PR does
Adds an MPS check script for Phase 00 Lesson 03 and fixes PyTorch MPS API usage so the script runs cleanly on Apple Silicon environments with MPS support.
Kind of change
Checklist
LESSON_TEMPLATE.mdstructure[Name](phases/...)), not bare textdocs/en.mdclaimsPhase / lesson
Phase 00 · 03-gpu-setup-and-cloud
Notes for reviewer