Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zheyuye committed Aug 11, 2020
1 parent e097c3b commit d651730
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scripts/conversion_toolkits/convert_albert_from_tf_hub.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
python3 -m pip install tensorflow==1.13.2 --upgrade --user
python3 -m pip install tensorflow==1.15 --upgrade --user
python3 -m pip install tensorflow_hub --upgrade --user
export TF_FORCE_GPU_ALLOW_GROWTH="true"
for model in base large xlarge xxlarge
Expand Down
2 changes: 1 addition & 1 deletion scripts/conversion_toolkits/convert_electra.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
python3 -m pip install tensorflow==1.13.2 --upgrade --user
python3 -m pip install tensorflow==1.15 --upgrade --user
export TF_FORCE_GPU_ALLOW_GROWTH="true"
git clone https://github.com/ZheyuYe/electra.git
cd electra
Expand Down
1 change: 1 addition & 0 deletions scripts/conversion_toolkits/convert_mobilebert.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
python3 -m pip install tensorflow==1.15 --upgrade --user
export TF_FORCE_GPU_ALLOW_GROWTH="true"
svn checkout https://github.com/google-research/google-research/trunk/mobilebert

Expand Down
3 changes: 2 additions & 1 deletion scripts/conversion_toolkits/convert_tf_hub_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def convert_tf_assets(tf_assets_dir, model_type):
('LayerNorm', 'layer_norm'), # albert
('attention_1', 'attention'), # albert
('attention/output/dense', 'attention_proj'),
('ffn_1', ''), # bert & albert
('ffn_1/', ''), # bert & albert
('intermediate/dense', 'ffn.ffn_1'), # albert
('intermediate/output/dense', 'ffn.ffn_2'), # albert
('output/dense', 'ffn.ffn_2'), # bert
Expand Down Expand Up @@ -385,6 +385,7 @@ def convert_tf_model(hub_model_dir, save_dir, test_conversion, model_type, gpu):
all_keys.remove(dst_name)
if 'self_attention/attention_output/kernel' in src_name:
mx_params[dst_name].set_data(tf_param_val.reshape((cfg.MODEL.units, -1)).T)
continue
if src_name.endswith('kernel'):
mx_params[dst_name].set_data(tf_param_val.T)
else:
Expand Down

0 comments on commit d651730

Please sign in to comment.