deepmodeling / deepmodeling/DeePTB

[Code scan] LMDBDataset loses the source LMDB path when multiple roots match

Open
#353 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
122
Forks
36
PR merge metrics
No merged PRs in 30d

Description

This issue is part of a Codex global repository scan.

Problem:
`LMDBDataset.__init__` counts entries per matched LMDB path, but records only the logical `file` and local index. `get()` recomputes all matching LMDB paths for that file and loops through all of them, overwriting the loaded sample each time.

Code references:
https://github.com/deepmodeling/deeptb/blob/86c60c73996f0dd961c3138f2e88424382cb734e/dptb/data/dataset/lmdb_dataset.py#L69-L77
https://github.com/deepmodeling/deeptb/blob/86c60c73996f0dd961c3138f2e88424382cb734e/dptb/data/dataset/lmdb_dataset.py#L138-L144
https://github.com/deepmodeling/deeptb/blob/86c60c73996f0dd961c3138f2e88424382cb734e/dptb/data/dataset/lmdb_dataset.py#L180-L187

Impact:
For wildcard or multi-root datasets where the same LMDB folder name appears under multiple roots, samples from earlier databases can be read from the last matching LMDB instead. This corrupts dataset indexing and can mix labels/geometries from the wrong source.

Suggested fix:
Record the resolved LMDB path alongside each global sample index, and have `get()` open exactly that path instead of recomputing all matches.

Contributor guide

Open the contributing guide

Research direction

Start in dptb/data/dataset/lmdb_dataset.py at the __init__ and get() sections referenced in the issue, and trace how matched LMDB paths map to global sample indices. Verify that each indexed sample retains its resolved LMDB path and that get() reads only from that path, preventing samples from one database being replaced by another.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.