Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PyTorch/LanguageModeling/Transformer-XL/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
64 changes: 32 additions & 32 deletions PyTorch/LanguageModeling/Transformer-XL/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ have the following components:
* [PyTorch 20.06-py3 NGC container](https://ngc.nvidia.com/registry/nvidia-pytorch)
* GPU architecture:
* [NVIDIA Volta](https://www.nvidia.com/en-us/data-center/volta-gpu-architecture/)
* [NVIDIA Turing](https://www.nvidia.com/pl-pl/geforce/turing/)
* [NVIDIA Turing](https://www.nvidia.com/en-us/geforce/turing/)
* [NVIDIA Ampere architecture](https://www.nvidia.com/en-us/data-center/nvidia-ampere-gpu-architecture/)

For more information about how to get started with NGC containers, see the
Expand Down Expand Up @@ -1387,44 +1387,44 @@ table summarizes the final perplexity on the test set.
The Transformer-XL large model was trained for 25,000 training steps, starting
from 10 different initial random seeds. After every 1,000 training steps, the
model was evaluated on the validation dataset and validation perplexity was
recorded. The training was performed in the pytorch-19.11-py3 NGC container on
recorded. The training was performed in the pytorch-20.06-py3 NGC container on
8x NVIDIA DGX-2H with 16x V100 32GB GPUs. The following table summarizes the
perplexity of our validation dataset.

|**Training step**|**Average perplexity**|**Standard deviation**|**Minimum**|**Maximum**|**Median**|
|----------------:|---------------------:|---------------------:|----------:|----------:|---------:|
| 1000 | 605.76 | 3.60068 | 598.00 | 610.41 | 606.04 |
| 2000 | 142.91 | 1.12225 | 141.79 | 145.56 | 142.47 |
| 3000 | 62.35 | 0.44710 | 61.75 | 63.25 | 62.37 |
| 4000 | 40.35 | 0.27075 | 40.06 | 41.00 | 40.24 |
| 5000 | 32.06 | 0.13979 | 31.85 | 32.25 | 32.12 |
| 6000 | 28.11 | 0.12096 | 27.88 | 28.29 | 28.13 |
| 7000 | 25.63 | 0.15906 | 25.44 | 25.89 | 25.59 |
| 8000 | 24.20 | 0.07317 | 24.07 | 24.30 | 24.21 |
| 9000 | 23.13 | 0.15848 | 22.90 | 23.46 | 23.09 |
| 10000 | 22.96 | 0.16448 | 22.68 | 23.29 | 22.98 |
| 11000 | 21.88 | 0.13801 | 21.74 | 22.20 | 21.90 |
| 12000 | 21.67 | 0.13077 | 21.44 | 21.89 | 21.64 |
| 13000 | 21.52 | 0.09049 | 21.43 | 21.72 | 21.50 |
| 14000 | 21.26 | 0.09471 | 21.13 | 21.41 | 21.24 |
| 15000 | 21.19 | 0.12189 | 21.07 | 21.47 | 21.15 |
| 16000 | 21.15 | 0.11736 | 20.90 | 21.32 | 21.18 |
| 17000 | 20.81 | 0.08846 | 20.68 | 20.97 | 20.83 |
| 18000 | 20.33 | 0.08871 | 20.19 | 20.47 | 20.31 |
| 19000 | 19.77 | 0.07522 | 19.68 | 19.93 | 19.77 |
| 20000 | 19.16 | 0.11090 | 18.99 | 19.31 | 19.19 |
| 21000 | 18.50 | 0.10299 | 18.34 | 18.71 | 18.49 |
| 22000 | 18.18 | 0.04529 | 18.14 | 18.29 | 18.15 |
| 23000 | 17.97 | 0.03982 | 17.92 | 18.04 | 17.96 |
| 24000 | 17.89 | 0.03974 | 17.81 | 17.94 | 17.90 |
| 25000 | 17.87 | 0.04264 | 17.80 | 17.92 | 17.88 |
|----------------:|----------:|---------------------:|----------:|----------:|---------:|
| 1000 | 608.09 | 3.80116 | 600.65 | 613.73 | 609.40 |
| 2000 | 142.75 | 0.94452 | 141.21 | 143.84 | 143.07 |
| 3000 | 62.19 | 0.44544 | 61.38 | 63.01 | 62.18 |
| 4000 | 40.22 | 0.16397 | 39.93 | 40.54 | 40.20 |
| 5000 | 32.00 | 0.15850 | 31.61 | 32.19 | 32.02 |
| 6000 | 28.05 | 0.17854 | 27.81 | 28.41 | 28.05 |
| 7000 | 25.65 | 0.10946 | 25.51 | 25.87 | 25.65 |
| 8000 | 24.20 | 0.11385 | 23.98 | 24.36 | 24.20 |
| 9000 | 23.18 | 0.14936 | 22.84 | 23.37 | 23.20 |
| 10000 | 22.88 | 0.22752 | 22.54 | 23.33 | 22.94 |
| 11000 | 21.99 | 0.16232 | 21.73 | 22.29 | 21.97 |
| 12000 | 21.69 | 0.10824 | 21.46 | 21.81 | 21.73 |
| 13000 | 21.42 | 0.09154 | 21.25 | 21.57 | 21.44 |
| 14000 | 21.33 | 0.13821 | 21.15 | 21.55 | 21.27 |
| 15000 | 21.24 | 0.15526 | 20.95 | 21.57 | 21.20 |
| 16000 | 21.19 | 0.10521 | 21.01 | 21.44 | 21.18 |
| 17000 | 20.89 | 0.18239 | 20.69 | 21.18 | 20.82 |
| 18000 | 20.36 | 0.10715 | 20.21 | 20.53 | 20.34 |
| 19000 | 19.74 | 0.12803 | 19.45 | 19.92 | 19.75 |
| 20000 | 19.18 | 0.10020 | 19.05 | 19.39 | 19.15 |
| 21000 | 18.49 | 0.06319 | 18.36 | 18.60 | 18.49 |
| 22000 | 18.17 | 0.03674 | 18.11 | 18.22 | 18.16 |
| 23000 | 17.98 | 0.03682 | 17.90 | 18.04 | 17.99 |
| 24000 | 17.88 | 0.02880 | 17.84 | 17.92 | 17.89 |
| 25000 | 17.85 | 0.02793 | 17.80 | 17.90 | 17.86 |

After training, the models were evaluated on the test dataset. The following
table summarizes the final perplexity on the test set.

|**Average perplexity**|**Standard deviation**|**Minimum**|**Maximum**|**Median**|
|---------------------:|---------------------:|----------:|----------:|---------:|
| 18.29 | 0.05214 | 18.24 | 18.40 | 18.27 |
|----------:|---------------------:|----------:|----------:|---------:|
| 18.30 | 0.02747 | 18.24 | 18.33 | 18.30 |

#### Training performance results

Expand Down Expand Up @@ -1463,7 +1463,7 @@ training iterations.
| 2 | 8 | 27,304 | 40,222 | 1.473 | 1.883 | 1.866 |
| 4 | 8 | 53,756 | 80,226 | 1.492 | 3.708 | 3.722 |
| 8 | 8 | 106,651 | 159,185 | 1.493 | 7.357 | 7.385 |
| 1 | 16 | N/A | 25,084 | 1.730 | N/A | 1 |
| 1 | 16 | N/A | 25,084 | 1.730 | N/A | 1.000 |
| 2 | 16 | N/A | 48,562 | 1.779 | N/A | 1.936 |
| 4 | 16 | N/A | 95,997 | 1.786 | N/A | 3.827 |
| 8 | 16 | N/A | 191,148 | 1.792 | N/A | 7.620 |
Expand Down Expand Up @@ -1513,7 +1513,7 @@ training iterations.
| 2 | 2 | 6,153 | 11,272 | 1.832 | 1.729 | 1.632 |
| 4 | 2 | 12,492 | 22,530 | 1.804 | 3.511 | 3.262 |
| 8 | 2 | 24,595 | 40,920 | 1.664 | 6.913 | 5.925 |
| 1 | 4 | N/A | 10,210 | 2.870 | N/A | 1 |
| 1 | 4 | N/A | 10,210 | 2.870 | N/A | 1.000 |
| 2 | 4 | N/A | 17,984 | 2.923 | N/A | 1.761 |
| 4 | 4 | N/A | 36,340 | 2.909 | N/A | 3.559 |
| 8 | 4 | N/A | 66,716 | 2.713 | N/A | 6.535 |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion PyTorch/LanguageModeling/Transformer-XL/pytorch/eval.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion PyTorch/LanguageModeling/Transformer-XL/pytorch/lamb.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -492,14 +492,14 @@ def forward(self, inp):
l_idx, r_idx = self.cutoff_ends[i], self.cutoff_ends[i + 1]

mask_i = (inp_flat >= l_idx) & (inp_flat < r_idx)
indices_i = mask_i.nonzero().squeeze()
indices_i = mask_i.nonzero(as_tuple=False).squeeze()

if indices_i.numel() == 0:
continue

inp_i = inp_flat.index_select(0, indices_i) - l_idx
emb_i = self.emb_layers[i](inp_i)
emb_i = F.linear(emb_i, self.emb_projs[i])
emb_i = F.linear(emb_i, self.emb_projs[i]).to(emb_flat.dtype)

emb_flat.index_copy_(0, indices_i, emb_i)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Loading