Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update API for NAS in v1alpha2 #450

Merged
merged 3 commits into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions pkg/api/operators/apis/experiment/v1alpha2/experiment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package v1alpha2

import (
trial "github.com/kubeflow/katib/pkg/api/operators/apis/trial/v1alpha2"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -46,8 +46,9 @@ type ExperimentSpec struct {
// TODO - figure out what to do with metric collectors
MetricsCollectorType string `json:"metricsCollectorSpec,omitempty"`

NasConfig *NasConfig `json:"nasConfig,omitempty"`

// TODO - Other fields, exact format is TBD. Will add these back during implementation.
// - NAS
// - Early stopping
// - Resume experiment
}
Expand Down Expand Up @@ -222,6 +223,25 @@ type ExperimentList struct {
Items []Experiment `json:"items"`
}

// NasConfig contains config for NAS job
type NasConfig struct {
GraphConfig GraphConfig `json:"graphConfig,omitempty"`
Operations []Operation `json:"operations,omitempty"`
}

// GraphConfig contains a config of DAG
type GraphConfig struct {
NumLayers int32 `json:"numLayers,omitempty"`
InputSizes []int32 `json:"inputSizes,omitempty"`
OutputSizes []int32 `json:"outputSizes,omitempty"`
}

// Operation contains type of operation in DAG
type Operation struct {
OperationType string `json:"operationType,omitempty"`
Parameters []ParameterSpec `json:"parameterconfigs,omitempty"`
}

// TODO - enable this during API implementation.
//func init() {
// SchemeBuilder.Register(&Experiment{}, &ExperimentList{})
Expand Down
321 changes: 164 additions & 157 deletions pkg/api/v1alpha2/api.pb.go

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pkg/api/v1alpha2/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ message AlgorithmSpec {
}

/**
* TODO add to AlgorithmSpec
* NasConfig contains a config of NAS job
*/
message NasConfig {
Expand All @@ -267,8 +266,8 @@ message AlgorithmSpec {
*/
message GraphConfig {
int32 num_layers = 1; /// Number of layers
repeated int32 input_size = 2; /// Dimensions of input size
repeated int32 output_size = 3; /// Dimensions of output size
repeated int32 input_sizes = 2; /// Dimensions of input size
repeated int32 output_sizes = 3; /// Dimensions of output size
}

/**
Expand All @@ -279,7 +278,7 @@ message AlgorithmSpec {
/**
* List of ParameterSpec
*/
repeated ParameterSpec parameter_specs = 2; /// List of ParameterSpec
repeated ParameterSpec parameters = 2; /// List of ParameterSpec
}

/**
Expand All @@ -295,6 +294,7 @@ message ExperimentSpec {
int32 parallel_trial_count = 5;
int32 max_trial_count = 6;
string metrics_collector_type = 7;
NasConfig nas_config = 8;
}

message ExperimentStatus {
Expand Down
66 changes: 66 additions & 0 deletions pkg/api/v1alpha2/api.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,17 @@
],
"default": "CREATED"
},
"NasConfigOperations": {
"type": "object",
"properties": {
"operation": {
"type": "array",
"items": {
"$ref": "#/definitions/alpha2Operation"
}
}
}
},
"TrialStatusTrialConditionType": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -556,6 +567,9 @@
},
"metrics_collector_type": {
"type": "string"
},
"nas_config": {
"$ref": "#/definitions/alpha2NasConfig"
}
},
"description": "*\nSpec of a Experiment. Experiment represents a single optimization run over a feasible space. \nEach Experiment contains a configuration describing the feasible space, as well as a set of Trials.\nIt is assumed that objective function f(x) does not change in the course of a Experiment."
Expand Down Expand Up @@ -689,6 +703,30 @@
}
}
},
"alpha2GraphConfig": {
"type": "object",
"properties": {
"num_layers": {
"type": "integer",
"format": "int32"
},
"input_sizes": {
"type": "array",
"items": {
"type": "integer",
"format": "int32"
}
},
"output_sizes": {
"type": "array",
"items": {
"type": "integer",
"format": "int32"
}
}
},
"title": "*\nGraphConfig contains a config of DAG"
},
"alpha2Metric": {
"type": "object",
"properties": {
Expand All @@ -711,6 +749,18 @@
}
}
},
"alpha2NasConfig": {
"type": "object",
"properties": {
"graph_config": {
"$ref": "#/definitions/alpha2GraphConfig"
},
"operations": {
"$ref": "#/definitions/NasConfigOperations"
}
},
"title": "*\nNasConfig contains a config of NAS job"
},
"alpha2ObjectiveSpec": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -764,6 +814,22 @@
}
}
},
"alpha2Operation": {
"type": "object",
"properties": {
"operation_type": {
"type": "string"
},
"parameters": {
"type": "array",
"items": {
"$ref": "#/definitions/alpha2ParameterSpec"
},
"title": "* \nList of ParameterSpec"
}
},
"title": "*\nConfig for operations in DAG"
},
"alpha2ParameterAssignment": {
"type": "object",
"properties": {
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/v1alpha2/gen-doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ It is assumed that objective function f(x) does not change in the course of a Ex
| parallel_trial_count | [int32](#int32) | | |
| max_trial_count | [int32](#int32) | | |
| metrics_collector_type | [string](#string) | | |
| nas_config | [NasConfig](#api.v1.alpha2.NasConfig) | | |



Expand Down Expand Up @@ -486,8 +487,8 @@ GraphConfig contains a config of DAG
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| num_layers | [int32](#int32) | | Number of layers |
| input_size | [int32](#int32) | repeated | Dimensions of input size |
| output_size | [int32](#int32) | repeated | Dimensions of output size |
| input_sizes | [int32](#int32) | repeated | Dimensions of input size |
| output_sizes | [int32](#int32) | repeated | Dimensions of output size |



Expand Down Expand Up @@ -529,7 +530,6 @@ GraphConfig contains a config of DAG
<a name="api.v1.alpha2.NasConfig"/>

### NasConfig
TODO add to AlgorithmSpec
NasConfig contains a config of NAS job


Expand Down Expand Up @@ -615,7 +615,7 @@ Config for operations in DAG
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| operation_type | [string](#string) | | Type of operation in DAG |
| parameter_specs | [ParameterSpec](#api.v1.alpha2.ParameterSpec) | repeated | List of ParameterSpec
| parameters | [ParameterSpec](#api.v1.alpha2.ParameterSpec) | repeated | List of ParameterSpec

/ List of ParameterSpec |

Expand Down
15 changes: 11 additions & 4 deletions pkg/api/v1alpha2/gen-doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,13 @@ <h3 id="api.v1.alpha2.ExperimentSpec">ExperimentSpec</h3>
<td><p> </p></td>
</tr>

<tr>
<td>nas_config</td>
<td><a href="#api.v1.alpha2.NasConfig">NasConfig</a></td>
<td></td>
<td><p> </p></td>
</tr>

</tbody>
</table>

Expand Down Expand Up @@ -1146,14 +1153,14 @@ <h3 id="api.v1.alpha2.GraphConfig">GraphConfig</h3>
</tr>

<tr>
<td>input_size</td>
<td>input_sizes</td>
<td><a href="#int32">int32</a></td>
<td>repeated</td>
<td><p>Dimensions of input size </p></td>
</tr>

<tr>
<td>output_size</td>
<td>output_sizes</td>
<td><a href="#int32">int32</a></td>
<td>repeated</td>
<td><p>Dimensions of output size </p></td>
Expand Down Expand Up @@ -1226,7 +1233,7 @@ <h3 id="api.v1.alpha2.MetricLog">MetricLog</h3>


<h3 id="api.v1.alpha2.NasConfig">NasConfig</h3>
<p>TODO add to AlgorithmSpec</p><p>NasConfig contains a config of NAS job</p>
<p>NasConfig contains a config of NAS job</p>


<table class="field-table">
Expand Down Expand Up @@ -1386,7 +1393,7 @@ <h3 id="api.v1.alpha2.Operation">Operation</h3>
</tr>

<tr>
<td>parameter_specs</td>
<td>parameters</td>
<td><a href="#api.v1.alpha2.ParameterSpec">ParameterSpec</a></td>
<td>repeated</td>
<td><p>List of ParameterSpec
Expand Down
228 changes: 118 additions & 110 deletions pkg/api/v1alpha2/python/api_pb2.py

Large diffs are not rendered by default.