generated from caicloud/golang-template-project
-
Notifications
You must be signed in to change notification settings - Fork 61
/
types.go
75 lines (64 loc) · 3.13 KB
/
types.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package model
import "time"
type Model struct {
// Metadata is the contents of the Chartfile.
Metadata *Metadata `json:"metadata,omitempty"`
Path string `json:"path,omitempty"`
Content []byte `json:"content,omitempty"`
Config []byte `json:"config,omitempty"`
}
type Metadata struct {
Author string `json:"author,omitempty" yaml:"author,omitempty"`
Created time.Time `json:"created,omitempty" yaml:"created,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
Format string `json:"format,omitempty" yaml:"format,omitempty"`
// GPUType is for TensorRT format only, it must be set when extract signature or serve
// as a online service, otherwise, it can not extract or serve as a service.
// for other model format, you can set empty string or not set.
GPUType string `json:"gpuType,omitempty" yaml:"gpuType,omitempty"`
Framework string `json:"framework,omitempty" yaml:"framework,omitempty"`
Metrics map[string]MetricList `json:"metrics,omitempty" yaml:"metrics,omitempty"`
HyperParameters []HyperParameter `json:"hyperParameters,omitempty" yaml:"hyperParameters,omitempty"`
Signature *Signature `json:"signature,omitempty" yaml:"signature,omitempty"`
Training *Training `json:"training,omitempty" yaml:"training,omitempty"`
Dataset *Dataset `json:"dataset,omitempty" yaml:"dataset,omitempty"`
DirectoryStructure []string `json:"directoryStructure,omitempty" yaml:"directoryStructure,omitempty"`
}
// MetricList is the type for list of metric
type MetricList []Metric
// Metric is the type for training metric (e.g. acc).
type Metric struct {
Name string `json:"name"`
Value string `json:"value"`
}
// Hyperparameter is the type for training hyperparameter (e.g. learning rate).
type HyperParameter struct {
Name string `json:"name"`
Value string `json:"value"`
}
type Signature struct {
Inputs []Tensor `json:"inputs,omitempty" yaml:"inputs,omitempty"`
Outputs []Tensor `json:"outputs,omitempty" yaml:"outputs,omitempty"`
Layers map[string]int `json:"layers,omitempty" yaml:"layers,omitempty"`
}
type Tensor struct {
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Size []int `json:"size,omitempty" yaml:"size,omitempty"`
DType string `json:"dType,omitempty" yaml:"dType,omitempty"`
// OpType is special for PMML
OpType string `json:"opType,omitempty" yaml:"opType,omitempty"`
// Values is special for PMML
Values []string `json:"values,omitempty" yaml:"values,omitempty"`
}
type Training struct {
Git GitRepo `json:"git,omitempty" yaml:"git,omitempty"`
}
type Dataset struct {
Git GitRepo `json:"git,omitempty" yaml:"git,omitempty"`
}
type GitRepo struct {
Repository string `json:"repository,omitempty" yaml:"repository,omitempty"`
Revision string `json:"revision,omitempty" yaml:"revision,omitempty"`
}