Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example TensorMap layout to TargetInfo #370

Merged
merged 14 commits into from
Nov 6, 2024
Merged

Conversation

frostedoyster
Copy link
Collaborator

@frostedoyster frostedoyster commented Oct 26, 2024

Part of #364

Contributor (creator of pull-request) checklist

  • Tests updated (for new features and bugfixes)?
  • Documentation updated (for new features)?
  • Issue referenced (for PRs that solve an issue)?

📚 Documentation preview 📚: https://metatrain--370.org.readthedocs.build/en/370/

@frostedoyster frostedoyster marked this pull request as ready for review October 28, 2024 09:46
@Luthaf Luthaf changed the title Add sample TensorMap to TargetInfo Add example TensorMap to TargetInfo Oct 28, 2024
Copy link
Member

@Luthaf Luthaf left a comment

Choose a reason for hiding this comment

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

I could not find code inside the architectures checking whether the given layout are supported or not. Is this something we should add?

pyproject.toml Outdated
@@ -68,7 +68,7 @@ pet = [
"pet @ git+https://github.com/lab-cosmo/pet@7eddb2e",
]
gap = [
"rascaline-torch @ git+https://github.com/luthaf/rascaline@d181b28#subdirectory=python/rascaline-torch",
"rascaline-torch @ git+https://github.com/luthaf/rascaline@5326b6e#subdirectory=python/rascaline-torch",
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand why these changes appear here, when they should already be on master. Could you squash this PR & rebase?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I merged (saved me some time compared to rebasing). This should be gone

Comment on lines 237 to 238
raise ValueError(
f"Target information for key {key} differs between training sets."
Copy link
Member

Choose a reason for hiding this comment

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

it would be nicer to add what the difference is here, so it is clear to the users

Comment on lines 35 to 38
# one of these will be set to True inside the _check_layout method
self.is_scalar = False
self.is_cartesian = False
self.is_spherical = False
Copy link
Member

Choose a reason for hiding this comment

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

Should these be @property? This way they can not be modified from the outside

src/metatrain/utils/data/readers/readers.py Show resolved Hide resolved
components=[],
properties=Labels.range("energy", 1),
)
energy_layout = TensorMap(
Copy link
Member

Choose a reason for hiding this comment

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

Please add documentation to these. You can add a doctring for variable with

blabla = Something(
    ...
)
"""Some doc string here"""

And then render them with sphinx.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried but I get the following:

 File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/filippo/code/metatrain/.tox/docs/lib/python3.12/site-packages/metatrain/utils/testing.py", line 40, in <module>
    block_with_position_gradients.add_gradient("positions", position_gradient_block)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'add_gradient'

i.e. these seem to be "documentation" objects. SInce the testing module will already be gone in #376, can we do without the docs?

Copy link
Member

Choose a reason for hiding this comment

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

ok, fair enough for now

@Luthaf Luthaf changed the title Add example TensorMap to TargetInfo Add example TensorMap layout to TargetInfo Nov 5, 2024
@frostedoyster
Copy link
Collaborator Author

Regarding the model checks: supporting generic targets is quite a major efforts so I decided to split it into 4 PRs (target info, readers, models, utilities). The model checks will be part of the third PR (I didn't think it was very smart to put in some code that I would have to remove soon after). The current errors are not terrible

@Luthaf
Copy link
Member

Luthaf commented Nov 6, 2024

I decided to split it into 4 PRs (target info, readers, models, utilities)

OK, would have been nice to mention this in the first PR comment, it makes it easier to understand what you are doing!

@Luthaf Luthaf merged commit eb34fed into main Nov 6, 2024
12 checks passed
@Luthaf Luthaf deleted the targetinfo-tensormap branch November 6, 2024 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants