deepmodeling / deepmd-kit

A deep learning package for many-body potential energy representation and molecular dynamics
https://docs.deepmodeling.com/projects/deepmd/
GNU Lesser General Public License v3.0
1.41k stars 487 forks source link

UserWarning: Using torch.cross without specifying the dim arg is deprecated. #3791

Open njzjz opened 2 months ago

njzjz commented 2 months ago
source/tests/pt/model/test_region.py::TestLegacyRegion::test_inter_to_inter
  /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch/utils/_device.py:78: UserWarning: Using torch.cross without specifying the dim arg is deprecated.
  Please either pass the dim explicitly or simply use torch.linalg.cross.
  The default value of dim will change to agree with that of linalg.cross in a future release. (Triggered internally at ../aten/src/ATen/native/Cross.cpp:62.)
    return func(*args, **kwargs)
njzjz commented 1 month ago

Affected:

https://github.com/deepmodeling/deepmd-kit/blob/fd2daeb5934e2f3fd2f47183b3fedf87c287965c/deepmd/pt/utils/region.py#L73-L77

https://github.com/deepmodeling/deepmd-kit/blob/fd2daeb5934e2f3fd2f47183b3fedf87c287965c/deepmd/pt/utils/preprocess.py#L28-L32

wanghan-iapcm commented 1 month ago

all functions in preprocess except compute_smooth_weight can be removed.

njzjz commented 1 month ago

@wanghan-iapcm @iProzd could we find and remove all dead codes at once?

wanghan-iapcm commented 1 month ago

May not necessarily do it at once ? or is there tools for automatically removing the dead codes?

njzjz commented 1 month ago

May not necessarily do it at once ? or is there tools for automatically removing the dead codes?

Indeed we can find them using Codecov, assuming all used functions are tested.

njzjz commented 1 month ago

I see preprocess.py has a 93% coverage, though

wanghan-iapcm commented 4 weeks ago

good idea. I am wondering how much codes that are not dead are not covered by the UTs.

njzjz commented 2 weeks ago

I just found _to_face_distance in region.py is also not used at all, but left there for an unclear reason.

njzjz commented 2 weeks ago

Since both code blocks are not used, I unassigned myself and moved from mustfix to enhance. cc @wanghan-iapcm @iProzd