deepmodeling / deepmodeling/unimol_tools
[Code scan] Use dictionary special-token ids for UniMol v1 atomic representations
- Dominant language
- Python
- Stars
- 34
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
This issue is a result of a Codex global repository scan.
## Summary
UniMol v1 atomic representation filtering hard-codes token ids 0, 1, and 2 as BOS/EOS/PAD. The Dictionary actually initializes [CLS]=0, [UNK]=1, [PAD]=2, [SEP]=3. As a result, [SEP] is kept as a fake atom and unknown atoms are dropped from atomic representations.
## Code references
https://github.com/deepmodeling/unimol_tools/blob/4596596aa8f73eb462d5cc5a921d79966d0465da/unimol_tools/models/unimol.py#L255-L283
https://github.com/deepmodeling/unimol_tools/blob/4596596aa8f73eb462d5cc5a921d79966d0465da/unimol_tools/data/dictionary.py#L19-L33
## Impact
return_atomic_reprs=True can return an extra [SEP] entry and omit legitimate unknown atoms, so atomic symbols, coordinates, and representations no longer align with the molecule atoms.
## Suggested fix
Build the filter mask from self.dictionary.bos(), self.dictionary.eos(), and self.dictionary.pad(). Do not filter self.dictionary.unk(), because unknown atom tokens still correspond to atom positions.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.