From e1280c4b4ea65ce16cf89a0415b24fda6e687fe1 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Mon, 11 Sep 2023 00:24:31 -0400 Subject: [PATCH] fix np.loadtxt warning ``` DeprecationWarning: loadtxt(): Parsing an integer via a float is deprecated. To avoid this warning, you can: * make sure the original data is stored as integers. * use the `converters=` keyword argument. If you only use NumPy 1.23 or later, `converters=float` will normally work. * Use `np.loadtxt(...).astype(np.int64)` parsing the file as floating point and then convert it. (On all NumPy versions.) (Deprecated NumPy 1.23) return np.loadtxt(str(self.path), **kwargs) ``` Signed-off-by: Jinzhe Zeng --- deepmd/utils/data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepmd/utils/data.py b/deepmd/utils/data.py index 485079b08d..57bea00fac 100644 --- a/deepmd/utils/data.py +++ b/deepmd/utils/data.py @@ -580,7 +580,7 @@ def _load_data( return np.float32(0.0), data def _load_type(self, sys_path: DPPath): - atom_type = (sys_path / "type.raw").load_txt(dtype=np.int32, ndmin=1) + atom_type = (sys_path / "type.raw").load_txt(ndmin=1).astype(np.int32) return atom_type def _load_type_mix(self, set_name: DPPath):