简体   繁体   English

Nvidia Triton tensorflow 字符串参数

[英]Nvidia Triton tensorflow string parameter

I have a tensorflow model with a string parameter as input.我有一个 tensorflow model 输入字符串参数。 Whats the type to use for strings in the Triton Java api? Triton Java api 中的字符串使用什么类型?

Eg.例如。 Model definition Model定义

    {
        "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
    }]

Client code客户端代码

String text = "the text";

    InferTensorContents.Builder input0_data = InferTensorContents.newBuilder();
    input0_data ... how to set

Triton uses google protobufs, so this is they way by using ByteString 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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM