Some utilities for tensorflow serving
Project description
serving-utils
Some python utilities when using tensorflow-serving.
Installation
Prepare an environment with python version >= 3.6
From PYPI: 1. Manually install tensorflow CPU or GPU version. 2. pip install serving-utils
From Github repository: 1. git clone git@github.com:Yoctol/serving-utils.git 2. Manually install tensorflow CPU or GPU version. 3. make install
Usage
Saver ```python import tensorflow as tf
from serving_utils import Saver
saver = Saver( session=tf.Session(graph=your_graph), output_dir=’/path/to/serving’, signature_def_map={ ‘predict’: tf.saved_model.signature_def_utils.predict_signature_def( inputs={‘input’: tf.Tensor…}, outputs={‘output’: tf.Tensor…}, ) }, freeze=True, # (default: True) Frozen graph will be saved if True. ) saver.save() ```
Client ```python from serving_utils import Client, PredictInput
client = Client(addr=”localhost:8500”) client.predict( [PredictInput(name=’input’, value=np.ones(1, 10))], output_names=[‘output’], model_signature_name=’predict’, )
or async
await client.async_predict(…) ```
Freeze graph ```python from serving_utils.freeze_graph import freeze_graph, create_session_from_graphdef
frozen_graph_def = freeze_graph(session, output_op_names) new_session = create_session_from_graphdef(frozen_graph_def)
## Test Run the following commands:
make lint make test
## Dev
make install-dev ```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for serving_utils-0.8.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3547cb97aaee9b2be1cc0be3f135b97b5089b4c971da729f8426729e98522886 |
|
MD5 | 0ffcb4b35465469e762800e32a2cbaad |
|
BLAKE2b-256 | 160c9db775b7fee4d22c13171d2588169b479ede9f9a91b0bd6b7f97c8f42ba6 |