nn_sdk推理tf1 tf2 pb nlp模型 , input tensor[input_ids , input_mask], output tensor[pred_ids]
Project description
nn-sdk是一个基于tf1 tf2神经网络推理开发包
# -*- coding: utf-8 -*-
from nn_sdk.py_tf_csdk import csdk_object
'''
支持多子图,支持图多输入多输出.
支持tensorflow 1 pb , tensorflow 2 pb , tensorflow ckpt
net_stage
'''
config = {
"model_dir": r'./model.ckpt',
"log_level": 4, # 0 fatal , 2 error , 4 info , 8 debug
"model_type": 1, # 0 pb format if 1 ckpt format
"ConfigProto": {
"log_device_placement": False,
"allow_soft_placement": True,
"gpu_options": {
"allow_growth": True
},
},
"graph_inf_version": 1, # the format of tensorflow pb model [1,2]
"graph": [
{
"input": ["input_ids:0","input_mask:0"], #tf1 sample ["input_ids:0"], tf2 sample ["input_ids"]
"output": ["pred_ids:0"], #tf1 sample ["pred_ids:0"], tf2 sample ["pred_ids"]
}
]}
seq_length = 4
input_ids = [[10.] * seq_length]
input_mask = [[1] * seq_length]
sdk_inf = csdk_object(config)
if sdk_inf.valid():
net_stage = 0
ret, out = sdk_inf.process(net_stage, input_ids,input_mask)
print(ret)
print(out)
sdk_inf.close()
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for nn_sdk-1.2.5-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43d69494631c989f345387f08ae179a9de14fc413bba085b1d20f5f817828fea |
|
MD5 | f17f94002322a6d180f8699b11e9a340 |
|
BLAKE2b-256 | bf6cf46beadad32b7f0dce6d54603e95e7ac429f946d5bbd5bdb691a0cde5923 |
Close
Hashes for nn_sdk-1.2.5-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09316af6711b3f76e7d0ecceb5243220ebf95ce0c13ec271727ae5ce175725d1 |
|
MD5 | 3c531bf44643ec0cbb479a9aa6ab6a41 |
|
BLAKE2b-256 | 9ee586f4f81397118d27391cedb25c03fba1c9b4ebb21adc80dc71c7e0545d9a |
Close
Hashes for nn_sdk-1.2.5-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33c288f0198da4b9793db30a459b386cc5d2bbe95762308191109ab2196f290e |
|
MD5 | 4aba9fedaea752b85cdd61beb8cc170a |
|
BLAKE2b-256 | 523fff915a90fe6f29f3dbeed744492dddbda2c5edf15f47f41a6aabb90b8c7c |
Close
Hashes for nn_sdk-1.2.5-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 041c30fe21feaaf885ae9c897899133f0ad6de16ca362c2390f3ae6a5822768a |
|
MD5 | 66b48ba21c73a2272c6a75c41a38ff86 |
|
BLAKE2b-256 | dee967aa456dbc0c9aafbf9d78dc114e6c8207da83af2e3565d5ca1f6eba1206 |
Close
Hashes for nn_sdk-1.2.5-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f612d80cb2466c0d46b3451b9f93853947fc26a8171f035e993c43ab44ff0a62 |
|
MD5 | 13bef7c15b5e27096f2be580a8cfc5a9 |
|
BLAKE2b-256 | 018eb41daa2586a19d07a0b080d2a15a52520ef2cd2349a0906c917aff27ee41 |
Close
Hashes for nn_sdk-1.2.5-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3f48c4b863f7d8186e83a273f0d568e2234b3839ef4d24edf69b17c5b23c5ca |
|
MD5 | 4c12e5a5a2ebac0a9edcfe4c9dafec32 |
|
BLAKE2b-256 | 3f0de548d503aef4b408a4e56b264e00dec4e56e74b1e762aea88ad84affcb90 |