如何解决Nvidia Triton tensorflow 字符串参数
我有一个以字符串参数作为输入的 tensorflow 模型。在 Triton Java api 中用于字符串的类型是什么?
例如。模型定义
{
"name":"test_model","platform":"tensorflow_savedmodel","backend":"tensorflow","version_policy":{
"latest":{
"num_versions":1
}
},"max_batch_size":8,"input":[{
"name":"input_text","data_type":"TYPE_STRING","format":"FORMAT_NONE","dims":[1],"reshape":{
"shape":[]},"is_shape_tensor":false,"allow_ragged_batch":false
}]
客户端代码
String text = "the text";
InferTensorContents.Builder input0_data = InferTensorContents.newBuilder();
input0_data ... how to set
解决方法
Triton 使用 google protobufs,所以这是他们使用 ByteString 的方式
String text = "textstring";
InferTensorContents.Builder input0input_text = InferTensorContents.newBuilder();
final ByteString input = ByteString.copyFrom(text,Charset.forName("UTF8"));
System.out.println(input.size());
input0input_text.addByteContents(input);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。