gpt-2 icon indicating copy to clipboard operation
gpt-2 copied to clipboard

src/model.py gelu uses numpy functions

Open EsbernTK opened this issue 5 years ago • 1 comments

The gelu function in the src/model.py script uses numpy.sqrt and numpy.pi, how does this affect GPU performance, and does it even work with GPU? If not, it should be changed to similar functions in tf.

EsbernTK avatar Jan 28 '20 12:01 EsbernTK

You mean this part: np.sqrt(2/np.pi)? I think it can be replaced with a constant value calculated once (0.7978845608028654). Just decide what precision is going to be enough.

mikolasan avatar Aug 18 '20 06:08 mikolasan