This repository is fork of BERT
For export model as saved model, I added export functionality to run_squad.py.
$ saved_model_cli show --dir <pb basename> --tag_set serve --signature_def serving_default
The given SavedModel SignatureDef contains the following input(s):
inputs['input_ids'] tensor_info:
dtype: DT_INT32
shape: (-1, 384)
name: input_ids_1:0
inputs['input_mask'] tensor_info:
dtype: DT_INT32
shape: (-1, 384)
name: input_mask_1:0
inputs['segment_ids'] tensor_info:
dtype: DT_INT32
shape: (-1, 384)
name: segment_ids_1:0
inputs['unique_ids'] tensor_info:
dtype: DT_INT32
shape: (-1)
name: unique_ids_1:0
The given SavedModel SignatureDef contains the following output(s):
outputs['end_logits'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 384)
name: unstack:1
outputs['start_logits'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 384)
name: unstack:0
outputs['unique_ids'] tensor_info:
dtype: DT_INT32
shape: (-1)
name: Identity:0
Method name is: tensorflow/serving/predict
docker run -p 8500:8500 \
--mount type=bind,source=/Users/yoohyuck/data/korquad_v1/1614927513,target=/models/korquad_v1/1 \
-e MODEL_NAME=korquad_v1 \
-t tensorflow/serving
See client directory.
See Dockerfile
Build tensorflow docker image by using Dockerfile. Use following command to run docker.
- bert_exportable: this repository.
- korquad_v1: korquad train/dev files included.
- bert_finetuned: https://drive.google.com/drive/folders/1gRlz0c46w2Nlm-LKMXlsg_5LhM0yzav3?usp=sharing
docker run \
-v ~/data/bert_exportable/:/bert_exportable \
-v ~/data/korquad_v1/:/korquad_v1 \
-v ~/data/bert_finetuned:/bert_finetuned \
-v /tmp:/tmp \
-it yoohuck12/ubuntu_with_tf:latest \
python3 /bert_exportable/run_squad.py \
--vocab_file=/bert_finetuned/vocab.txt \
--bert_config_file=/bert_finetuned/bert_config.json \
--init_checkpoint=/bert_finetuned/model.ckpt-7550 \
--do_predict=True \
--predict_file=/korquad_v1/dev_small.json \
--output_dir=/tmp
You can run the run_squad in Docker by push image into Docker hub. Before pushing image into Docker hub, you should make a repository.
bazel run run_squad_image_push --incompatible_restrict_string_escapes=false
Error: IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
- The Python version is: Python3.6 from "/usr/bin/python3"
- The NumPy version is: "1.19.5"
and make sure that they are the versions you expect. Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy.core._multiarray_umath'