From d40ce1bbdc5d74aeb05bc4c19277acdfb99fdbe3 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Fri, 20 Aug 2021 03:34:38 -0400 Subject: [PATCH 1/4] unpin tensorflow version As tensorflow API v1 has been stable, it's safe not to pin the tensorflow version. --- .github/workflows/test_python.yml | 8 ++++---- doc/install/install-from-source.md | 6 +++--- setup.py | 9 +++++++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test_python.yml b/.github/workflows/test_python.yml index dadd749b36..c59f7a8da3 100644 --- a/.github/workflows/test_python.yml +++ b/.github/workflows/test_python.yml @@ -38,16 +38,16 @@ jobs: tf: 1.14 - python: 3.7 gcc: 5 - tf: 2.3 + tf: - python: 3.7 gcc: 8 - tf: 2.3 + tf: - python: 3.8 gcc: 5 - tf: 2.3 + tf: - python: 3.8 gcc: 8 - tf: 2.3 + tf: steps: - uses: actions/checkout@master diff --git a/doc/install/install-from-source.md b/doc/install/install-from-source.md index 9a20a565e3..b0e6f468b1 100644 --- a/doc/install/install-from-source.md +++ b/doc/install/install-from-source.md @@ -27,7 +27,7 @@ We follow the virtual environment approach to install the tensorflow's Python in virtualenv -p python3 $tensorflow_venv source $tensorflow_venv/bin/activate pip install --upgrade pip -pip install --upgrade tensorflow==2.3.0 +pip install --upgrade tensorflow ``` It is notice that everytime a new shell is started and one wants to use `DeePMD-kit`, the virtual environment should be activated by ```bash @@ -43,7 +43,7 @@ virtualenv -p python3.7 $tensorflow_venv ``` If one does not need the GPU support of deepmd-kit and is concerned about package size, the CPU-only version of tensorflow should be installed by ```bash -pip install --upgrade tensorflow-cpu==2.3.0 +pip install --upgrade tensorflow-cpu ``` To verify the installation, run ```bash @@ -149,4 +149,4 @@ dp_ipi dp_ipi_low $ ls $deepmd_root/lib libdeepmd_cc_low.so libdeepmd_ipi_low.so libdeepmd_lmp_low.so libdeepmd_low.so libdeepmd_op_cuda.so libdeepmd_op.so libdeepmd_cc.so libdeepmd_ipi.so libdeepmd_lmp.so libdeepmd_op_cuda_low.so libdeepmd_op_low.so libdeepmd.so -``` \ No newline at end of file +``` diff --git a/setup.py b/setup.py index e48f9a3f3d..cfa78d4a7a 100644 --- a/setup.py +++ b/setup.py @@ -21,9 +21,14 @@ readme_file = Path(__file__).parent / "README.md" readme = readme_file.read_text() -tf_version = os.environ.get("TENSORFLOW_VERSION", "2.3") +tf_version = os.environ.get("TENSORFLOW_VERSION", "") -if tf_version in SpecifierSet("<1.15") or tf_version in SpecifierSet(">=2.0,<2.1"): +if tf_version == "": + extras_require = { + "cpu": ["tensorflow"], + "gpu": ["tensorflow-gpu"], + } +elif tf_version in SpecifierSet("<1.15") or tf_version in SpecifierSet(">=2.0,<2.1"): extras_require = { "cpu": [f"tensorflow=={tf_version}"], "gpu": [f"tensorflow-gpu=={tf_version}"], From 5b3c9809f1dd047d2d820f488bf2e20593c6e706 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Fri, 20 Aug 2021 03:41:58 -0400 Subject: [PATCH 2/4] set `tf` to 2 --- .github/workflows/test_python.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_python.yml b/.github/workflows/test_python.yml index c59f7a8da3..abc2bd8300 100644 --- a/.github/workflows/test_python.yml +++ b/.github/workflows/test_python.yml @@ -38,16 +38,16 @@ jobs: tf: 1.14 - python: 3.7 gcc: 5 - tf: + tf: 2 - python: 3.7 gcc: 8 - tf: + tf: 2 - python: 3.8 gcc: 5 - tf: + tf: 2 - python: 3.8 gcc: 8 - tf: + tf: 2 steps: - uses: actions/checkout@master From 3b5eace018ce71f7be58bd5dc943ce39499c7a38 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Fri, 20 Aug 2021 04:05:02 -0400 Subject: [PATCH 3/4] use 2.* instead --- .github/workflows/test_python.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_python.yml b/.github/workflows/test_python.yml index abc2bd8300..14cdd4cea0 100644 --- a/.github/workflows/test_python.yml +++ b/.github/workflows/test_python.yml @@ -38,16 +38,16 @@ jobs: tf: 1.14 - python: 3.7 gcc: 5 - tf: 2 + tf: 2.* - python: 3.7 gcc: 8 - tf: 2 + tf: 2.* - python: 3.8 gcc: 5 - tf: 2 + tf: 2.* - python: 3.8 gcc: 8 - tf: 2 + tf: 2.* steps: - uses: actions/checkout@master From 8f9d84f29ff9497c9b11ab5469e6bbcab9e30186 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Fri, 20 Aug 2021 04:23:00 -0400 Subject: [PATCH 4/4] correct `setup.py` --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index cfa78d4a7a..618ad59de8 100644 --- a/setup.py +++ b/setup.py @@ -25,8 +25,8 @@ if tf_version == "": extras_require = { - "cpu": ["tensorflow"], - "gpu": ["tensorflow-gpu"], + "cpu": ["tensorflow-cpu"], + "gpu": ["tensorflow"], } elif tf_version in SpecifierSet("<1.15") or tf_version in SpecifierSet(">=2.0,<2.1"): extras_require = {