Skip to content

Commit cb4cc67

Browse files
iProzdnjzjzwanghan-iapcmHan Wang
authored
Devel update (#30)
* throw errors when PyTorch CXX11 ABI is different from TensorFlow (deepmodeling#3201) If so, throw the following error: ``` -- PyTorch CXX11 ABI: 0 CMake Error at CMakeLists.txt:162 (message): PyTorch CXX11 ABI mismatch TensorFlow: 0 != 1 ``` Signed-off-by: Jinzhe Zeng <[email protected]> * allow disabling TensorFlow backend during Python installation (deepmodeling#3200) Fix deepmodeling#3120. One can disable building the TensorFlow backend during `pip install` by setting `DP_ENABLE_TENSORFLOW=0`. --------- Signed-off-by: Jinzhe Zeng <[email protected]> * breaking: pt: add dp model format and refactor pt impl for the fitting net. (deepmodeling#3199) - add dp model format (backend independent definition) for the fitting - refactor torch support, compatible with dp model format - fix mlp issue: the idt should only be used when a skip connection is available. - add tools `to_numpy_array` and `to_torch_tensor`. --------- Co-authored-by: Han Wang <[email protected]> * remove duplicated fitting output check. fix codeql (deepmodeling#3202) Co-authored-by: Han Wang <[email protected]> --------- Signed-off-by: Jinzhe Zeng <[email protected]> Co-authored-by: Jinzhe Zeng <[email protected]> Co-authored-by: Han Wang <[email protected]> Co-authored-by: Han Wang <[email protected]>
1 parent 3dd415b commit cb4cc67

24 files changed

+1197
-143
lines changed

backend/find_tensorflow.py

+6
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ def get_tf_requirement(tf_version: str = "") -> dict:
127127
dict
128128
TensorFlow requirement, including cpu and gpu.
129129
"""
130+
if tf_version is None:
131+
return {
132+
"cpu": [],
133+
"gpu": [],
134+
"mpi": [],
135+
}
130136
if tf_version == "":
131137
tf_version = os.environ.get("TENSORFLOW_VERSION", "")
132138

backend/read_env.py

+17-7
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,26 @@ def get_argument_from_env() -> Tuple[str, list, list, dict, str]:
8080
cmake_args.append("-DENABLE_IPI:BOOL=TRUE")
8181
extra_scripts["dp_ipi"] = "deepmd.tf.entrypoints.ipi:dp_ipi"
8282

83-
tf_install_dir, _ = find_tensorflow()
84-
tf_version = get_tf_version(tf_install_dir)
85-
if tf_version == "" or Version(tf_version) >= Version("2.12"):
86-
find_libpython_requires = []
83+
if os.environ.get("DP_ENABLE_TENSORFLOW", "1") == "1":
84+
tf_install_dir, _ = find_tensorflow()
85+
tf_version = get_tf_version(tf_install_dir)
86+
if tf_version == "" or Version(tf_version) >= Version("2.12"):
87+
find_libpython_requires = []
88+
else:
89+
find_libpython_requires = ["find_libpython"]
90+
cmake_args.extend(
91+
[
92+
"-DENABLE_TENSORFLOW=ON",
93+
f"-DTENSORFLOW_VERSION={tf_version}",
94+
f"-DTENSORFLOW_ROOT:PATH={tf_install_dir}",
95+
]
96+
)
8797
else:
88-
find_libpython_requires = ["find_libpython"]
89-
cmake_args.append(f"-DTENSORFLOW_VERSION={tf_version}")
98+
find_libpython_requires = []
99+
cmake_args.append("-DENABLE_TENSORFLOW=OFF")
100+
tf_version = None
90101

91102
cmake_args = [
92-
f"-DTENSORFLOW_ROOT:PATH={tf_install_dir}",
93103
"-DBUILD_PY_IF:BOOL=TRUE",
94104
*cmake_args,
95105
]

deepmd/model_format/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
from .env_mat import (
88
EnvMat,
99
)
10+
from .fitting import (
11+
InvarFitting,
12+
)
1013
from .network import (
1114
EmbeddingNet,
1215
FittingNet,
@@ -34,6 +37,7 @@
3437
)
3538

3639
__all__ = [
40+
"InvarFitting",
3741
"DescrptSeA",
3842
"EnvMat",
3943
"make_multilayer_network",

0 commit comments

Comments
 (0)