java - Nvidia Triton 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);
推荐阅读
- datetime - 使用 dmore/behat-chrome-extension 设置日期时间字段的值
- python - 为什么print老是报错不支持str和int连接?print的用法是什么?
- r - 当表格出现在 pdf 文件的末尾时,apa_table() 返回空白结果
- javascript - 使用 jQuery 更新图像剪辑
- javascript - 反应 - 安装时不工作 npm
- azure - 本地 FTP 服务器文件夹迁移到 Azure 数据湖
- android - 改造-Android 11
- c++ - 如果一个类包含另一个类的对象,并且所有的类都是通过构造函数初始化的,那么初始化是如何工作的呢?
- vue.js - 使用 Vuetify 进行阴影控制
- amazon-web-services - AWS Glue - 数据未插入到所需的目的地