Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Punk-and-The-Monk committed Nov 29, 2019
1 parent e9d1869 commit 7290446
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions bert_cn_finetune-master/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,31 @@
## 模型转换

1. 将生成的模型转pb(在转pb以及tflite的过程中要确保tensorflow版本为1.15.0)

```
pip install tensorflow==1.15.0
freeze_graph --input_checkpoint albert_model.ckpt \
--output_graph albert_tiny_zh.pb \
--output_node_names finetune_mrc/truediv \
--checkpoint_version 1 --input_meta_graph albert_model.ckpt.meta --input_binary true
--checkpoint_version 1 \
--input_meta_graph albert_model.ckpt.meta \
--input_binary true
```



2. pb文件转tflite文件

```
pip install tf-nightly
tflite_convert --graph_def_file albert_tiny_zh.pb \
--input_arrays 'input_ids,input_masks,segment_ids' \
--output_arrays 'finetune_mrc/add, finetune_mrc/add_1'\
--input_shapes 1,512:1,512:1,512 \
--output_file saved_model.tflite \
--enable_v1_converter --experimental_new_converter

--enable_v1_converter \
--experimental_new_converter
```


0 comments on commit 7290446

Please sign in to comment.