diff --git a/docs/docs_zh/introduction.md b/docs/docs_zh/introduction.md index 8c61cc64..3c17c123 100644 --- a/docs/docs_zh/introduction.md +++ b/docs/docs_zh/introduction.md @@ -283,7 +283,7 @@ spec: "value": "0.928" } ], - "hyperparameters": [ + "hyperParameters": [ { "name": "batch_size", "value": "32" @@ -298,7 +298,7 @@ spec: 224, 3 ], - "dtype": "float64", + "dType": "float64", } ], "outputs": [ @@ -308,14 +308,12 @@ spec: 1, 1001 ], - "dtype": "float64", + "dType": "float64", } ], - "layers": [ - { - "name": "conv" - } - ] + "layers": { + "conv": 1 + } }, "training": { "git": { diff --git a/docs/introduction.md b/docs/introduction.md index b436b9e0..25e79dbb 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -289,7 +289,7 @@ When it comes to the specific supporting for model, we define our own [config](h "value": "0.928" } ], - "hyperparameters": [ + "hyperParameters": [ { "name": "batch_size", "value": "32" @@ -304,7 +304,7 @@ When it comes to the specific supporting for model, we define our own [config](h 224, 3 ], - "dtype": "float64", + "dType": "float64", } ], "outputs": [ @@ -314,14 +314,12 @@ When it comes to the specific supporting for model, we define our own [config](h 1, 1001 ], - "dtype": "float64", + "dType": "float64", } ], - "layers": [ - { - "name": "conv" - } - ] + "layers": { + "conv": 1 + } }, "training": { "git": { diff --git a/docs/spec-v1alpha1.md b/docs/spec-v1alpha1.md index 8d88d1de..6634464f 100644 --- a/docs/spec-v1alpha1.md +++ b/docs/spec-v1alpha1.md @@ -33,7 +33,7 @@ Tensors are multi-dimensional arrays with a uniform type. Description of the tensor. -- **dtype** string, OPTIONAL +- **dType** string, OPTIONAL DType of the tensor. @@ -41,7 +41,7 @@ Tensors are multi-dimensional arrays with a uniform type. Size of the tensor. -- **optype** string, OPTIONAL +- **opType** string, OPTIONAL OpType of the tensor, It is only used for PMML. @@ -113,9 +113,9 @@ Note: Any OPTIONAL field MAY also be set to null, which is equivalent to being a Value of the metric -- **hyperparameters** object, OPTIONAL +- **hyperParameters** object, OPTIONAL - Hyperparameters of the model + HyperParameters of the model - **name** string, REQUIRED @@ -179,7 +179,7 @@ Here is an example model configuration JSON document: "value": "0.9" } ], - "hyperparameters": [ + "hyperParameters": [ { "name": "batch_size", "value": "32" @@ -194,7 +194,7 @@ Here is an example model configuration JSON document: 224, 3 ], - "dtype": "float64", + "dType": "float64", } ], "outputs": [ @@ -204,14 +204,12 @@ Here is an example model configuration JSON document: 1, 1000 ], - "dtype": "float64", + "dType": "float64", } ], - "layers": [ - { - "name": "conv" - } - ] + "layers": { + "conv" : 1 + } }, "training": { "git": { diff --git a/examples/Caffe2-model/ormbfile.yaml b/examples/Caffe2-model/ormbfile.yaml index 8bac9473..0b151c8f 100644 --- a/examples/Caffe2-model/ormbfile.yaml +++ b/examples/Caffe2-model/ormbfile.yaml @@ -8,10 +8,10 @@ signature: - 3 - 224 - 224 - dtype: float32 + dType: float32 outputs: - name: softmax size: - 1 - 1000 - dtype: float32 + dType: float32 diff --git a/examples/GraphDef-model/ormbfile.yaml b/examples/GraphDef-model/ormbfile.yaml index f1f67551..db2f55d5 100644 --- a/examples/GraphDef-model/ormbfile.yaml +++ b/examples/GraphDef-model/ormbfile.yaml @@ -4,7 +4,7 @@ framework: TensorFlow signature: inputs: - name: input_1 - dtype: float32 + dType: float32 size: - -1 - 224 @@ -12,7 +12,7 @@ signature: - 3 outputs: - name: Logits/Softmax - dtype: float32 + dType: float32 size: - -1 - 1000 diff --git a/examples/MXNETParams-model/model/mobilenet_v2-0000.params b/examples/MXNetParams-model/model/mobilenet_v2-0000.params similarity index 100% rename from examples/MXNETParams-model/model/mobilenet_v2-0000.params rename to examples/MXNetParams-model/model/mobilenet_v2-0000.params diff --git a/examples/MXNETParams-model/model/mobilenet_v2-symbol.json b/examples/MXNetParams-model/model/mobilenet_v2-symbol.json similarity index 100% rename from examples/MXNETParams-model/model/mobilenet_v2-symbol.json rename to examples/MXNetParams-model/model/mobilenet_v2-symbol.json diff --git a/examples/MXNETParams-model/ormbfile.yaml b/examples/MXNetParams-model/ormbfile.yaml similarity index 75% rename from examples/MXNETParams-model/ormbfile.yaml rename to examples/MXNetParams-model/ormbfile.yaml index 200dfc9f..4e241dd2 100644 --- a/examples/MXNETParams-model/ormbfile.yaml +++ b/examples/MXNetParams-model/ormbfile.yaml @@ -1,5 +1,5 @@ author: "chenjun " -format: MXNETParams +format: MXNetParams signature: inputs: - name: data @@ -8,5 +8,5 @@ signature: - 3 - 224 - 224 - dtype: float32 + dType: float32 diff --git a/examples/TorchScript-model/ormbfile.yaml b/examples/TorchScript-model/ormbfile.yaml index 03300843..6b55bfbf 100644 --- a/examples/TorchScript-model/ormbfile.yaml +++ b/examples/TorchScript-model/ormbfile.yaml @@ -8,10 +8,10 @@ signature: - 3 - 224 - 224 - dtype: float32 + dType: float32 outputs: - name: input__9 size: - 1 - 1000 - dtype: float32 + dType: float32 diff --git a/pkg/model/format.go b/pkg/model/format.go index 554fb14e..41f04578 100644 --- a/pkg/model/format.go +++ b/pkg/model/format.go @@ -19,7 +19,7 @@ const ( FormatPMML Format = "PMML" FormatCaffeModel Format = "CaffeModel" FormatNetDef Format = "NetDef" - FormatMXNETParams Format = "MXNETParams" + FormatMXNetParams Format = "MXNetParams" FormatTorchScript Format = "TorchScript" FormatGraphDef Format = "GraphDef" FormatTensorRT Format = "TensorRT" @@ -53,8 +53,8 @@ func (f Format) ValidateDirectory(rootPath string) error { err = f.validateForCaffeModel(modelFilePath, fileList) case FormatNetDef: err = f.validateForNetDef(modelFilePath, fileList) - case FormatMXNETParams: - err = f.validateForMXNETParams(modelFilePath, fileList) + case FormatMXNetParams: + err = f.validateForMXNetParams(modelFilePath, fileList) case FormatTorchScript: err = f.validateForTorchScript(modelFilePath, fileList) case FormatGraphDef: @@ -182,7 +182,7 @@ func (f Format) validateForNetDef(modelPath string, files []os.FileInfo) error { return nil } -func (f Format) validateForMXNETParams(modelPath string, files []os.FileInfo) error { +func (f Format) validateForMXNetParams(modelPath string, files []os.FileInfo) error { var jsonFileNum int32 var paramsFileNum int32 for _, file := range files { diff --git a/pkg/model/format_test.go b/pkg/model/format_test.go index eb85f88f..47bcc44d 100644 --- a/pkg/model/format_test.go +++ b/pkg/model/format_test.go @@ -44,9 +44,9 @@ var _ = Describe("Format", func() { Expect(err).To(BeNil()) }) - It("Should validate MXNETParams format successfully", func() { - savedmodelFormat := model.FormatMXNETParams - err := savedmodelFormat.ValidateDirectory("../../examples/MXNETParams-model") + It("Should validate MXNetParams format successfully", func() { + savedmodelFormat := model.FormatMXNetParams + err := savedmodelFormat.ValidateDirectory("../../examples/MXNetParams-model") Expect(err).To(BeNil()) }) diff --git a/pkg/model/types.go b/pkg/model/types.go index 099d4a90..a0d38aa7 100644 --- a/pkg/model/types.go +++ b/pkg/model/types.go @@ -23,7 +23,7 @@ type Metadata struct { GPUType string `json:"gpuType,omitempty" yaml:"gpuType,omitempty"` Framework string `json:"framework,omitempty" yaml:"framework,omitempty"` Metrics []Metric `json:"metrics,omitempty" yaml:"metrics,omitempty"` - Hyperparameters []Hyperparameter `json:"hyperparameters,omitempty" yaml:"hyperparameters,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"` @@ -37,7 +37,7 @@ type Metric struct { } // Hyperparameter is the type for training hyperparameter (e.g. learning rate). -type Hyperparameter struct { +type HyperParameter struct { Name string `json:"name"` Value string `json:"value"` } @@ -45,23 +45,19 @@ type Hyperparameter struct { type Signature struct { Inputs []Tensor `json:"inputs,omitempty" yaml:"inputs,omitempty"` Outputs []Tensor `json:"outputs,omitempty" yaml:"outputs,omitempty"` - Layers []Layer `json:"layers,omitempty" yaml:"layers,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"` + DType string `json:"dType,omitempty" yaml:"dType,omitempty"` // OpType is special for PMML - OpType string `json:"optype,omitempty" yaml:"optype,omitempty"` + OpType string `json:"opType,omitempty" yaml:"opType,omitempty"` // Values is special for PMML Values []string `json:"values,omitempty" yaml:"values,omitempty"` } -type Layer struct { - Name string `json:"name,omitempty" yaml:"name,omitempty"` -} - type Training struct { Git GitRepo `json:"git,omitempty" yaml:"git,omitempty"` }