Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix gelu grad multi definitions error #1406

Merged
merged 3 commits into from
Jan 13, 2022

Conversation

denghuilu
Copy link
Member

#1380 should be fixed by this PR.

deepmd/common.py Outdated Show resolved Hide resolved
@njzjz njzjz linked an issue Jan 10, 2022 that may be closed by this pull request
deepmd/common.py Outdated
Comment on lines 70 to 71
except AttributeError:
gelu = op_module.gelu
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tf.nn.gelu v.s. op_module.gelu, which is faster?

If the latter is faster can we use it by default?

Copy link
Member Author

@denghuilu denghuilu Jan 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The later is indeed faster, but sometimes an error will be reported during a long MD process, we need to be more careful.

Copy link
Member Author

@denghuilu denghuilu Jan 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could follow the implementations of tensorflow(without approximate) and do some more tests to figure out the reasons of this particular error.

@njzjz
Copy link
Member

njzjz commented Jan 12, 2022

Isn't it a breaking change from approximate to non-approximate? Also, the behavior will differ among different TensorFlow versions.

Co-authored-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
@codecov-commenter
Copy link

codecov-commenter commented Jan 12, 2022

Codecov Report

Merging #1406 (86c1021) into devel (0d30288) will increase coverage by 1.28%.
The diff coverage is 76.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##            devel    #1406      +/-   ##
==========================================
+ Coverage   74.42%   75.71%   +1.28%     
==========================================
  Files          92       92              
  Lines        7507     7638     +131     
==========================================
+ Hits         5587     5783     +196     
+ Misses       1920     1855      -65     
Impacted Files Coverage Δ
source/op/_gelu.py 69.23% <60.00%> (-2.20%) ⬇️
deepmd/common.py 82.27% <100.00%> (+0.69%) ⬆️
deepmd/utils/tabulate.py 80.00% <0.00%> (-4.35%) ⬇️
deepmd/descriptor/se_a.py 94.15% <0.00%> (ø)
source/op/_tabulate_grad.py 100.00% <0.00%> (ø)
source/op/_prod_force_grad.py 100.00% <0.00%> (ø)
source/op/_prod_virial_grad.py 100.00% <0.00%> (ø)
source/op/_soft_min_force_grad.py 100.00% <0.00%> (ø)
source/op/_prod_force_se_a_grad.py 100.00% <0.00%> (ø)
source/op/_prod_force_se_r_grad.py 100.00% <0.00%> (ø)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0d30288...86c1021. Read the comment docs.

@denghuilu
Copy link
Member Author

denghuilu commented Jan 12, 2022

Isn't it a breaking change from approximate to non-approximate? Also, the behavior will differ among different TensorFlow versions.

Agree, We use the approximate version of gelu, then we check the gelu errors later in another issue. Let's fix the multi definitions of gelu grad first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KeyError: "Registering two gradient with name 'Gelu'!
4 participants