Skip to content

Commit

Permalink
Devel update (#30)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
4 people authored Jan 30, 2024
1 parent 3dd415b commit cb4cc67
Show file tree
Hide file tree
Showing 24 changed files with 1,197 additions and 143 deletions.
6 changes: 6 additions & 0 deletions backend/find_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ def get_tf_requirement(tf_version: str = "") -> dict:
dict
TensorFlow requirement, including cpu and gpu.
"""
if tf_version is None:
return {
"cpu": [],
"gpu": [],
"mpi": [],
}
if tf_version == "":
tf_version = os.environ.get("TENSORFLOW_VERSION", "")

Expand Down
24 changes: 17 additions & 7 deletions backend/read_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,26 @@ def get_argument_from_env() -> Tuple[str, list, list, dict, str]:
cmake_args.append("-DENABLE_IPI:BOOL=TRUE")
extra_scripts["dp_ipi"] = "deepmd.tf.entrypoints.ipi:dp_ipi"

tf_install_dir, _ = find_tensorflow()
tf_version = get_tf_version(tf_install_dir)
if tf_version == "" or Version(tf_version) >= Version("2.12"):
find_libpython_requires = []
if os.environ.get("DP_ENABLE_TENSORFLOW", "1") == "1":
tf_install_dir, _ = find_tensorflow()
tf_version = get_tf_version(tf_install_dir)
if tf_version == "" or Version(tf_version) >= Version("2.12"):
find_libpython_requires = []
else:
find_libpython_requires = ["find_libpython"]
cmake_args.extend(
[
"-DENABLE_TENSORFLOW=ON",
f"-DTENSORFLOW_VERSION={tf_version}",
f"-DTENSORFLOW_ROOT:PATH={tf_install_dir}",
]
)
else:
find_libpython_requires = ["find_libpython"]
cmake_args.append(f"-DTENSORFLOW_VERSION={tf_version}")
find_libpython_requires = []
cmake_args.append("-DENABLE_TENSORFLOW=OFF")
tf_version = None

cmake_args = [
f"-DTENSORFLOW_ROOT:PATH={tf_install_dir}",
"-DBUILD_PY_IF:BOOL=TRUE",
*cmake_args,
]
Expand Down
4 changes: 4 additions & 0 deletions deepmd/model_format/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
from .env_mat import (
EnvMat,
)
from .fitting import (
InvarFitting,
)
from .network import (
EmbeddingNet,
FittingNet,
Expand Down Expand Up @@ -34,6 +37,7 @@
)

__all__ = [
"InvarFitting",
"DescrptSeA",
"EnvMat",
"make_multilayer_network",
Expand Down
Loading

0 comments on commit cb4cc67

Please sign in to comment.