feature/SOF 7901#318
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA new Pyodide-compatible MACE model loader utility is introduced, and the relaxation notebook is refactored to use parametrized model selection via ChangesMACE Pyodide Integration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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.
Actionable comments posted: 1
🤖 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 `@src/py/mat3ra/notebooks_utils/pyodide/packages/mace.py`:
- Around line 10-14: The function get_mace_model_pyodide currently defines its
first parameter as model_name which mismatches callers expecting model and will
raise a TypeError; rename the parameter model_name to model (and update any
internal references like MODEL_PATHS_MAP lookup and the variable used to build
model_path) so the signature is def get_mace_model_pyodide(model: str,
dispersion=False, default_dtype="float32", device="cpu") and it still returns
MACECalculator(model_path=model_path, ...); ensure any local variable names and
docstring/comments reflect the new parameter name.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ecdfea09-ffe8-4c9d-a7ef-09307f6cffe6
📒 Files selected for processing (2)
other/experiments/jupyterlite/relax_structure_with_mace.ipynbsrc/py/mat3ra/notebooks_utils/pyodide/packages/mace.py
| def get_mace_model_pyodide(model_name: str, dispersion=False, default_dtype="float32", device="cpu"): | ||
| if model_name not in MODEL_PATHS_MAP: | ||
| raise ValueError(f"Invalid model name: {model_name}. Valid options are: {list(MODEL_PATHS_MAP.keys())}") | ||
| model_path = MODEL_PATHS_MAP[model_name] | ||
| return MACECalculator(model_path=model_path, dispersion=dispersion, default_dtype=default_dtype, device=device) |
There was a problem hiding this comment.
Parameter name mismatch will cause runtime failure in Pyodide.
The notebook (line 239) calls this function via mace_mp(model=MACE_MODEL, ...) after conditionally assigning get_mace_model_pyodide to mace_mp. Since this function's first parameter is model_name instead of model, the call will raise TypeError: get_mace_model_pyodide() got an unexpected keyword argument 'model'.
Rename model_name to model to match the mace_mp API signature.
🐛 Proposed fix
-def get_mace_model_pyodide(model_name: str, dispersion=False, default_dtype="float32", device="cpu"):
- if model_name not in MODEL_PATHS_MAP:
- raise ValueError(f"Invalid model name: {model_name}. Valid options are: {list(MODEL_PATHS_MAP.keys())}")
- model_path = MODEL_PATHS_MAP[model_name]
+def get_mace_model_pyodide(model: str, dispersion=False, default_dtype="float32", device="cpu"):
+ if model not in MODEL_PATHS_MAP:
+ raise ValueError(f"Invalid model name: {model}. Valid options are: {list(MODEL_PATHS_MAP.keys())}")
+ model_path = MODEL_PATHS_MAP[model]
return MACECalculator(model_path=model_path, dispersion=dispersion, default_dtype=default_dtype, device=device)🤖 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 `@src/py/mat3ra/notebooks_utils/pyodide/packages/mace.py` around lines 10 - 14,
The function get_mace_model_pyodide currently defines its first parameter as
model_name which mismatches callers expecting model and will raise a TypeError;
rename the parameter model_name to model (and update any internal references
like MODEL_PATHS_MAP lookup and the variable used to build model_path) so the
signature is def get_mace_model_pyodide(model: str, dispersion=False,
default_dtype="float32", device="cpu") and it still returns
MACECalculator(model_path=model_path, ...); ensure any local variable names and
docstring/comments reflect the new parameter name.
Summary by CodeRabbit