Skip to main content

serving-utils

travis pypi release

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

  1. Saver and Loader ```python import tensorflow as tf

from serving_utils.saver import Saver from serving_utils.loader import Loader

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()

loader = Loader( path=’/path/to/serving’, # version=1, # if not specified, use the latest version ) new_sess = tf.Session()

loader.load(new_sess) # load the saved model into new session ```

  1. Client ```python from serving_utils import Client client = Client(host=”localhost”, port=8500, n_trys=3) client.predict( {‘input’: np.ones(1, 10)}, output_names=[‘output’], model_signature_name=’predict’, )

or async

await client.async_predict(…) ```

  1. 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

### Protos

python -m grpc_tools.protoc -I. –python_out=. –python_grpc_out=. –grpc_python_out=. serving_utils/protos/*.proto ```

Metadata

Release files for serving-utils 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for serving-utils 0.10.0
File Size Uploaded Provenance
serving-utils-0.10.0.tar.gz 15.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for serving-utils 0.10.0
File Interpreter ABI Platform
serving_utils-0.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 43.1 kB

Release files / serving-utils-0.10.0.tar.gz

Download URL serving-utils-0.10.0.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b6e75e8688dd16342e6c156185d0782a5b9d884f9e9db4bc27f05df0200102c3
BLAKE2b-256 checksum
How to use checksums
dee5f64cb1c10955808a65af630ab9e8503dbe37a8d815778853b464548fe2d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.7

Release files / serving_utils-0.10.0-py3-none-any.whl

Download URL serving_utils-0.10.0-py3-none-any.whl
Size 27.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
efa415ad8e908216d041682a84b18a60b1cdca9ac616eafee58f3b02c672904b
BLAKE2b-256 checksum
How to use checksums
42f3a9e6305da1e6843102c415372c5771b8237b8d990d18cb83fefaf81a2a8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.7

Security for serving-utils 0.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page