-
Notifications
You must be signed in to change notification settings - Fork 3
/
common.go
51 lines (42 loc) · 1.6 KB
/
common.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package bert
import "github.com/sunhailin-Leo/triton-service-go/nvidia_inferenceserver"
// GenerateModelInferRequest model input callback.
type GenerateModelInferRequest func(batchSize, maxSeqLength int) []*nvidia_inferenceserver.ModelInferRequest_InferInputTensor
// GenerateModelInferOutputRequest model output callback.
type GenerateModelInferOutputRequest func(params ...interface{}) []*nvidia_inferenceserver.ModelInferRequest_InferRequestedOutputTensor
// InputFeature Bert InputFeature.
type InputFeature struct {
Text string // origin text
Tokens []string // token. like CLS/SEP after tokenizer
TokenIDs []int32 // input_ids
Mask []int32 // input_mast
TypeIDs []int32 // segment_ids
}
// InputObjects bert input objects for position record.
type InputObjects struct {
Input string
Tokens []string
PosArray []OffsetsType
}
// HTTPBatchInput Model HTTP Batch Request Input Struct (Support batch 1).
type HTTPBatchInput struct {
Name string `json:"name"`
Shape []int64 `json:"shape"`
DataType string `json:"datatype"`
Data [][]int32 `json:"data"`
}
// InferOutputParameter triton inference server infer parameters.
type InferOutputParameter struct {
BinaryData bool `json:"binary_data"`
Classification int64 `json:"classification"`
}
// HTTPOutput Model HTTP Request Output Struct.
type HTTPOutput struct {
Name string `json:"name"`
Parameters InferOutputParameter `json:"parameters"`
}
// HTTPRequestBody Model HTTP Request Body.
type HTTPRequestBody struct {
Inputs []HTTPBatchInput `json:"inputs"`
Outputs []HTTPOutput `json:"outputs"`
}