Skip to content

Commit

Permalink
update reprod water_se2_a code
Browse files Browse the repository at this point in the history
  • Loading branch information
HydrogenSulfate committed Nov 7, 2023
1 parent 6170356 commit fc78e6d
Show file tree
Hide file tree
Showing 41 changed files with 7,936 additions and 1,938 deletions.
114 changes: 48 additions & 66 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,67 +1,49 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
exclude: "^.+\\.pbtxt$"
- id: end-of-file-fixer
exclude: "^.+\\.pbtxt$"
- id: check-yaml
#- id: check-json
- id: check-added-large-files
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
# Python
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black-jupyter
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
files: \.py$
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: v0.0.269
hooks:
- id: ruff
args: ["--fix"]
# numpydoc
- repo: https://github.com/Carreau/velin
rev: 0.0.12
hooks:
- id: velin
args: ["--write"]
# Python inside docs
- repo: https://github.com/asottile/blacken-docs
rev: 1.13.0
hooks:
- id: blacken-docs
# C++
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.4
hooks:
- id: clang-format
exclude: ^source/3rdparty|source/lib/src/cuda/cudart/.+\.inc
# CSS
- repo: https://github.com/pre-commit/mirrors-csslint
rev: v1.0.5
hooks:
- id: csslint
# Shell
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.6.0-2
hooks:
- id: shfmt
# CMake
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
#- id: cmake-lint
ci:
autoupdate_branch: devel
- repo: https://github.com/PyCQA/isort
rev: 5.11.5
hooks:
- id: isort
args: ["--multi-line=7", "--sl"]

- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black

# - repo: https://github.com/charliermarsh/ruff-pre-commit
# rev: 'v0.0.272'
# hooks:
# - id: ruff

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: a11d9314b22d8f8c7556443875b731ef05965464
hooks:
- id: check-merge-conflict
- id: check-symlinks
- id: detect-private-key
files: (?!.*paddle)^.*$
- id: end-of-file-fixer
files: \.md$
- id: trailing-whitespace
files: \.md$

- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.0.1
hooks:
- id: forbid-crlf
files: \.md$
- id: remove-crlf
files: \.md$
- id: forbid-tabs
files: \.md$
- id: remove-tabs
files: \.md$

# - repo: local
# hooks:
# - id: clang-format
# name: clang-format
# description: Format files with ClangFormat
# entry: bash .clang_format.hook -i
# language: system
# files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|cuh|proto)$
68 changes: 29 additions & 39 deletions deepmd/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,29 @@

import json
import warnings
from functools import (
wraps,
)
from pathlib import (
Path,
)
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
List,
Optional,
TypeVar,
Union,
)
from functools import wraps
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import Callable
from typing import Dict
from typing import List
from typing import Optional
from typing import TypeVar
from typing import Union

import numpy as np
import tensorflow
import yaml
from tensorflow.python.framework import (
tensor_util,
)

from deepmd.env import (
GLOBAL_NP_FLOAT_PRECISION,
GLOBAL_TF_FLOAT_PRECISION,
op_module,
tf,
)
from deepmd.utils.path import (
DPPath,
)
from tensorflow.python.framework import tensor_util

from deepmd.env import GLOBAL_NP_FLOAT_PRECISION
from deepmd.env import GLOBAL_PD_FLOAT_PRECISION
from deepmd.env import GLOBAL_TF_FLOAT_PRECISION
from deepmd.env import op_module
from deepmd.env import paddle
from deepmd.env import tf
from deepmd.utils.path import DPPath

if TYPE_CHECKING:
_DICT_VAL = TypeVar("_DICT_VAL")
Expand All @@ -50,11 +40,11 @@

# define constants
PRECISION_DICT = {
"default": GLOBAL_TF_FLOAT_PRECISION,
"float16": tf.float16,
"float32": tf.float32,
"float64": tf.float64,
"bfloat16": tf.bfloat16,
"default": GLOBAL_PD_FLOAT_PRECISION,
"float16": paddle.float16,
"float32": paddle.float32,
"float64": paddle.float64,
"bfloat16": paddle.bfloat16,
}


Expand Down Expand Up @@ -119,11 +109,11 @@ def gelu_wrapper(x):
data_requirement = {}

ACTIVATION_FN_DICT = {
"relu": tf.nn.relu,
"relu6": tf.nn.relu6,
"softplus": tf.nn.softplus,
"sigmoid": tf.sigmoid,
"tanh": tf.nn.tanh,
"relu": paddle.nn.functional.relu,
"relu6": paddle.nn.functional.relu6,
"softplus": paddle.nn.functional.softplus,
"sigmoid": paddle.nn.functional.sigmoid,
"tanh": paddle.nn.functional.tanh,
"gelu": gelu,
"gelu_tf": gelu_tf,
"None": None,
Expand Down
Loading

0 comments on commit fc78e6d

Please sign in to comment.