简体   繁体   中英

Nvidia Triton tensorflow string parameter

I have a tensorflow model with a string parameter as input. Whats the type to use for strings in the Triton Java api?

Eg. Model definition

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

    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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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