Skip to content

Conversation

curtischong
Copy link
Collaborator

@curtischong curtischong commented Jul 23, 2025

Summary

This solves #221

I just needed to update some links. This is what metatomic changed in their README when they discovered that the previous links broke. lab-cosmo/pet-mad#33

v1.2.0 is the latest on huggingface (https://huggingface.co/lab-cosmo/pet-mad), but when I went to https://huggingface.co/lab-cosmo/pet-mad/resolve/v1.2.0/models/pet-mad-v1.2.0.ckpt it's not found. So I'm using the v1.1.0 checkpoint (same as their README)

I also fixed a few other failing tests by updating their versions.

Checklist

Before a pull request can be merged, the following items must be checked:

  • Doc strings have been added in the Google docstring format.
    Run ruff on your code.
  • Tests have been added for any new functionality or bug fixes.

We highly recommended installing the pre-commit hooks running in CI locally to speedup the development process. Simply run pip install pre-commit && pre-commit install to install the hooks which will check your code before each commit.

Summary by CodeRabbit

Summary by CodeRabbit

  • Chores
    • Updated the source URL for loading the pretrained metatomic model to use a specific version (v1.1.0) instead of the latest checkpoint for improved consistency.
    • Revised dependency specifications in tutorials and scripts by adding the "vesin-torch>=0.3.7" package and pinning the "pymatviz" package version.

@cla-bot cla-bot bot added the cla-signed Contributor license agreement signed label Jul 23, 2025
Copy link

coderabbitai bot commented Jul 23, 2025

Walkthrough

The changes update the URLs used to load the pretrained "pet-mad" metatomic model checkpoint in both the test fixture and the model constructor. The URLs now point to a specific version ("v1.1.0") instead of the previous "main" branch and "latest" checkpoint. Additionally, new dependencies were added to tutorial scripts, and a package dependency specification was changed from a GitHub URL to a version-pinned PyPI requirement.

Changes

File(s) Change Summary
tests/models/test_metatomic.py Updated checkpoint URL in the metatomic_calculator fixture to use the v1.1.0 model checkpoint.
torch_sim/models/metatomic.py Updated default checkpoint URL in the MetatomicModel constructor to use the v1.1.0 model checkpoint.
docs/_static/draw_pkg_treemap.py Changed pymatviz dependency from GitHub URL to version-pinned PyPI requirement (pymatviz>=0.16.0).
examples/tutorials/metatomic_tutorial.py Added new dependency "vesin-torch>=0.3.7" to the tutorial script metadata.
examples/tutorials/using_graphpes_tutorial.py Added new dependency "vesin-torch>=0.3.7" to the tutorial script metadata.

Estimated code review effort

1 (~5 minutes)

Possibly related issues

  • metaatomics tests are failing #221: Updates the checkpoint URL in both the model loading code and tests to a valid versioned URL, directly addressing the broken URL problem causing the test failures described in the issue.

Poem

A bunny hopped through code so bright,
Swapping URLs to set things right.
From "latest" to versioned, v1.1.0,
Tests and models now ready to go!
With checkpoints fixed and hops anew,
The metatomic model shines through.
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 19a4c7e and bc20156.

📒 Files selected for processing (3)
  • docs/_static/draw_pkg_treemap.py (1 hunks)
  • examples/tutorials/metatomic_tutorial.py (1 hunks)
  • examples/tutorials/using_graphpes_tutorial.py (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • examples/tutorials/metatomic_tutorial.py
  • examples/tutorials/using_graphpes_tutorial.py
  • docs/_static/draw_pkg_treemap.py
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
torch_sim/models/metatomic.py (1)

105-108: Pinning is great – consider centralising the checkpoint URL to avoid duplication.

Hard-coding the full URL here and again in the test file means every upgrade (e.g. v1.1.1) requires a multi-file search-and-replace. Defining a single constant (or env var) will reduce drift and simplify future bumps.

+# Module-level constants
+PET_MAD_VERSION = "v1.1.0"
+PET_MAD_CKPT_URL = (
+    f"https://huggingface.co/lab-cosmo/pet-mad/resolve/{PET_MAD_VERSION}/models/"
+    f"pet-mad-{PET_MAD_VERSION}.ckpt"
+)
 ...
 if model == "pet-mad":
-    path = "https://huggingface.co/lab-cosmo/pet-mad/resolve/v1.1.0/models/pet-mad-v1.1.0.ckpt"
+    path = PET_MAD_CKPT_URL
     self._model = load_model(path).export()

This keeps the version string in one spot and lets tests import the same constant.

tests/models/test_metatomic.py (1)

30-33: Reuse the production constant to keep tests in sync.

The test now duplicates the checkpoint URL changed in metatomic.py. Importing the constant suggested above avoids divergence and reduces maintenance overhead.

-from tests.models.conftest import (
+from torch_sim.models.metatomic import PET_MAD_CKPT_URL
+from tests.models.conftest import (
 ...
-        model=load_model(
-            "https://huggingface.co/lab-cosmo/pet-mad/resolve/v1.1.0/models/pet-mad-v1.1.0.ckpt"
-        ).export(),
+        model=load_model(PET_MAD_CKPT_URL).export(),
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 317985c and 19a4c7e.

📒 Files selected for processing (2)
  • tests/models/test_metatomic.py (1 hunks)
  • torch_sim/models/metatomic.py (1 hunks)

@curtischong curtischong marked this pull request as draft July 23, 2025 12:54
@curtischong curtischong marked this pull request as ready for review July 23, 2025 12:54
@curtischong curtischong marked this pull request as draft July 23, 2025 14:44
@curtischong curtischong marked this pull request as ready for review July 23, 2025 15:03
Copy link
Collaborator

@CompRhys CompRhys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@CompRhys CompRhys merged commit 6c79893 into main Jul 25, 2025
92 of 94 checks passed
@CompRhys CompRhys deleted the fix-metatomic-tests branch July 25, 2025 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed Contributor license agreement signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants