forked from dmlc/gluon-nlp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PyTorch attention cells, transformer, bert and conversion script (dml…
…c#1532) * torch attention cell * torch layers * torch bert * torch bert conversion script * update github actions * Fix macos github action * rename test files to fix ERROR collecting tests/torch/$name.py
- Loading branch information
Showing
20 changed files
with
2,641 additions
and
144 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
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,24 @@ | ||
set -ex | ||
|
||
python3 -m pip install 'tensorflow<3' --upgrade --user | ||
python3 -m pip install tensorflow_hub --upgrade --user | ||
export TF_FORCE_GPU_ALLOW_GROWTH="true" | ||
|
||
# Conversion for English Models | ||
for model in base large | ||
do | ||
for case in cased uncased | ||
do | ||
hub_directory="google_en_${case}_bert_${model}" | ||
mkdir -p ${hub_directory} | ||
if [ ${model} == base ];then | ||
url="https://tfhub.dev/google/bert_${case}_L-12_H-768_A-12/1?tf-hub-format=compressed" | ||
else | ||
url="https://tfhub.dev/google/bert_${case}_L-24_H-1024_A-16/1?tf-hub-format=compressed" | ||
fi | ||
wget ${url} -O "${hub_directory}.tar.gz" | ||
tar -xvf ${hub_directory}.tar.gz --directory ${hub_directory} | ||
cp bert_${model}_config.json ${hub_directory}/assets/ | ||
python3 convert_tf_hub_model.py --tf_hub_model_path ${hub_directory} --model_type bert --test --torch | ||
done | ||
done |
Oops, something went wrong.