bert icon indicating copy to clipboard operation
bert copied to clipboard

Restore model each time doing estimator.predict

Open mfxss opened this issue 8 years ago • 6 comments

I am using the code from extract_features.py . I called model_fn_builder only once. And create several examples list to feed to estimator.predict . It seems that each time doing estimator.predict, the model is restored which can be seen from the logger info. This slows down. Where can I fix this?

mfxss avatar Nov 13 '18 09:11 mfxss

I think that's the expected behavior of this interface, so if you need different behavior you can change the interface to something other than TPUEstimator.

jacobdevlin-google avatar Nov 15 '18 03:11 jacobdevlin-google

@mfxss I solved this problem in this repo, and wrap the extract_features as a service. please refer to it: https://github.com/hanxiao/bert-as-service the avg. speed for 12 layer BERT with max_seq_len is about 2000 sample/s

hanxiao avatar Nov 15 '18 03:11 hanxiao

@hanxiao I solved this problem in this repo, and wrap the extract_features as a service. please refer to it: https://github.com/hanxiao/bert-as-service the avg. speed for 12 layer BERT with max_seq_len is about 2000 sample/s 韩: Where did you modify to achieve this? Only in extract_feature.py? Thanks for the help!

mfxss avatar Nov 15 '18 03:11 mfxss

@mfxss I solved this problem in this repo, and wrap the extract_features as a service. please refer to it: https://github.com/hanxiao/bert-as-service the avg. speed for 12 layer BERT with max_seq_len is about 2000 sample/s

@mfxss I solved this problem in this repo, and wrap the extract_features as a service. please refer to it: https://github.com/hanxiao/bert-as-service the avg. speed for 12 layer BERT with max_seq_len is about 2000 sample/s

@mfxss I solved this problem in this repo, and wrap the extract_features as a service. please refer to it: https://github.com/hanxiao/bert-as-service the avg. speed for 12 layer BERT with max_seq_len is about 2000 sample/s

Could you point out the behind idea and the code ? Thank you very much.

ntson2002 avatar Feb 12 '19 10:02 ntson2002

@ntson2002 checkout https://hanxiao.github.io/2019/01/02/Serving-Google-BERT-in-Production-using-Tensorflow-and-ZeroMQ/

hanxiao avatar Feb 12 '19 10:02 hanxiao

Mark

guotong1988 avatar Sep 05 '19 01:09 guotong1988