Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Walkthrough
Merge Risk:
|
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.00% 78.87% -0.13%
==========================================
Files 1253 1259 +6
Lines 152408 153516 +1108
Branches 5193 5227 +34
==========================================
+ Hits 120412 121089 +677
- Misses 30063 30493 +430
- Partials 1933 1934 +1 ☔ 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.
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
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
Preserve JAX batch configuration and data cleanup, the shared NumPy LMDB adapter, and deterministic native PyTorch LMDB seeding. Coding-Agent: Codex Codex-Version: codex-cli 0.172.0 Model: gpt-6.2-sol Reasoning-Effort: xhigh
OutisLi
left a comment
There was a problem hiding this comment.
I rechecked the updated head af1e755f. The previous merge conflicts are resolved; I am not asking for another conflict-resolution pass. Two data-integrity issues remain. I reproduced both on this head with dpdata 1.1.0 and small labeled EXTXYZ inputs.
-
A new HDF5 reader can silently return the old energy after a successful refresh. Convert one H atom with energy 1 to
deepmd/hdf5and read its energy viaDPPath. Change only the source energy to 42, callprocess_systemsagain in the same process, and construct a newDPPath. Opening the published file afresh with h5py returns 42; the new DeePMD reader returns 1. Publication replaces the file at the same pathname, but the reader caches its open handle by pathname and mode. New readers must resolve the newly published file, without globally closing handles that existing readers still own. -
A process can silently omit a training system published by another process. Process A converts EXTXYZ to
deepmd/npyand discoversH1. Add anH2frame and let process B complete conversion: B discovers both systems. After B exits, A callsprocess_systemsagain and still gets onlyH1. The fast path validates the current disk manifest but returns a list expanded for an earlier publication. Rediscover the systems on a disk-cache hit, or bind the memoized list to the exact source signature/publication it describes. Clearing only the writer's process-local cache cannot fix another reader.
Please fix freshness in the shared conversion/discovery and reader layers, and add these two public-path regressions. The contract is for new reads after completed publication, not hot-reloading an active training iterator. It should hold for training and validation on every backend that accepts the chosen output format. This does not require a new Paddle LMDB reader: Paddle can use explicit NPY/HDF5; the LMDB and mixed-type restrictions should remain explicit. One regression per distinct cache mechanism is more useful than duplicating the same tests per backend.
wanghan-iapcm
left a comment
There was a problem hiding this comment.
This review re-checks the current head af1e755f (the 22 threads from my earlier reviews on this PR are all addressed at this commit).
One blocking finding: the conversion-lock liveness probe calls os.kill(pid, 0), which on Windows terminates the process it is supposed to probe. Details in the inline comment.
| if expected_start is not None and current_start is not None: | ||
| return str(expected_start) == current_start | ||
| try: | ||
| os.kill(pid, 0) |
There was a problem hiding this comment.
On Windows this liveness probe can terminate the process it is meant to observe.
Trigger. Windows with Python 3.10/3.11 (the win_amd64 wheel is cp311 and requires-python is >=3.10), two processes converting the same source. _process_start_time reads /proc/<pid>/stat, which does not exist there, so both the owner's stored token and the current lookup are None; the token comparison above is skipped and this os.kill(pid, 0) runs on the first poll of a live lock. No staleness is involved.
Call chain. deepmd.utils.data_path.process_systems -> _convert_system_by_dpdata (line 541) -> _ConversionLock(lock_path) raises FileExistsError (line 583) -> _wait_for_conversion (line 448) -> _recover_stale_conversion_lock (line 399) -> _lock_owner_is_alive -> os.kill(pid, 0) here.
Consequence. In CPython's Windows os.kill, sig == 0 is CTRL_C_EVENT; when GenerateConsoleCtrlEvent fails for a pid that is not a console process-group leader (the normal case), 3.10/3.11 fall through to TerminateProcess(handle, 0). The waiting process therefore terminates the process that is doing the conversion with exit code 0 -- it looks like a clean exit, but no cache or manifest is published -- and then fails itself; on 3.12+ the same call raises an uncaught OSError in the waiter instead. This is exactly the concurrent-conversion scenario the lock exists for, so the Windows coordination path is destructive rather than serializing.
Evidence boundary. No Windows host was available for this review: the deepmd side is read at af1e755f, and the os.kill semantics come from CPython Modules/posixmodule.c (3.10, 3.11, 3.12, main) plus the Windows SDK's CTRL_C_EVENT == 0, not from a run. A platform-independent liveness decision for this branch (e.g. treating "no start token" as unknown instead of probing with os.kill) would not depend on that semantics.
There was a problem hiding this comment.
Fixed in 66457d103. Liveness probing now calls os.kill(pid, 0) only on POSIX. On Windows, a same-host owner with unknown liveness is left alone; if its heartbeat stalls, the waiter reports an error rather than evicting the lock. The regression exercises both a fresh and an expired heartbeat with the Windows branch enabled and asserts that no signal is sent. This was not run on a native Windows host.
Coding agent: Codex
Codex version: codex-cli 0.172.0
Model: gpt-6.2-sol
Reasoning effort: xhigh
Rediscover systems after any cache publication, reuse HDF5 handles only for the same file identity, and never signal conversion owners on Windows. Coding-Agent: Codex Codex-Version: codex-cli 0.172.0 Model: gpt-6.2-sol Reasoning-Effort: xhigh
|
The two freshness findings from OutisLi’s review are fixed in |
OutisLi
left a comment
There was a problem hiding this comment.
The previous HDF5 and cross-process discovery freshness findings are addressed at this head. Please simplify the legacy LMDB startup path before merging and measure the impact separately on a large dataset. Keep the exact periodic/nonperiodic grouping; replacing it with a sampled check would reintroduce a correctness issue.
| self._test_data.add_data_requirement(data_requirements) | ||
| for item in data_requirements: | ||
| self._data_dict[item.key] = item.dict | ||
| self._refresh_groups() |
There was a problem hiding this comment.
add() calls this path for a single requirement, so several consecutive registrations can rebuild the same statistics/validation views, allocate a new dataset-sized selection mask, and remap all frame indices repeatedly. The reader already distinguishes unchanged availability keys from changes that invalidate its partition. Please reuse that distinction (or defer materializing the views until the requirements are complete) so unrelated registrations do not repeat the dataset-wide work. Keep per-key requirement updates and exact grouping when the availability contract really changes. A focused regression counting rebuilds is enough. Separately report wall time and peak RSS on the same large LMDB and machine before/after the change, breaking out reader/index construction, label registration/view assembly, and first-batch readiness. Please measure existing LMDB startup without dpdata conversion in that timed region and report the dataset size/frame count and the filesystem.
Measured follow-up at 66457d10: on a 1,000,000-frame synthetic LMDB (655 MiB, Linux tmpfs, all energy/force labels present, one nonperiodic frame), registering energy and force together as tracked must=False requirements triggers a second exact scan. The constructor took 27.67 s (21.65 s scanning box); grouped registration took another 21.90 s (21.85 s scanning box, energy, and force), before a 5.6 ms first batch. This is one run of the legacy adapter, not a production-filesystem benchmark. Please test the tracked optional-label case as well as unchanged keys: simply reusing unchanged views will not avoid this second scan. If there is no legitimate early consumer, defer both initial grouping and the sampler-length query until the requirements are known, while keeping exact PBC partitioning.
There was a problem hiding this comment.
Addressed in 6e78ba979.
The legacy adapter now defers view construction and the nominal pass-length query. It still forwards every requirement, but keeps existing views and the sampling plan when the availability keys do not change. The regression covers tracked optional energy and force, a truly changed contract after early access, and unchanged-key updates. It checks scan/view counts and exact missing-label/PBC boundaries.
Measured startup, 66457d10 vs this commit: same 1,000,000-frame synthetic LMDB, 458,653,696 bytes (437.4 MiB), on Linux tmpfs on the same AMD EPYC 7K62 machine, pinned to the same CPU. All frames had energy/force labels, and one was nonperiodic. Batch size 64, seed 2026, one run per revision, existing LMDB only (generation and dpdata conversion excluded). Registration timing includes fetching the views and nominal batch count so the deferred work is included.
| Phase | Wall before | Wall after | Parent peak RSS before | Parent peak RSS after |
|---|---|---|---|---|
| Reader/index construction | 32.00 s | 0.10 s | 213.4 MiB | 188.9 MiB |
| Optional-label registration, views and pass length | 33.68 s | 33.82 s | 222.5 MiB | 213.2 MiB |
| First batch after setup | 11.3 ms | 11.2 ms | 229.6 MiB | 220.7 MiB |
Total to first batch: 65.69 s → 33.93 s. Exact scans: box-only plus box/energy/force → one box/energy/force scan. RSS is the cumulative high-water mark at each phase boundary. The scan helper's per-child peak RSS was 590.6 MiB before and 590.8 MiB after, measured separately (not summed with the parent peak).
Validation: conversion, common LMDB, native PyTorch LMDB, and single-frame TensorFlow tests passed across the runs (299 tests, 42 subtests); Ruff passed.
Coding agent: Codex
Codex version: codex-cli 0.172.0
Model: gpt-6.2-sol
Reasoning effort: xhigh
There was a problem hiding this comment.
Rechecked 5c14a707: the shared PT-expt/JAX adapter now defers the scan for one LMDB. The grouped startup path still scans each leaf twice. Both entrypoints print data summaries before registering loss requirements; GroupedDataSystem.print_summary() asks for exact component probabilities, which materializes the child batch plans with only box registered. Registering optional energy/force then invalidates that index.
I reproduced this with two real small LMDBs using the shared adapter and the same call order: print_summary → add_data_requirements with optional E/F → first stats/batch-plan access. Each leaf scanned once for box and again for box/energy/force. Moving the same summary after registration reduced this to one scan per leaf and preserved final batch counts (4 and 2) and the separation of periodic/nonperiodic frames. This is an adapter-level reproduction, not a full trainer benchmark.
Please defer exact grouped probability logging until requirements are registered, or make the early summary metadata-only. A focused two-source regression using the entrypoint order and checking one exact scan per leaf would cover the remaining case.
Defer the initial LMDB views and pass sizing until requested. Reuse exact groups and sampling plans for unchanged availability keys. Coding-Agent: Codex Codex-Version: codex-cli 0.172.0 Model: gpt-6.2-sol Reasoning-Effort: xhigh
Publish converted LMDBs as immutable generations so live readers remain consistent, and defer experimental adapter statistics scans until label registration is complete. Coding-Agent: Codex Codex-Version: codex-cli 0.172.0 Model: gpt-6.2-sol Reasoning-Effort: xhigh
wanghan-iapcm
left a comment
There was a problem hiding this comment.
A re-review of the two commits since the previous round (per-generation LMDB publication and deferred legacy availability grouping). No blocking issue was found.
Four points on the HDF5 handle/signature layer, unchanged by these commits but still live at this head:
deepmd/utils/path.py:334— a handle keyed only by stat identity is returned after a cache refresh on filesystems whosest_inois constant or zero, so a new reader keeps the pre-refresh snapshot.deepmd/utils/data_conversion.py:252— directory dedup by(st_dev, st_ino)prunes unrelated subtrees when inode numbers are not unique, so nested source edits leave the signature unchanged.deepmd/utils/data_conversion.py:425— without/procstart tokens, a successfulos.kill(pid, 0)is taken as proof of life; a reused PID leaves the waiter in an unbounded loop.deepmd/utils/path.py:439— the weak-key pending-names map can drop entries for a file whose writer handle was collected while an equal handle is still live, so flushed datasets can be reported missing.
| with cls._open_lock: | ||
| info = os.stat(path) | ||
| # Atomic publication replaces the inode, not the existing handle. | ||
| key = (path, mode, info.st_dev, info.st_ino) |
There was a problem hiding this comment.
The shared-handle key is (realpath, mode, st_dev, st_ino), so it changes only when the stat identity changes. On filesystems that report a constant or zero st_ino (some network and FUSE mounts), the key is effectively just the path: a handle opened before a cache refresh is returned to a reader created after the refresh, and the new reader keeps reading the pre-refresh dataset. That contradicts the documented guarantee that a new reader sees the refreshed labels. This was reproduced at 66457d1 by forcing st_ino=0: the reader constructed after the cache replacement returned the old values. Keying on something that changes with publication (mtime/size, or an explicit generation), or bypassing the shared cache when the identity is not distinguishing, would avoid the stale snapshot.
There was a problem hiding this comment.
Fixed in a0e12dd81. Read-only handle reuse now checks the file's timestamps and size as well as its device and inode, and bypasses the Python handle cache for a zero inode. Descendant paths stay pinned to the parent handle. The EXTXYZ-to-HDF5 regression forces a constant nonzero inode and verifies that a new reader sees energy 42 while the original reader still sees 1. The full local validation passed: 124 tests and 12 subtests, including TensorFlow single-frame inference.
Coding agent: Codex
Codex version: codex-cli 0.172.0
Model: gpt-6.2-sol
Reasoning effort: xhigh
| ).encode() | ||
| ) | ||
| if identity in visited: | ||
| dirs[:] = [] |
There was a problem hiding this comment.
_source_signature prunes a directory subtree whenever (st_dev, st_ino) was already visited. On filesystems where inode numbers are not unique (FAT/exFAT/ReFS/FUSE-style volumes), the first directory's identity matches unrelated later directories, so their files are never hashed and edits below them leave the digest unchanged. The manifest then matches and a stale conversion is judged current. With st_ino=0 forced, editing a nested system file produced an identical digest at 66457d1. The dedup is only sound when identity is unique; otherwise it needs a realpath or root-relative component in the visited key.
There was a problem hiding this comment.
Fixed in a0e12dd81. The source walk now deduplicates directories by resolved path rather than by device and inode. Distinct subtrees remain visible even when they report the same inode, while symlink aliases and back edges are still visited at most once. The regression forces zero directory inodes and verifies that editing a nested file changes the signature; the existing symlink cycle test also passed.
Coding agent: Codex
Codex version: codex-cli 0.172.0
Model: gpt-6.2-sol
Reasoning effort: xhigh
| except ProcessLookupError: | ||
| return False | ||
| except PermissionError: | ||
| return True |
There was a problem hiding this comment.
When /proc start tokens are unavailable (macOS, restricted /proc), both expected_start and current_start are None, and this path treats a successful os.kill(pid, 0) as proof of life. If the owner died and its PID was reused, the lock is never recovered: _recover_stale_conversion_lock never evicts it and _wait_for_conversion loops without a timeout, bypassing both the lease and the error path. PID liveness is not a stable identity; an upper bound on the wait (then raise) would keep this fallback from hanging.
There was a problem hiding this comment.
Fixed in a0e12dd81. A successful signal-zero probe (or a permission error) no longer confirms that the PID belongs to the writer. When the start token is unavailable, a fresh heartbeat still protects the writer; after lease expiry the waiter reports the unverifiable owner without deleting the lock. The regression covers a live but unverifiable PID and checks that the wait ends at expiry.
Coding agent: Codex
Codex version: codex-cli 0.172.0
Model: gpt-6.2-sol
Reasoning effort: xhigh
|
|
||
| __file_new_keys: ClassVar[dict[h5py.File, list[str]]] = {} | ||
| _file_keys: ClassVar[WeakKeyDictionary[h5py.File, list[str]]] = WeakKeyDictionary() | ||
| _file_new_keys: ClassVar[WeakKeyDictionary[h5py.File, list[str]]] = ( |
There was a problem hiding this comment.
_file_new_keys is a WeakKeyDictionary: entries are dropped when the key object is collected, while lookups are by handle equality (h5py handles for the same file compare and hash equal regardless of mode). With two live handles for one file, collecting the writer handle drops the "names written since the last scan" state even though an equal reader handle still uses it, after which is_file/glob report the flushed dataset as missing. This was reproduced at 66457d1 with two simultaneous handles; no in-repo caller currently does that, but the equality-based contract makes it reachable. An explicit-release dict keyed by the same identity, or storing pending names on the handle holder rather than in a weak map, avoids the lifetime mismatch.
There was a problem hiding this comment.
Fixed in a0e12dd81. Removed the weak-key namespace caches. File and group checks now query the live HDF5 handle, and glob traverses only the requested group. The regression opens separate writer and reader handles, flushes a new dataset, drops the writer, and verifies that both is_file and glob still see it from the reader.
Coding agent: Codex
Codex version: codex-cli 0.172.0
Model: gpt-6.2-sol
Reasoning effort: xhigh
Distinguish refreshed HDF5 snapshots and scan canonical source paths independently of inode uniqueness. Consult live HDF5 names and honor the heartbeat lease when a conversion owner cannot be verified. Coding-Agent: Codex Codex-Version: codex-cli 0.172.0 Model: gpt-6.2-sol Reasoning-Effort: xhigh
OutisLi
left a comment
There was a problem hiding this comment.
The single-LMDB startup improvement is useful, and the later HDF5/cache identity fixes do not change the remaining grouped LMDB startup issue. On the grouped PT-expt/JAX path the startup summary materializes exact sampling probabilities before optional loss labels are registered. That builds per-leaf plans using just box; registering optional energy/force invalidates them, so each leaf is scanned again. I reproduced the repeated scan with two real LMDBs. The reported 1M-frame single-source benchmark does not cover this path.
Please defer exact grouped probabilities until loss requirements are registered, or make the preliminary summary metadata-only. Keep exact periodic/nonperiodic grouping. Add a small two-leaf scan-count regression with the same final probabilities, and separately report startup to first batch on a genuinely large grouped LMDB dataset.
Keep GroupedDataSystem.print_summary metadata-only until child LMDB batch plans are materialized so preliminary startup summaries do not scan leaves with box-only availability before optional loss requirements are registered. Also invalidate cached grouped sampling weights in legacy add/add_dict and replace the empty PermissionError handler in data_conversion._lock_owner_is_alive with an explicit return. Coding-Agent: Antigravity Antigravity-Version: 1.5.23 Model: Gemini 4 Neon (High) Reasoning-Effort: high
|
Pushed
Measured grouped LMDB startup (
Final parent peak RSS: 580.2 MiB → 470.3 MiB. Both runs produced identical Local validation (Python 3.10.12 worktree):
|
OutisLi
left a comment
There was a problem hiding this comment.
The extra startup scan is gone in the legacy adapter. On the same one-million-frame LMDB fixture, time to first batch dropped from 53.10 s to 25.84 s with identical batch counts and sampling weights. The conversion suite passed locally (67 tests and 16 subtests).
wanghan-iapcm
left a comment
There was a problem hiding this comment.
Reviewed at e122dae. Two findings, both on the conversion path.
- The cache name is built from the source stem and gains a 16-hex digest plus a 32-hex generation, so a legal 189-byte stem produces a 256-byte component and conversion aborts with
OSError: [Errno 36]. - The fallback intended for formats without a MultiSystems reader also catches per-frame
ValueError, and the single-system retry reads only the first frame, so a partially labeled multi-frame input is silently truncated and the truncated result is cached.
| stem = source_resolved.stem or source_resolved.name or "dataset" | ||
| safe_out_fmt = out_fmt.replace("/", "-") | ||
| suffix = ".lmdb" if _is_dpdata_lmdb_format(out_fmt) else "" | ||
| return Path.cwd() / _DPDATA_CACHE_DIR / f"{stem}-{safe_out_fmt}-{digest}{suffix}" |
There was a problem hiding this comment.
_conversion_cache_path builds the cache basename as f"{stem}-{safe_out_fmt}-{digest}{suffix}", and _lmdb_generation_path appends -<32 hex>.lmdb. With the default out_format (deepmd/lmdb) the published basename is stem + 67 bytes, so a source whose stem is 189 bytes or longer — a perfectly legal file name — yields a 256-byte component and the first write fails with OSError: [Errno 36] File name too long (a 188-byte stem gives exactly 255 and still works). Nothing truncates or hashes the stem and no validation rejects the input.
Trigger. Non-native format (e.g. extxyz), out_format omitted (defaults to deepmd/lmdb), source stem length S >= 189 bytes.
Call chain. resolve_data_groups -> _convert_system_by_dpdata -> _conversion_cache_path (S+34) -> _lmdb_generation_path (S+67) -> multi_systems.to -> OSError.
Consequence. Training aborts during data setup with a bare OSError; renaming the input or choosing another out_format (threshold ~S=208) is the only workaround.
Evidence boundary. Code read at HEAD plus standard POSIX NAME_MAX semantics; no run with a 189-byte name.
There was a problem hiding this comment.
Fixed in 869f92375. _conversion_cache_path now truncates the readable stem to at most 48 UTF-8 bytes and the sanitized output format to at most 32 UTF-8 bytes on valid UTF-8 character boundaries, while keeping the full resolved source path in the 16-hex SHA-256 digest. That keeps the cache path (<= 103 B), the 32-hex LMDB generation path (<= 136 B), and dpdata's .tmp-* staging directory (<= 150 B) well below POSIX NAME_MAX (255 B). Added regression coverage for distinct 220-byte ASCII stems sharing a long prefix and a 240-byte multi-byte UTF-8 stem.
Coding agent: Antigravity
Antigravity version: 1.5.24
Model: Gemini 4 Neon (High)
Reasoning effort: high
| multi_systems = dpdata.MultiSystems() | ||
| try: | ||
| multi_systems.load_systems_from_file(str(source), fmt=fmt, labeled=labeled) | ||
| except (NotImplementedError, ValueError) as load_error: |
There was a problem hiding this comment.
except (NotImplementedError, ValueError) is intended for formats that implement the single-system reader but not the MultiSystems reader, but the same except also catches a ValueError raised by per-frame validation during the MultiSystems load. The fallback then reads the input with LabeledSystem(...), and dpdata's single-system reader returns only the first frame, so a multi-frame file whose first frame carries an energy and a later frame does not is silently converted to a one-frame dataset and published to the cache. Minimum trigger: two frames, frame 1 labeled, frame 2 unlabeled.
Trigger. format: extxyz (or auto on a .xyz/.extxyz path), labeled left at its default true, and any later frame missing the energy field.
Call chain. process_systems -> _convert_system_by_dpdata -> _write_dpdata_conversion -> load_systems_from_file (ValueError) -> LabeledSystem(...) (first frame only) -> MultiSystems(system) -> manifest publish.
Consequence. Training or validation silently runs on a truncated dataset and the poisoned conversion is cached, contradicting the contract stated in this module that a failed labeled read must never discard labels or publish unsupervised data.
Evidence boundary. deepmd and dpdata v1.1.0 source reading; no end-to-end run.
There was a problem hiding this comment.
Fixed in 869f92375. _write_dpdata_conversion now queries dpdata.format.Format to check whether the format implements MultiSystems.from: formats without a MultiSystems reader load directly through LabeledSystem/System, while MultiSystems-capable formats never fall back to the single-system reader on ValueError or NotImplementedError. When the format registry is unavailable or fmt is unresolved (e.g. auto on extensionless OUTCAR), fallback only runs on NotImplementedError, never ValueError. Added end-to-end regression tests with partially labeled two-frame .extxyz and .xyz (auto) inputs verifying that ValueError is raised and no LMDB or manifest is cached.
Coding agent: Antigravity
Antigravity version: 1.5.24
Model: Gemini 4 Neon (High)
Reasoning effort: high
…back Address review findings on the dpdata conversion path and harden LMDB resource cleanup and validation: - Bound the human-readable stem (48 UTF-8 bytes) and format label (32 UTF-8 bytes) in `_conversion_cache_path` on UTF-8 character boundaries while hashing the full resolved source path into the digest, keeping cache paths, 32-hex LMDB generations, and dpdata's `.tmp-*` staging directories well below POSIX NAME_MAX. - Check dpdata's format registry before falling back from `MultiSystems.load_systems_from_file` to single-system loading, and never catch `ValueError` or retry a MultiSystems-capable format with the single-system reader, preventing silent single-frame truncation of partially labeled multi-frame inputs. - Avoid passing `follow_symlinks=False` to `os.utime` in `_ConversionLock._heartbeat` when unsupported (Windows). - Align `LmdbDataSystem._legacy_batch` `natoms_vec`/`numb_copy` dtypes with `DeepmdDataSystem` (`dtype=int`) for TF `DatasetLoader`, add `LmdbDataSystem.add_dict`, validate LMDB options/type_map in `get_neighbor_stat_data` before dpdata conversion, validate `valid_data.mixed_type` in `DPTrainer.train`, close LMDB handles on `dpmodel.LmdbDataSystem.close()`, constructor failures, and `dp test`, and reject malformed `prob_sys_size` prefixes and invalid weights on emptied blocks in `compute_block_targets`. Coding-Agent: Antigravity Antigravity-Version: 1.5.24 Model: Gemini 4 Neon (High) Reasoning-Effort: high
|
Pushed
Validation: |
wanghan-iapcm
left a comment
There was a problem hiding this comment.
Re-review at 869f923. The two findings from the previous round are fixed at this head. Three further issues remain, all on the new conversion/caching path: (1) the shared-read HDF5 handle key can miss a same-size rewrite on coarse-timestamp filesystems and serve stale data; (2) release() joins the heartbeat thread without a timeout while the heartbeat may be blocked on an infinitely-waiting file lock, which can hang the converting process; (3) the source-signature content-hash arm and the 1 MiB boundary have no test that would fail if they regressed.
| return h5py.File(path, mode) | ||
| # Writable handles stay shared across their own in-place writes. | ||
| revision = ( | ||
| (info.st_mtime_ns, info.st_ctime_ns, info.st_size) |
There was a problem hiding this comment.
The shared read handle is keyed on (st_mtime_ns, st_ctime_ns, st_size). That tuple does not change on every content change: on filesystems with coarse timestamps (vfat: ctime is the creation time and mtime has 2 s granularity; ext3/fat: 1 s), a same-size in-place rewrite within one tick leaves all three fields identical, so _open_files.get(key) returns the pre-rewrite h5py.File and reads silently serve stale data until the process restarts.
Trigger. Same-size in-place rewrite of an HDF5 file with delta < G, where G is the filesystem timestamp granularity (2 s on vfat, 1 s on ext3).
Call chain. DPH5Path(path, "r") -> _load_h5py -> os.stat -> _open_files.get(key) -> cached handle -> load_numpy/attribute access.
Consequence. Training or validation reads the pre-rewrite content after an in-place update; there is no error and no way to notice except a restart.
Possible fix. Make the revision a content-derived value, or refuse to share handles across snapshots on filesystems whose timestamp granularity cannot distinguish rewrites.
Evidence boundary. Code reading plus POSIX/vfat timestamp semantics; not reproduced on vfat or ext3.
There was a problem hiding this comment.
Fixed in bf3ccd1a7. DPH5Path._load_h5py now opens a fresh h5py.File(path, 'r') for read-only opens instead of caching them by stat metadata, so coarse-timestamp (vfat/ext3) or constant-inode filesystems cannot return a stale cached handle after a same-size rewrite or replacement. Descendant paths created via / or glob stay pinned to their parent handle via _with_name, libhdf5 refcounts the underlying OS file descriptor internally, and writable handles remain shared in _open_files. Added TestH5PathReadOnly.test_readonly_reopen_sees_same_size_rewrite_with_frozen_stat covering both atomic replacement and same-size in-place rewrites with frozen stat metadata.
Coding agent: Antigravity
Antigravity version: 1.5.24
Model: Gemini 4 Neon (High)
Reasoning effort: high
| def release(self) -> None: | ||
| """Stop heartbeating and remove only the lock inode we own.""" | ||
| self._stop.set() | ||
| self._thread.join() |
There was a problem hiding this comment.
release() waits for the heartbeat thread without a timeout, and the heartbeat can be blocked inside with _conversion_lock_guard(self.path): filelock's default acquire timeout is infinite. If another process holds the guard when the heartbeat wakes, join() never returns and the converting process hangs silently.
Trigger. Two processes share the cache directory; process A is in release() while process B holds the guard (the waiter/scan/recovery path) long enough that the heartbeat cannot enter the guarded section.
Call chain. ConversionLock.__exit__ -> release() -> _stop.set() -> _thread.join() -> heartbeat blocked in _conversion_lock_guard's filelock.acquire.
Consequence. Conversion finishes its work but the process cannot proceed or exit; no timeout, no log. Shared/NFS cache directories are the multi-process scenario this lock exists for.
Possible fix. Acquire the guard in _heartbeat with a bounded timeout (treat failure as losing the lease) and give the join() in release() a timeout.
Evidence boundary. Code reading plus filelock default semantics; no concurrent reproducer run.
There was a problem hiding this comment.
Fixed in bf3ccd1a7. _conversion_lock_guard now accepts a timeout, _heartbeat acquires the guard with _CONVERSION_LOCK_GUARD_TIMEOUT_SECONDS (logging a warning and stopping on filelock.Timeout, and re-checking _stop after acquisition), and release() joins the heartbeat thread and acquires the guard with _CONVERSION_LOCK_RELEASE_TIMEOUT_SECONDS (logging a warning instead of hanging if the guard or heartbeat is stalled). Added test_conversion_lock_heartbeat_and_release_do_not_hang_on_held_guard exercising both an externally held .guard lock and a stalled heartbeat thread.
Coding agent: Antigravity
Antigravity version: 1.5.24
Model: Gemini 4 Neon (High)
Reasoning effort: high
| with path.open("rb") as fp: | ||
| # Bound the read even if a concurrent writer grows the input. | ||
| digest.update( | ||
| hashlib.sha256(fp.read(_DPDATA_SOURCE_HASH_LIMIT + 1)).digest() |
There was a problem hiding this comment.
The content hash is never the deciding factor in the tests. On POSIX, st_ctime_ns changes on every rewrite, so the metadata part of the signature always invalidates a cache entry first: the hash arm (regular files <= _DPDATA_SOURCE_HASH_LIMIT) and the 1 MiB boundary have no assertion, even though the hash is the mechanism this signature relies on where ctime is the creation time (Windows/vfat).
Trigger. A regression in the hash arm (e.g. < instead of <=, dropping the bounded read, a wrong limit) does not fail any test. The intended input — same size and preserved mtime, different bytes — is never constructed.
Suggested test. Unit-test _source_signature with Path.stat patched to return identical metadata for changed content, and assert the signature changes; add a case on both sides of _DPDATA_SOURCE_HASH_LIMIT so the boundary is exercised.
Evidence boundary. Test bodies and implementation read; no run.
There was a problem hiding this comment.
Fixed in bf3ccd1a7. Added test_source_signature_content_hash_and_limit_boundary with Path.stat patched to frozen identical metadata so only the content-hash arm can distinguish edits. It asserts signature changes below the limit and at the exact 1 MiB _DPDATA_SOURCE_HASH_LIMIT boundary (modifying only the final byte), confirms hashing is skipped at limit + 1, and checks the limit + 1 read bound on concurrent growth.
Coding agent: Antigravity
Antigravity version: 1.5.24
Model: Gemini 4 Neon (High)
Reasoning effort: high
…aits Address the three review findings on `869f92375`: - Open a fresh `h5py.File(path, "r")` in `DPH5Path._load_h5py` instead of caching read-only handles by stat metadata, avoiding stale reads after same-size rewrites on coarse-timestamp (vfat/ext3) or constant-inode filesystems while keeping descendants pinned via `_with_name` and writable handles shared in `_open_files`. - Give `_ConversionLock._heartbeat` and `_ConversionLock.release` bounded guard-lock timeouts (`filelock.Timeout`) and give `release()` a bounded `join()` timeout so a stalled peer holding the `.guard` lock cannot hang the converting process indefinitely. - Add regression tests for frozen-stat HDF5 replacement and in-place rewrites, bounded heartbeat/release timeouts under a held guard or stalled heartbeat, and `_source_signature` content hashing across the 1 MiB `_DPDATA_SOURCE_HASH_LIMIT` boundary with frozen stat metadata. Coding-Agent: Antigravity Antigravity-Version: 1.5.24 Model: Gemini 4 Neon (High) Reasoning-Effort: high
|
Pushed
Validation: |
Add automatic training/validation conversion through dpdata
formatandout_format(output_formatalias), defaulting to cacheddeepmd/lmdboutput. Multiple converted paths compose through the native data-group API.Conversion lives in a loader-independent module, eliminating import cycles between path discovery, data configuration, and LMDB. The legacy
data_system.process_systemssignature delegates to the common path router.Conversion tracks file metadata, small-file content, and directory-symlink targets and children, with cycle protection. Owned locks serialize writers, and source changes during conversion prevent publication of a valid cache manifest. Setup failures close readers already acquired for the task or data group.
LMDB adaptations preserve the legacy mixed-type
natoms_vecinvariant and exactly partition periodic/nonperiodic frames, including rare zero-cell frames outside the optional-label probe. Neighbor-statistics proxies likewise separate periodicity. The legacy adapter uses the common batch iterator for grouped sampling and progress restoration. Bulk key mapping stays in NumPy; availability indexes are reused until the optional tracked key set changes.The sampling rule follows current master:
prob_uniformgives each retained system the same long-run frame share, including unequal automatic batch sizes; it does not promise equal batch counts. Uniform passes remain bounded by the mean system frame count rather than expanding every system to the largest size.Constraints:
type_mapfor LMDB.mixed_typeacross every retained source, including separate groups. LMDB is mixed-type; NPY/HDF5 used alongside it must also providereal_atom_types.npy. Fixed composition can use this representation. The native PyTorch loader can combine fixed-type NPY/HDF5 and LMDB directly. Filtering precedes this check, and TensorFlow LMDB additionally needs a mixed-type-capable descriptor such asse_atten.labeled: true). A labeled read failure never falls back to dropping labels. Only explicitlabeled: falserequests structure-only conversion; it cannot supply supervised targets. Label modes have separate cache keys, and schema 4 invalidates caches from the old implicit fallback.sys_probsalso require another output such asdeepmd/hdf5.Validation:
November 17 follow-up (
a2ffd4831): 213 common/data/schema tests and 44 subtests, 101 PT/TF tests (including native TF inference), and all 5 real checkpoint/restart training comparisons pass. These include both grouped seed variants, real partially labeled ASE rejection and recovery, explicit structure-only conversion, invalid-cell grouping, and Linux-hosted simulation of the real dpdata Windows overwrite guard. The 57 conversion tests and 14 subtests also pass after the final platform-aware assertion changes. Ruff, formatting, whitespace checks, and commit hooks pass.After the module extraction: 224 data/conversion/LMDB/PT-exportable tests and 38 subtests passed; three fresh-process import orders and real dpdata-to-TensorFlow conversion/neighbor statistics also passed.
Latest availability-cache and bulk-key regressions plus the conversion/LMDB suites: 175 tests and 30 subtests passed.
Final targeted data/LMDB/PT/PT-exportable run: 269 tests and 28 subtests passed. Earlier broader validation also covered compiled training, task cleanup, and the TensorFlow core inference scenario.
Paddle fail-fast cases: 4 passed; JAX setup cleanup: 2 passed; TF2 entrypoint/cleanup: 4 passed.
Real dpdata conversion and TensorFlow neighbor statistics passed, including rewriting energy 0 to 42 while restoring the old source mtime.
A complete two-step TensorFlow training/validation run from EXTXYZ finished, reduced loss, and saved its checkpoint.
Ruff, formatting, whitespace checks, and commit hooks passed.
Closes #5237.