Closed Chengqian-Zhang closed 1 week ago
deepmd/pt/entrypoints/main.py
117-117: Local variable `f` is assigned to but never used (F841) Remove assignment to unused variable `f` --- 374-377: Use ternary operator `FLAGS = parse_args(args=args) if not isinstance(args, argparse.Namespace) else args` instead of `if`-`else`-block (SIM108) Replace `if`-`else`-block with `FLAGS = parse_args(args=args) if not isinstance(args, argparse.Namespace) else args`
deepmd/pt/entrypoints/main.py (1)
`212-212`: **Good fix to prevent TypeError in dictionary merging.** Changing `op_info` from `None` to `{}` when `ENABLE_CUSTOMIZED_OP` is `False` is a necessary fix to prevent runtime errors during dictionary merging. This change ensures that `op_info` can always be safely merged with other dictionaries.
Attention: Patch coverage is 0%
with 1 line
in your changes missing coverage. Please review.
Project coverage is 82.72%. Comparing base (
2f18f04
) to head (1e5caa2
).
Files | Patch % | Lines |
---|---|---|
deepmd/pt/entrypoints/main.py | 0.00% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Solve issue #3911
When I run
sys.exit(main())
File "/home/data/zcq/deepmd-source/deepmd-kit/deepmd/main.py", line 842, in main
deepmd_main(args)
File "/home/data/zhangcq/conda_env/deepmd-pt-1026/lib/python3.10/site-packages/torch/distributed/elastic/multiprocessing/errors/init.py", line 346, in wrapper
return f(*args, **kwargs)
File "/home/data/zcq/deepmd-source/deepmd-kit/deepmd/pt/entrypoints/main.py", line 384, in main
train(FLAGS)
File "/home/data/zcq/deepmd-source/deepmd-kit/deepmd/pt/entrypoints/main.py", line 223, in train
SummaryPrinter()()
File "/home/data/zcq/deepmd-source/deepmd-kit/deepmd/utils/summary.py", line 62, in call
build_info.update(self.get_backend_info())
File "/home/data/zcq/deepmd-source/deepmd-kit/deepmd/pt/entrypoints/main.py", line 213, in get_backend_info
return {
TypeError: 'NoneType' object is not a mapping
examples/water/dpa2
usingdp --pt train input_torch.json
. An error occurs: To get the best performance, it is recommended to adjust the number of threads by setting the environment variables OMP_NUM_THREADS, DP_INTRA_OP_PARALLELISM_THREADS, and DP_INTER_OP_PARALLELISM_THREADS. See https://deepmd.rtfd.io/parallelism/ for more information. [2024-06-26 07:53:43,325] DEEPMD INFO DeepMD version: 2.2.0b1.dev892+g73dab63f.d20240612 [2024-06-26 07:53:43,325] DEEPMD INFO Configuration path: input_torch.json Traceback (most recent call last): File "/home/data/zhangcq/conda_env/deepmd-pt-1026/bin/dp", line 8, inThis bug is made by PR #3895 When
op_info
isNone
,{**op_info}
will raise error. Changingop_info = None
toop_info = {}
will solve the issue.Summary by CodeRabbit
op_info
as an empty dictionary instead ofNone
, preventing potential runtime errors.