mirror of
https://github.com/google-deepmind/deepmind-research.git
synced 2026-05-23 15:55:20 +08:00
Update DM21 pinned requirements and bazel config for compiling functional to C++.
PiperOrigin-RevId: 505176617
This commit is contained in:
committed by
Diego de las Casas
parent
c7e2ef28be
commit
cb555c241b
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
5.3.0
|
||||
@@ -113,15 +113,14 @@ be found in the paper (reference below). Note that the results in our paper also
|
||||
include D3 corrections, which must be
|
||||
[included separately](https://pyscf.org/user/dft.html#dispersion-corrections).
|
||||
|
||||
|
||||
### Best practices for using the neural functionals.
|
||||
|
||||
In this section, we suggest some tips for using the neural functionals in a way
|
||||
similar to how they were used for benchmarking in the paper. The tensorflow
|
||||
network that we used is running at single precision, and as such it is very
|
||||
hard to converge calculations to the high convergence thresholds which are
|
||||
default in pyscf. For example, the following script should allow users to
|
||||
run an atomization energy calculation for methane.
|
||||
network that we used is running at single precision, and as such it is very hard
|
||||
to converge calculations to the high convergence thresholds which are default in
|
||||
pyscf. For example, the following script should allow users to run an
|
||||
atomization energy calculation for methane.
|
||||
|
||||
```python
|
||||
import density_functional_approximation_dm21 as dm21
|
||||
@@ -178,17 +177,16 @@ print({'CH4': energies[0], 'C': energies[1], 'H': energies[2]})
|
||||
```
|
||||
|
||||
This script should produce three energies (in Hartrees) for the water molecule
|
||||
and the two atoms of
|
||||
`{'CH4': -40.51785372584538, 'C': -37.84542045526023, 'H': -0.5011533955627797}`
|
||||
, this leads to an atomization energy of 419.06 kcal/mol, which is then
|
||||
corrected with the D3(BJ) correction for methane (1.20 kcal/mol) to yield a
|
||||
predicted atomization energy of 420.26 kcal/mol. Comparing this to the
|
||||
literature value of 420.42, leads us to deduce an error of around 0.2 kcal/mol.
|
||||
|
||||
It should also be noted that if a closed shell system is run unrestricted it
|
||||
can give a small difference between spin densities and eigenvalues with a
|
||||
negligible effect on the energy.
|
||||
and the two atoms of `{'CH4': -40.51785372584538, 'C': -37.84542045526023, 'H':
|
||||
-0.5011533955627797}` , this leads to an atomization energy of 419.06 kcal/mol,
|
||||
which is then corrected with the D3(BJ) correction for methane (1.20 kcal/mol)
|
||||
to yield a predicted atomization energy of 420.26 kcal/mol. Comparing this to
|
||||
the literature value of 420.42, leads us to deduce an error of around 0.2
|
||||
kcal/mol.
|
||||
|
||||
It should also be noted that if a closed shell system is run unrestricted it can
|
||||
give a small difference between spin densities and eigenvalues with a negligible
|
||||
effect on the energy.
|
||||
|
||||
## Using DM21 from C++
|
||||
|
||||
@@ -210,10 +208,10 @@ library is provided in `cc/dm21_aot_compiled_example.cc`. This requires a
|
||||
link-time dependency on parts of the `xla_compiled_cpu_runtime_standalone`
|
||||
library, which are not included in the compiled functional library. The easiest
|
||||
way to build this is to use [Bazel](https://bazel.build). The first step is to
|
||||
[install Bazel](https://docs.bazel.build/versions/4.2.0/install.html).
|
||||
[install Bazel](https://docs.bazel.build/versions/5.3.0/install.html).
|
||||
[Bazelisk](https://docs.bazel.build/versions/main/install-bazelisk.html) is
|
||||
another way to install Bazel if a native installer is not available. The
|
||||
following has been tested with Bazel 4.2.0. It is best to continue working
|
||||
following has been tested with Bazel 5.3.0. It is best to continue working
|
||||
inside a virtual environment.
|
||||
|
||||
Assuming the above installation steps using `git clone` have been followed, and
|
||||
@@ -221,7 +219,7 @@ Assuming the above installation steps using `git clone` have been followed, and
|
||||
|
||||
```
|
||||
pip install -r requirements_aot_compilation.txt
|
||||
bazel run --experimental_repo_remote_exec :run_dm21_aot_compiled_example
|
||||
bazel run --experimental_cc_shared_library --experimental_repo_remote_exec :run_dm21_aot_compiled_example
|
||||
```
|
||||
|
||||
where the `pip install` command is only required if a fresh virtual environment
|
||||
|
||||
@@ -20,25 +20,16 @@ pip_install(
|
||||
|
||||
http_archive(
|
||||
name = "io_abseil_py",
|
||||
strip_prefix = "abseil-py-pypi-v0.15.0",
|
||||
urls = ["https://github.com/abseil/abseil-py/archive/pypi-v0.15.0.tar.gz"],
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "six_archive",
|
||||
build_file = "@io_abseil_py//third_party:six.BUILD",
|
||||
strip_prefix = "six-1.12.0",
|
||||
urls = [
|
||||
"https://pypi.python.org/packages/source/s/six/six-1.12.0.tar.gz",
|
||||
],
|
||||
strip_prefix = "abseil-py-1.4.0",
|
||||
urls = ["https://github.com/abseil/abseil-py/archive/refs/tags/v1.4.0.tar.gz"],
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "org_tensorflow",
|
||||
patch_args = ["-p1"],
|
||||
patches = ["tf_bazel.patch"],
|
||||
strip_prefix = "tensorflow-2.10.0",
|
||||
urls = ["https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.10.0.tar.gz"],
|
||||
strip_prefix = "tensorflow-2.11.0",
|
||||
urls = ["https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.11.0.tar.gz"],
|
||||
)
|
||||
|
||||
# The cascade of load() statements and tf_workspace?() calls works around the
|
||||
|
||||
@@ -6,23 +6,36 @@ Subject: [PATCH] Set dependencies for saved_model_compile_aot rule,
|
||||
tensorflow, and absl version.
|
||||
|
||||
---
|
||||
tensorflow/compiler/tf2xla/BUILD | 2 +-
|
||||
tensorflow/python/tools/tools.bzl | 4 ++--
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
tensorflow/compiler/tf2xla/BUILD | 2 +-
|
||||
tensorflow/compiler/xla/mlir/ir/runtime/BUILD | 1 +
|
||||
tensorflow/python/tools/tools.bzl | 4 ++--
|
||||
3 files changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/tensorflow/compiler/tf2xla/BUILD b/tensorflow/compiler/tf2xla/BUILD
|
||||
index cfe63b16675..cd273aaf29e 100644
|
||||
--- a/tensorflow/compiler/tf2xla/BUILD
|
||||
+++ b/tensorflow/compiler/tf2xla/BUILD
|
||||
@@ -235,7 +235,7 @@ cc_library(
|
||||
copts = runtime_copts() + tf_openmp_copts(),
|
||||
features = ["fully_static_link"],
|
||||
"-parse_headers",
|
||||
],
|
||||
linkstatic = 1,
|
||||
- visibility = [":friends"],
|
||||
+ visibility = ["//visibility:public"],
|
||||
# Note, we specifically removed MKL and multithreaded dependencies so the
|
||||
# standalone does not require the MKL binary blob or threading libraries.
|
||||
#
|
||||
diff --git a/tensorflow/compiler/xla/mlir/ir/runtime/BUILD b/tensorflow/compiler/xla/mlir/ir/runtime/BUILD
|
||||
index 8c693fa5d49..bf95a3de622 100644
|
||||
--- a/tensorflow/compiler/xla/mlir/ir/runtime/BUILD
|
||||
+++ b/tensorflow/compiler/xla/mlir/ir/runtime/BUILD
|
||||
@@ -90,6 +90,7 @@ cc_library(
|
||||
"rt_ops.h",
|
||||
],
|
||||
compatible_with = get_compatible_with_cloud(),
|
||||
+ visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":rt_inc_gen",
|
||||
"//tensorflow/compiler/xla/runtime:constraints",
|
||||
diff --git a/tensorflow/python/tools/tools.bzl b/tensorflow/python/tools/tools.bzl
|
||||
index db886746006..bc597e29de9 100644
|
||||
--- a/tensorflow/python/tools/tools.bzl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
absl-py==0.13.0
|
||||
attrs==21.2.0
|
||||
h5py==3.7.0
|
||||
numpy==1.23.4
|
||||
absl-py==1.4.0
|
||||
attrs==22.2.0
|
||||
h5py==3.8.0
|
||||
numpy==1.24.1
|
||||
pyscf==2.1.1
|
||||
pytest==6.2.4
|
||||
scipy==1.9.3
|
||||
tensorflow==2.10.0
|
||||
tensorflow==2.11.0
|
||||
tensorflow-hub==0.12.0
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Keras-Preprocessing==1.1.2
|
||||
numpy==1.23.4
|
||||
tensorflow-estimator==2.10.0
|
||||
numpy==1.24.1
|
||||
tensorflow-estimator==2.11.0
|
||||
|
||||
Reference in New Issue
Block a user