-
Notifications
You must be signed in to change notification settings - Fork 643
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #167 from cccntu/faster_transformer-poc
Add Faster Transformer compiler for Bert
- Loading branch information
Showing
25 changed files
with
4,299 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
BASE_CHECKPOINT_DIR = "checkpoints" | ||
BASE_CHECKPOINT_DATA_DIR = "games" | ||
BASE_CHECKPOINT_DATA_DIR = "games" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
# TODO: check requirements | ||
# https://github.com/NVIDIA/FasterTransformer/blob/main/docs/bert_guide.md | ||
# Requirements | ||
#CMake >= 3.8 for Tensorflow, CMake >= 3.13 for PyTorch | ||
#CUDA 11.0 or newer version | ||
#Python: Only verify on python 3 | ||
#Tensorflow: Verify on 1.15, 1.13 and 1.14 should work. | ||
#PyTorch: Verify on 1.8.0, >= 1.5.0 should work. | ||
|
||
|
||
# Set non interactive mode for apt-get | ||
export DEBIAN_FRONTEND=noninteractive | ||
|
||
if [[ $OSTYPE == "darwin"* ]] | ||
then | ||
echo "MacOS is not supported for FasterTransformer" | ||
exit 1 | ||
fi | ||
|
||
if [ ! -d "FasterTransformer" ] | ||
then | ||
git clone --recursive https://github.com/NVIDIA/FasterTransformer FasterTransformer | ||
fi | ||
|
||
# TODO: checkout to latest release | ||
|
||
cd FasterTransformer && | ||
mkdir -p build && | ||
cd build && | ||
cmake -DSM=$COMPUTE_CAPABILITY -DCMAKE_BUILD_TYPE=Release -DBUILD_PYT=ON .. && | ||
make -j8 && | ||
touch ../../FasterTransformer_build_success # create a file to indicate that the build was successful | ||
|
||
# TODO: enable multi gpu if possible | ||
#-DBUILD_MULTI_GPU=OFF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from nebullvm.operations.inference_learners.pytorch import ( | ||
PytorchBackendInferenceLearner, | ||
) | ||
|
||
|
||
class FasterTransformerInferenceLearner(PytorchBackendInferenceLearner): | ||
MODEL_NAME = "faster_transformer_model_scripted.pt" | ||
name = "FasterTransformer" |
Oops, something went wrong.