/
models_client.go
315 lines (265 loc) · 9.67 KB
/
models_client.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"io"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
)
// New creates a new models API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
}
/*
Client for models API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
/*
DeleteModel deletes an existing model
Deletes an existing model. It does not delete any data in the user's data store.
*/
func (a *Client) DeleteModel(params *DeleteModelParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteModelOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteModelParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "deleteModel",
Method: "DELETE",
PathPattern: "/v1/models/{model_id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &DeleteModelReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*DeleteModelOK), nil
}
/*
DownloadModelDefinition downloads the model definition
Downloads the model definition that was initial used for training as ZIP archive.
*/
func (a *Client) DownloadModelDefinition(params *DownloadModelDefinitionParams, authInfo runtime.ClientAuthInfoWriter, writer io.Writer) (*DownloadModelDefinitionOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDownloadModelDefinitionParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "downloadModelDefinition",
Method: "GET",
PathPattern: "/v1/models/{model_id}/definition",
ProducesMediaTypes: []string{"application/octet-stream"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &DownloadModelDefinitionReader{formats: a.formats, writer: writer},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*DownloadModelDefinitionOK), nil
}
/*
DownloadTrainedModel downloads the trained model
Downloads the trained model as ZIP archive.
*/
func (a *Client) DownloadTrainedModel(params *DownloadTrainedModelParams, authInfo runtime.ClientAuthInfoWriter, writer io.Writer) (*DownloadTrainedModelOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDownloadTrainedModelParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "downloadTrainedModel",
Method: "GET",
PathPattern: "/v1/models/{model_id}/trained_model",
ProducesMediaTypes: []string{"application/octet-stream"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &DownloadTrainedModelReader{formats: a.formats, writer: writer},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*DownloadTrainedModelOK), nil
}
/*
GetLogs gets training logs as websocket stream
Get training logs for the given model as websocket stream. Each message can contain one or more log lines.
*/
func (a *Client) GetLogs(params *GetLogsParams, writer io.Writer) (*GetLogsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetLogsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getLogs",
Method: "GET",
PathPattern: "/v1/models/{model_id}/logs",
ProducesMediaTypes: []string{"application/octet-stream"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &GetLogsReader{formats: a.formats, writer: writer},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetLogsOK), nil
}
/*
GetMetrics gets training metrics from a model training as websocket
Get training metrics such as learning rate, accurarcy, loss from a model training via a websocket. It returns one or more JSON payloads at a time with the following schema.
*/
func (a *Client) GetMetrics(params *GetMetricsParams, writer io.Writer) (*GetMetricsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetMetricsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getMetrics",
Method: "GET",
PathPattern: "/v1/models/{model_id}/metrics",
ProducesMediaTypes: []string{"application/octet-stream"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &GetMetricsReader{formats: a.formats, writer: writer},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetMetricsOK), nil
}
/*
GetModel gets detailed information about a model
Get detailed information about a model such as training status.
*/
func (a *Client) GetModel(params *GetModelParams, authInfo runtime.ClientAuthInfoWriter) (*GetModelOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetModelParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getModel",
Method: "GET",
PathPattern: "/v1/models/{model_id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &GetModelReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*GetModelOK), nil
}
/*
ListModels gets a list of available deep learning models
Get a list of all available deep learning models and their configuration that a user can see.
*/
func (a *Client) ListModels(params *ListModelsParams, authInfo runtime.ClientAuthInfoWriter) (*ListModelsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListModelsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "listModels",
Method: "GET",
PathPattern: "/v1/models",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &ListModelsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*ListModelsOK), nil
}
/*
PatchModel changes the status of the training progress
Changes the status of the training progress to the given `status` value (currently `halt` only). Halt means the training will be stopped and the last snapshot will be stored and can be retrieved.
*/
func (a *Client) PatchModel(params *PatchModelParams, authInfo runtime.ClientAuthInfoWriter) (*PatchModelAccepted, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchModelParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "patchModel",
Method: "PATCH",
PathPattern: "/v1/models/{model_id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &PatchModelReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*PatchModelAccepted), nil
}
/*
PostModel trains a new deep learning model
Trains a deep neural network written in a DL framework supported by the DLaaS platform (such as Caffe, Tensorflow, etc.). The model code has to be uploaded and configuration parameters have to be provided.
*/
func (a *Client) PostModel(params *PostModelParams, authInfo runtime.ClientAuthInfoWriter) (*PostModelCreated, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPostModelParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "postModel",
Method: "POST",
PathPattern: "/v1/models",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"multipart/form-data"},
Schemes: []string{"https"},
Params: params,
Reader: &PostModelReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*PostModelCreated), nil
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}