Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Fix gelu (#1287)
Browse files Browse the repository at this point in the history
* fix leaky_relu

* update mxnet as 0b20200802
  • Loading branch information
zheyuye authored Aug 5, 2020
1 parent 7e1f9d0 commit 20af58f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ First of all, install the latest MXNet. You may use the following commands:

```bash
# Install the version with CUDA 10.0
pip install -U --pre "mxnet-cu100>=2.0.0b20200716" -f https://dist.mxnet.io/python
pip install -U --pre "mxnet-cu100>=2.0.0b20200802" -f https://dist.mxnet.io/python

# Install the version with CUDA 10.1
pip install -U --pre "mxnet-cu101>=2.0.0b20200716" -f https://dist.mxnet.io/python
pip install -U --pre "mxnet-cu101>=2.0.0b20200802" -f https://dist.mxnet.io/python

# Install the version with CUDA 10.2
pip install -U --pre "mxnet-cu102>=2.0.0b20200716" -f https://dist.mxnet.io/python
pip install -U --pre "mxnet-cu102>=2.0.0b20200802" -f https://dist.mxnet.io/python

# Install the cpu-only version
pip install -U --pre "mxnet>=2.0.0b20200716" -f https://dist.mxnet.io/python
pip install -U --pre "mxnet>=2.0.0b20200802" -f https://dist.mxnet.io/python
```


Expand All @@ -42,7 +42,7 @@ pip install -U -e .
pip install -U -e .[extras]

# In case you are using zsh, try to use the following command for installing
pip install -U -e ."[extras]"
pip install -U -e ."[extras]"
```

If you find that you do not have the permission, you can also install to the user folder:
Expand All @@ -51,12 +51,12 @@ If you find that you do not have the permission, you can also install to the use
pip install -U -e . --user
```

For Windows users, we recommend to use the [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/about).
For Windows users, we recommend to use the [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/about).


# Access the Command-line Toolkits

To facilitate the researcher and the engineers, we provide command-line-toolkits for
To facilitate the researcher and the engineers, we provide command-line-toolkits for
downloading and preprocessing the NLP datasets. For more details, you may refer to
[GluonNLP Datasets](./scripts/datasets) and [GluonNLP Preprocessing Tools](./scripts/preprocess).

Expand Down
3 changes: 1 addition & 2 deletions src/gluonnlp/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,7 @@ def __init__(self, mode='erf'):

def hybrid_forward(self, F, x):
if self._mode == 'erf':
# TODO Investigate the precision of F.npx.leaky_relu(x, act_type='gelu')
return x * 0.5 * (1.0 + F.npx.erf(x / math.sqrt(2.0)))
return F.npx.leaky_relu(x, act_type='gelu')
elif self._mode == 'tanh':
return 0.5 * x\
* (1.0 + F.np.tanh(math.sqrt(2.0 / math.pi) * (x + 0.044715 * (x ** 3))))
Expand Down

0 comments on commit 20af58f

Please sign in to comment.