imdb example无法用numpy预测
Created by: barrierye
错误信息中4294967295应该是-1,word_ids里没有-1的值:
[[ 8]
[233]
[ 52]
[601]]
Client端复现代码:
from paddle_serving_client import Client
import numpy as np
from imdb_reader import IMDBDataset
import sys
import paddle.fluid as fluid
client = Client()
client.load_client_config('imdb_bow_client_conf/serving_client_conf.prototxt')
client.connect(["127.0.0.1:9292"])
imdb_dataset = IMDBDataset()
imdb_dataset.load_resource('imdb.vocab')
line = "i am very sad | 0"
word_ids, label = imdb_dataset.get_words_and_label(line)
word_ids = np.array(word_ids, dtype='int64').reshape((4, 1))
feed = {"words": word_ids}
fetch = ["prediction"]
fetch_map = client.predict(feed=feed, fetch=fetch)
print(fetch_map)