使用 ray.serve

问题描述

我正在关注 ray 文档中的 this 教程

特别是这部分:

client = serve.start()
config = {"num_replicas": 3}
client.create_backend("tf:v1",TFMnistModel,TRAINED_MODEL_PATH,config=config)
client.create_endpoint("tf_classifier",backend="tf:v1",route="/mnist")

下面将单个样本发送到后端

sample_data= np.random.randn(28 * 28).tolist()
resp = requests.get(
    "http://localhost:8000/mnist",json={"array": sample_data})

如何同时发送多个样本,以便利用所有内核并行执行它们?例如使用以下方法创建的 100 个 MNIST 样本

# 100 MNIST sample 28x28
sample_data = np.random.randn(100 * 28 * 28).reshape((100,28,28))

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)