Repository navigation
Description
In this section:
metatomic/python/metatomic_torch/metatomic/torch/model.py
Lines 950 to 972 in 9f83c71
| if annotations["systems"] != List[System]: | |
| raise TypeError( | |
| "`systems` argument must be a list of metatomic `System`, " | |
| f"not `{_format_annotation(annotations['systems'])}`" | |
| ) | |
| if annotations["outputs"] != Dict[str, ModelOutput]: | |
| raise TypeError( | |
| "`outputs` argument must be `Dict[str, ModelOutput]`, " | |
| f"not `{_format_annotation(annotations['outputs'])}`" | |
| ) | |
| if annotations["selected_atoms"] != Optional[Labels]: | |
| raise TypeError( | |
| "`selected_atoms` argument must be `Optional[Labels]`, " | |
| f"not `{_format_annotation(annotations['selected_atoms'])}`" | |
| ) | |
| if annotations["return"] != Dict[str, TensorMap]: | |
| raise TypeError( | |
| "`forward()` must return a `Dict[str, TensorMap]`, " | |
| f"not `{_format_annotation(annotations['return'])}`" | |
| ) |
AtomisticModel checks the annotations of the model, and it only allows the typing objects (List, Dict...) when it should also allow the builtins (list, dict...)Metadata
Metadata
Assignees
Labels
No labels
Activity
Luthaf commentedon Oct 12, 2026
True, this code is a bit old fashioned! We should update it
kumar-miskin commentedon Oct 22, 2026
I reproduced this with an eager AtomisticModel using list[System] and dict annotations: the Python signature check rejects the systems argument before wrapping. I plan to compare the list/dict origins and type arguments rather than their typing aliases, keeping the existing rejection of wrong element/key/value types. I will add eager and TorchScript coverage, plus mixed typing/builtin annotations. This would stay scoped to the legacy AtomisticModel check, separate from the TorchModel rewrite.