feat(data): add dpdata format conversion - #5565
Conversation
📝 WalkthroughWalkthroughAdds automatic dpdata-based format conversion (e.g., extxyz → LMDB/HDF5) for DeePMD training and validation datasets. Introduces ChangesAutomatic dpdata Format Conversion for Training/Validation Datasets
Sequence Diagram(s)sequenceDiagram
participant User as User Config
participant Entrypoint as Training Entrypoint (pt/pd/pt_expt)
participant ProcessSystems as process_systems()
participant Converter as _convert_system_by_dpdata()
participant Cache as _DPDATA_CONVERSION_CACHE / .deepmd_dpdata_cache
participant DataSystem as LmdbDataSystem / DeepmdDataSystem
User->>Entrypoint: training_data with format="extxyz", out_format="lmdb"
Entrypoint->>ProcessSystems: process_systems(systems, fmt="extxyz", out_fmt="lmdb")
ProcessSystems->>Converter: _convert_system_by_dpdata(path, fmt, out_fmt)
Converter->>Cache: check freshness (mtime vs. cache)
alt cache fresh
Cache-->>Converter: return cached LMDB path
else cache stale or missing
Converter->>Converter: acquire .lock file
Converter->>Converter: dpdata.MultiSystems → temp output
Converter->>Cache: move to cache path, update _DPDATA_CONVERSION_CACHE
Converter->>Converter: release lock
end
Converter-->>ProcessSystems: [lmdb_path]
ProcessSystems-->>Entrypoint: [lmdb_path]
Entrypoint->>DataSystem: LmdbDataSystem(lmdb_path, type_map, ...)
DataSystem-->>Entrypoint: batches (type, natoms_vec, coord, box, ...)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (4)
deepmd/utils/data_system.py (4)
1147-1162: ⚖️ Poor tradeoffRecursive mtime scan may be slow for large source directories.
_source_mtimewalks the entire source directory tree to find the latest modification time. For datasets with many files, this could add noticeable latency on every cache freshness check. Consider caching the computed mtime or using a faster heuristic (e.g., only checking top-level directory mtime plus a sample of files).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@deepmd/utils/data_system.py` around lines 1147 - 1162, The `_source_mtime` function performs a full recursive directory walk using source.rglob("*") to find the latest modification time across all files, which becomes inefficient for large source directories. To improve performance, implement a caching mechanism to store previously computed mtimes so that repeated calls for the same source directory do not re-scan the entire tree, or alternatively replace the full recursive scan with a faster heuristic that only examines the top-level directory mtime and a representative sample of files rather than traversing every single file.
786-796: 💤 Low valueMixed-type detection scans all frames at initialization.
_detect_mixed_typeiterates through every frame in the LMDB dataset comparing atom types, which could be slow for very large datasets (thousands of frames). Consider caching this property in the LMDB metadata during conversion, or adding a sampling heuristic for large datasets.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@deepmd/utils/data_system.py` around lines 786 - 796, The _detect_mixed_type method iterates through all frames in the dataset to check for mixed atom types, which is inefficient for large datasets. Implement caching by storing the detection result as an instance variable after the first call, and consider adding a sampling heuristic for datasets with many frames such that for very large datasets (e.g., more than a configurable threshold), only a sample of frames are checked instead of all frames. Update the method to return the cached result on subsequent calls and use the sampling strategy to limit iterations while still maintaining reasonable confidence in the mixed-type detection.
1395-1408: 💤 Low valueSingle-LMDB fast-path only; consider documenting multi-LMDB limitation.
The LMDB routing only handles the case where
systemsresolves to exactly one LMDB path. If multiple LMDB paths are provided (or conversion produces multiple systems), they fall through toDeepmdDataSystem. Consider adding a log warning or updating docstring to clarify this behavior.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@deepmd/utils/data_system.py` around lines 1395 - 1408, The code currently only provides optimized handling for a single LMDB system through LmdbDataSystem, while multiple LMDB systems silently fall through to DeepmdDataSystem. Add a log warning message when multiple LMDB paths are detected (when len(systems) > 1 and all are LMDB) to alert users that they will be handled through the standard DeepmdDataSystem path rather than the optimized LmdbDataSystem, and update the function's docstring to document this single-LMDB fast-path behavior and clarify what happens with multiple LMDB inputs.
1219-1277: ⚖️ Poor tradeoffStale lock files may persist after process crashes.
If a process crashes after creating the lock file (line 1242) but before the
finallyblock runs (e.g., SIGKILL), the.lockfile will remain. Subsequent processes will wait 5 minutes before timing out. Consider adding stale-lock detection using the PID written to the lock file, or a timestamp-based staleness check.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@deepmd/utils/data_system.py` around lines 1219 - 1277, The _convert_system_by_dpdata function creates lock files to coordinate between processes, but if a process crashes after creating the lock file but before the finally block executes, the lock file persists causing other processes to wait 5 minutes before timing out. Add stale lock detection logic in the except FileExistsError block before calling _wait_for_conversion. Read the PID from the existing lock file and check if that process is still running using platform-appropriate methods (e.g., os.kill with signal 0 on Unix, or process existence checks). If the process is not running or if the lock file is older than a reasonable threshold (e.g., 10 minutes), remove the stale lock file and retry the lock acquisition instead of waiting. This prevents indefinite hangs on stale locks from crashed processes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@deepmd/pd/entrypoints/main.py`:
- Around line 123-144: The current LMDB validation checks for both
training_systems and validation_systems only reject LMDB when the result is a
single system (len(...) == 1), but the error messages indicate that Paddle does
not support LMDB data in general. Remove the len(...) == 1 condition from both
the training_systems check (around line 123) and the validation_systems check
(around line 139) so that any LMDB dataset is rejected regardless of whether
it's a single system or multiple systems in the list. This ensures that any
LMDB-resolved dataset triggers the NotImplementedError with a clear message,
preventing less clear failures downstream.
In `@deepmd/pt_expt/entrypoints/main.py`:
- Around line 118-132: The current code in _get_neighbor_stat_data only
validates the single-LMDB case with `if len(systems) == 1 and
is_lmdb(systems[0])`, but when format-based conversion produces multiple LMDB
paths, this check is skipped and execution falls through to get_data() instead
of raising an appropriate error for list-form LMDB systems. Add validation
guards in both _get_neighbor_stat_data and _build_data_system functions to
ensure that after process_systems() is called, if any LMDB systems are returned,
they are validated to not be in list form (similar to what _detect_lmdb_path
does), and raise a clear error before reaching the fallback get_data() or
DeepmdDataSystem paths.
In `@deepmd/pt/entrypoints/main.py`:
- Around line 197-204: Add a validation guard before the existing condition that
checks `len(systems) == 1 and is_lmdb(systems[0])` to prevent multiple LMDB
paths from being passed to DpLoaderSet. The guard should use
`isinstance(systems, list)` combined with `any(isinstance(s, str) and is_lmdb(s)
for s in systems)` to detect when systems is a list containing LMDB paths and
raise a clear ValueError message explaining that LMDB datasets must be passed as
a scalar string rather than as a list.
In `@deepmd/utils/data_system.py`:
- Around line 848-852: Add a defensive check at the beginning of the
`_stack_frames` method to guard against empty frames lists. Before accessing
`frames[0]` at line 864, add validation to check if the frames list is empty and
handle this edge case appropriately, such as raising a more informative error or
returning early. This will prevent IndexError when the sampler yields an empty
batch due to malformed LMDB data, since both `_load_set` and `get_batch` call
this method with frames lists derived from sampler indices.
---
Nitpick comments:
In `@deepmd/utils/data_system.py`:
- Around line 1147-1162: The `_source_mtime` function performs a full recursive
directory walk using source.rglob("*") to find the latest modification time
across all files, which becomes inefficient for large source directories. To
improve performance, implement a caching mechanism to store previously computed
mtimes so that repeated calls for the same source directory do not re-scan the
entire tree, or alternatively replace the full recursive scan with a faster
heuristic that only examines the top-level directory mtime and a representative
sample of files rather than traversing every single file.
- Around line 786-796: The _detect_mixed_type method iterates through all frames
in the dataset to check for mixed atom types, which is inefficient for large
datasets. Implement caching by storing the detection result as an instance
variable after the first call, and consider adding a sampling heuristic for
datasets with many frames such that for very large datasets (e.g., more than a
configurable threshold), only a sample of frames are checked instead of all
frames. Update the method to return the cached result on subsequent calls and
use the sampling strategy to limit iterations while still maintaining reasonable
confidence in the mixed-type detection.
- Around line 1395-1408: The code currently only provides optimized handling for
a single LMDB system through LmdbDataSystem, while multiple LMDB systems
silently fall through to DeepmdDataSystem. Add a log warning message when
multiple LMDB paths are detected (when len(systems) > 1 and all are LMDB) to
alert users that they will be handled through the standard DeepmdDataSystem path
rather than the optimized LmdbDataSystem, and update the function's docstring to
document this single-LMDB fast-path behavior and clarify what happens with
multiple LMDB inputs.
- Around line 1219-1277: The _convert_system_by_dpdata function creates lock
files to coordinate between processes, but if a process crashes after creating
the lock file but before the finally block executes, the lock file persists
causing other processes to wait 5 minutes before timing out. Add stale lock
detection logic in the except FileExistsError block before calling
_wait_for_conversion. Read the PID from the existing lock file and check if that
process is still running using platform-appropriate methods (e.g., os.kill with
signal 0 on Unix, or process existence checks). If the process is not running or
if the lock file is older than a reasonable threshold (e.g., 10 minutes), remove
the stale lock file and retry the lock acquisition instead of waiting. This
prevents indefinite hangs on stale locks from crashed processes.
🪄 Autofix (Beta)
❌ Autofix failed (check again to retry)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 54161e1f-c01b-4956-b3a7-a6ab0d33cb04
📒 Files selected for processing (7)
deepmd/pd/entrypoints/main.pydeepmd/pt/entrypoints/main.pydeepmd/pt_expt/entrypoints/main.pydeepmd/utils/argcheck.pydeepmd/utils/data_system.pypyproject.tomlsource/tests/common/test_data_system_conversion.py
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5565 +/- ##
==========================================
+ Coverage 79.03% 79.20% +0.17%
==========================================
Files 1055 1072 +17
Lines 122233 125356 +3123
Branches 4401 4541 +140
==========================================
+ Hits 96607 99291 +2684
- Misses 24061 24440 +379
- Partials 1565 1625 +60 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. An unexpected error occurred while generating fixes: Not Found - https://docs.github.com/rest/git/refs#get-a-reference |
Break the LMDB/data-system import cycle, reject ambiguous multi-LMDB results across backends, reject LMDB on Paddle, and guard empty LMDB frame batches with direct regressions. Coding-Agent: Codex Codex-Version: codex-cli 0.144.4 Model: gpt-5.6-sol Reasoning-Effort: xhigh
Resolve the data-loader conflicts while preserving dpdata format conversion, LMDB routing, and the new multi-LMDB validation behavior. Coding-Agent: Codex Codex-Version: codex-cli 0.144.4 Model: gpt-5.6-sol Reasoning-Effort: xhigh
|
Possible reviewers based on changed lines, exact file history, and exact-file review history:
No review request was made automatically. Coding agent: Codex |
Load the dpmodel LMDB helpers only after the legacy data-system module has initialized, preventing backend imports from re-entering a partially initialized module. Coding-Agent: Codex Codex-Version: codex-cli 0.144.4 Model: gpt-5.6-sol Reasoning-Effort: xhigh
deepmd.utils.data_system imports is_lmdb inside the validating function rather than at module scope, so patching the import site no longer resolves and mock raises AttributeError.
There was a problem hiding this comment.
Pull request overview
Adds dpdata-backed automatic dataset format conversion (with caching) to the DeePMD-kit training/validation data pipeline, defaulting converted outputs to LMDB and routing those datasets through backend-appropriate data loaders.
Changes:
- Introduce
format/out_format(output_format) options for training/validation datasets and wire them through TF/JAX legacy loaders, PyTorch, and PT-expt entrypoints. - Add an LMDB adapter (
LmdbDataSystem) plus LMDB-path validation helpers to ensure backends either consume a single LMDB path or raise clear errors (notably for Paddle). - Add tests for conversion/caching behavior and LMDB validation, and promote
dpdata>=1.0.1to a runtime dependency.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| source/tests/pt_expt/test_lmdb_training.py | Adds PT-expt validation tests ensuring converted LMDB resolves to exactly one path. |
| source/tests/common/test_data_system_conversion.py | New unit tests for dpdata conversion defaults, caching behavior, and LMDB validation errors. |
| pyproject.toml | Adds dpdata>=1.0.1 as a runtime dependency (removes it from test extras). |
| deepmd/utils/data_system.py | Implements dpdata conversion + cache/locking, adds validate_lmdb_systems, and introduces LmdbDataSystem. |
| deepmd/utils/argcheck.py | Documents and registers new format / out_format dataset options. |
| deepmd/pt/entrypoints/main.py | Routes converted datasets through PT dataloaders and LMDB dataset path validation (incl. neighbor-stat path). |
| deepmd/pt_expt/entrypoints/main.py | Adds conversion-aware system processing and LMDB validation for PT-expt training + neighbor-stat. |
| deepmd/pd/entrypoints/main.py | Ensures Paddle rejects LMDB-resolved datasets with a clear error. |
| deepmd/dpmodel/utils/lmdb_data.py | Removes data_system import dependency to avoid cycles by computing prob weights locally. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if out_fmt is None: | ||
| out_fmt = _DPDATA_DEFAULT_OUT_FORMAT | ||
| source = Path(source_path) | ||
| fmt = _normalize_dpdata_format(fmt, source) | ||
| out_fmt = out_fmt.lower() | ||
| cache_key = ( | ||
| str(Path.cwd().resolve(strict=False)), | ||
| str(source.resolve(strict=False)), | ||
| fmt, | ||
| out_fmt, | ||
| ) | ||
| if cache_key in _DPDATA_CONVERSION_CACHE: | ||
| return _DPDATA_CONVERSION_CACHE[cache_key] | ||
|
|
||
| output = _conversion_cache_path(source, fmt, out_fmt) | ||
| output.parent.mkdir(parents=True, exist_ok=True) |
There was a problem hiding this comment.
Fixed in b16b180. Cached conversion entries are now revalidated with _is_conversion_current before reuse; stale entries are evicted and regenerated.
Coding agent: Codex
Codex version: codex-cli 0.144.6
Model: gpt-5.6-sol
Reasoning effort: xhigh
| lmdb_path, type_map, batch_size, mixed_batch=False | ||
| ) | ||
| self._type_map = list(type_map) | ||
| self.mixed_type = self._detect_mixed_type() |
There was a problem hiding this comment.
Fixed in b16b180. LmdbDataSystem now uses the reader mixed_type metadata instead of scanning every frame during initialization. The targeted conversion and LMDB tests pass.
Coding agent: Codex
Codex version: codex-cli 0.144.6
Model: gpt-5.6-sol
Reasoning effort: xhigh
| _DPDATA_CACHE_DIR = ".deepmd_dpdata_cache" | ||
| _DPDATA_DEFAULT_OUT_FORMAT = "lmdb" |
There was a problem hiding this comment.
Updated the PR description to document the actual per-working-directory .deepmd_dpdata_cache location and removed the developer-specific absolute path.
Coding agent: Codex
Codex version: codex-cli 0.144.6
Model: gpt-5.6-sol
Reasoning effort: xhigh
Coding-Agent: Codex Codex-Version: codex-cli 0.144.6 Model: gpt-5.6-sol Reasoning-Effort: xhigh
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Suppressed comments (4)
deepmd/utils/data_system.py:1205
- If the converting process crashes after creating the lock file, the
.lockcan persist indefinitely and every future run will wait ~5 minutes and then fail. Consider adding stale-lock recovery: include PID+timestamp in the lock file and, when waiting, remove the lock if it's older than a threshold and the recorded PID is not alive (or the lock mtime is старе than threshold). This avoids permanent failure modes on shared filesystems/cluster retries.
def _wait_for_conversion(source: Path, output: Path, lock_path: Path) -> bool:
for _ in range(300):
if not lock_path.exists():
return _is_conversion_current(source, output)
if _is_conversion_current(source, output):
return True
time.sleep(1.0)
return False
deepmd/utils/data_system.py:1148
- When
format='auto'andsystemspoints to a directory (common for existing DeePMD npy/raw datasets),suffixis empty and this returns'auto', which then forces dpdata conversion viaprocess_systems()even though the input may already be valid DeePMD data. This can lead to unexpected conversion attempts or failures. A concrete fix is to treat directory inputs specially underauto: detect DeePMD directory structure (e.g.,set.*+type_map.raw/type.raw/coord.npy) and skip conversion (setfmt=None), otherwise fall back to suffix-based inference for files.
def _normalize_dpdata_format(fmt: str, source: Path) -> str:
fmt = fmt.lower()
if fmt == "ase":
return "ase/structure"
if fmt != "auto":
return fmt
suffix = source.suffix.lower().lstrip(".")
if suffix == "traj":
return "ase/traj"
if suffix == "extxyz" or (suffix == "xyz" and _looks_like_extxyz(source)):
return "extxyz"
return suffix or fmt
deepmd/utils/data_system.py:40
- PR description says converted datasets are cached under an absolute path (
/home/jzzeng/codes/deepmd-kit/.deepmd_dpdata_cache), but the implementation caches underPath.cwd() / '.deepmd_dpdata_cache'. Please update the PR description to match the implemented behavior, or (if the absolute path is intended) implement/configure the absolute cache location (e.g., via an env var or config key).
_DPDATA_CACHE_DIR = ".deepmd_dpdata_cache"
deepmd/utils/data_system.py:1189
- For directory sources this walks the entire tree (
rglob('*')) to compute freshness, and it can be called repeatedly (e.g., perprocess_systems()invocation and during lock waits). On large datasets this becomes a noticeable overhead. A more scalable approach is to scope the scan to only the selected conversion inputs (especially whenpatternsis provided), cache the computed source timestamp per (source, cwd) within the process, or use a cheaper invalidation scheme (e.g., top-level mtime + a manifest hash) to avoid full-tree scans.
def _source_mtime(source: Path, cache_file: Path) -> float:
if source.is_file():
return source.stat().st_mtime
if not source.is_dir():
return 0.0
cache_dir = cache_file.parent.resolve(strict=False)
latest = source.stat().st_mtime
for item in source.rglob("*"):
try:
item_resolved = item.resolve(strict=False)
if item_resolved == cache_file or cache_dir in item_resolved.parents:
continue
latest = max(latest, item.stat().st_mtime)
except OSError:
continue
return latest
| # Compute the same per-system probabilities as prob_sys_size_ext locally. | ||
| # Keeping this framework-agnostic LMDB module independent of data_system | ||
| # avoids an import cycle when the legacy adapter imports the LMDB reader. | ||
| block_weights = np.asarray([weight for _, _, weight in blocks], dtype=float) | ||
| assert np.all(block_weights >= 0), "the weight of a block should be no less than 0" | ||
| block_probs = block_weights / np.sum(block_weights) | ||
| sys_probs = np.zeros(nsystems, dtype=np.float64) | ||
| for block_idx, (stt, end, _weight) in enumerate(blocks): | ||
| block_frames = np.asarray(system_nframes[stt:end], dtype=float) | ||
| sys_probs[stt:end] = ( | ||
| block_frames / np.sum(block_frames) * block_probs[block_idx] | ||
| ) |
There was a problem hiding this comment.
Resolved in 7ae5c2e: block weights are now validated before use, including shape and value checks, with regression coverage.
Coding agent: Codex
Codex version: codex-cli 0.144.6
Model: gpt-5.6-sol
Reasoning effort: xhigh
| def _remove_path(path: Path) -> None: | ||
| if path.is_dir(): | ||
| shutil.rmtree(path) | ||
| elif path.exists(): | ||
| path.unlink() |
There was a problem hiding this comment.
Resolved in 7ae5c2e: cache cleanup now refuses to follow directory symlinks, preventing deletion outside the cache tree. The focused test suite passes (23 tests).
Coding agent: Codex
Codex version: codex-cli 0.144.6
Model: gpt-5.6-sol
Reasoning effort: xhigh
Reject invalid auto-probability weights before normalization and prevent cache cleanup from following directory symlinks. Add focused regression coverage for both validation paths. Coding-Agent: Codex Codex-Version: codex-cli 0.144.6 Model: gpt-5.6-sol Reasoning-Effort: xhigh
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Suppressed comments (5)
deepmd/pt/entrypoints/main.py:274
- This direct-LMDB fast path also forwards
training_data.batch_sizeintoLmdbDataset, which does not accept list batch sizes. With format conversion defaulting to LMDB, users are more likely to hit LMDB datasets; normalizing/validating the batch size here will produce clearer behavior.
auto_prob = training_dataset_params.get("auto_prob", None)
train_data_single = LmdbDataset(
training_systems,
model_params_single["type_map"],
training_dataset_params["batch_size"],
deepmd/pt_expt/entrypoints/main.py:172
LmdbDataSystemis constructed withbatch_size=dataset_params["batch_size"], butbatch_sizemay be a list in configs. Since LMDB readers expectint | str, normalize a single-element list (and reject longer lists) to avoid runtime type errors when conversion or direct LMDB systems are used.
This issue also appears on line 185 of the same file.
if lmdb_path is not None:
return LmdbDataSystem(
lmdb_path=lmdb_path,
type_map=type_map,
batch_size=dataset_params["batch_size"],
deepmd/pt_expt/entrypoints/main.py:192
- Same issue for the converted-LMDB branch:
batch_sizecan be a list in config, butLmdbDataSystemexpectsint | str. Normalizing/validating before constructing the LMDB adapter avoids hard-to-diagnose failures whenformattriggers LMDB conversion.
if converted_lmdb_path is not None:
return LmdbDataSystem(
lmdb_path=converted_lmdb_path,
type_map=type_map,
batch_size=dataset_params["batch_size"],
auto_prob_style=dataset_params.get("auto_prob"),
seed=seed,
)
deepmd/utils/data_system.py:1445
- When format conversion resolves to a single LMDB path, this code forwards
batch_sizedirectly intoLmdbDataSystem, butbatch_sizecan be a list per argcheck ([list[int], int, str]). Passing a list will raise at LMDB reader construction. Consider normalizing a single-element list to a scalar (and raising a clear error for longer lists) before constructingLmdbDataSystemso converted LMDB datasets work with common configs.
return LmdbDataSystem(
lmdb_path=lmdb_path,
type_map=type_map,
batch_size=batch_size,
auto_prob_style=auto_prob,
deepmd/pt/entrypoints/main.py:255
process_systems(..., fmt=..., out_fmt=...)can now resolve converted datasets to a single LMDB path.LmdbDatasetonly acceptsbatch_size: int | str, buttraining_data.batch_sizemay legally be a list. Normalizing a single-element list (or raising a clear error) here prevents confusing type errors when conversion defaults to LMDB.
This issue also appears on line 270 of the same file.
lmdb_path = validate_lmdb_systems(systems, backend_name="PyTorch")
if lmdb_path is not None:
return LmdbDataset(
lmdb_path,
model_params_single["type_map"],
Summary
formatandout_formatoptions for dpdata-backed conversionlmdband cache converted datasets under the.deepmd_dpdata_cachedirectory beneath the current working directorydpdata>=1.0.1a runtime dependencyCloses #5237
Tests
ruff check .ruff format --check .pytest source/tests/common/test_data_system_conversion.py -qpytest source/tests/common/dpmodel/test_lmdb_data.py::TestLmdbDataReader::test_is_lmdb -qpytest source/tests/tf/test_dp_test.py::TestDPTestEner::test_1frame -qsrun --gres=gpu:1 dp train input.jsonwith extxyz input, default LMDB conversion, no--skip-neighbor-statsrun --gres=gpu:1 dp --pt train input.jsonwith extxyz input, default LMDB conversion, no--skip-neighbor-statsrun --gres=gpu:1 dp --jax train input.jsonwith extxyz input, default LMDB conversion, no--skip-neighbor-stat(environment used CPU JAX fallback because CUDA jaxlib is unavailable)srun --gres=gpu:1 dp --pt-expt train input.jsonverified conversion and neighbor statistics; this environment then hits the existing pt-expt tensor serialization error during model constructionSummary by CodeRabbit
New Features
.extxyz) with automatic conversion to LMDB or other formatsformatandout_format/output_formatfor training and validation datasets to enable flexible data preprocessingTests
Coding agent: Codex
Codex version: codex-cli 0.144.6
Model: gpt-5.6-sol
Reasoning effort: xhigh