mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
497 lines
13 KiB
Go
497 lines
13 KiB
Go
/*
|
|
Hanzo Cloud API
|
|
|
|
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
|
|
|
|
API version: v1
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package hanzoai
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
// checks if the TrainSpec type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &TrainSpec{}
|
|
|
|
// TrainSpec struct for TrainSpec
|
|
type TrainSpec struct {
|
|
// Adaptation is how the update is parameterized.
|
|
Adaptation *TrainAdaptation `json:"adaptation,omitempty"`
|
|
// BaseModel is the base the capability is taught to: `kai`, or a model the engine loads for a client.
|
|
BaseModel *string `json:"base_model,omitempty"`
|
|
// Dataset is what the job trains on.
|
|
Dataset *TrainDataset `json:"dataset,omitempty"`
|
|
// Evaluation names the target suites the result reports.
|
|
Evaluation *TrainEvaluation `json:"evaluation,omitempty"`
|
|
// From is an artifact the job starts from, by sha256.
|
|
From *string `json:"from,omitempty"`
|
|
// Objective is the loss and the terms beside it.
|
|
Objective *TrainObjective `json:"objective,omitempty"`
|
|
// Output is what the job produces.
|
|
Output *TrainOutput `json:"output,omitempty"`
|
|
// Protect names what the base already does that must hold, and the budget.
|
|
Protect *TrainProtect `json:"protect,omitempty"`
|
|
// Resources places and bounds the run.
|
|
Resources *TrainResources `json:"resources,omitempty"`
|
|
// Revision pins the base. For kai: a finished run's name on the executor, or `hub:<repo>@<rev>`.
|
|
Revision *string `json:"revision,omitempty"`
|
|
AdditionalProperties map[string]interface{}
|
|
}
|
|
|
|
type _TrainSpec TrainSpec
|
|
|
|
// NewTrainSpec instantiates a new TrainSpec object
|
|
// This constructor will assign default values to properties that have it defined,
|
|
// and makes sure properties required by API are set, but the set of arguments
|
|
// will change when the set of required properties is changed
|
|
func NewTrainSpec() *TrainSpec {
|
|
this := TrainSpec{}
|
|
return &this
|
|
}
|
|
|
|
// NewTrainSpecWithDefaults instantiates a new TrainSpec object
|
|
// This constructor will only assign default values to properties that have it defined,
|
|
// but it doesn't guarantee that properties required by API are set
|
|
func NewTrainSpecWithDefaults() *TrainSpec {
|
|
this := TrainSpec{}
|
|
return &this
|
|
}
|
|
|
|
// GetAdaptation returns the Adaptation field value if set, zero value otherwise.
|
|
func (o *TrainSpec) GetAdaptation() TrainAdaptation {
|
|
if o == nil || IsNil(o.Adaptation) {
|
|
var ret TrainAdaptation
|
|
return ret
|
|
}
|
|
return *o.Adaptation
|
|
}
|
|
|
|
// GetAdaptationOk returns a tuple with the Adaptation field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *TrainSpec) GetAdaptationOk() (*TrainAdaptation, bool) {
|
|
if o == nil || IsNil(o.Adaptation) {
|
|
return nil, false
|
|
}
|
|
return o.Adaptation, true
|
|
}
|
|
|
|
// HasAdaptation returns a boolean if a field has been set.
|
|
func (o *TrainSpec) HasAdaptation() bool {
|
|
if o != nil && !IsNil(o.Adaptation) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetAdaptation gets a reference to the given TrainAdaptation and assigns it to the Adaptation field.
|
|
func (o *TrainSpec) SetAdaptation(v TrainAdaptation) {
|
|
o.Adaptation = &v
|
|
}
|
|
|
|
// GetBaseModel returns the BaseModel field value if set, zero value otherwise.
|
|
func (o *TrainSpec) GetBaseModel() string {
|
|
if o == nil || IsNil(o.BaseModel) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.BaseModel
|
|
}
|
|
|
|
// GetBaseModelOk returns a tuple with the BaseModel field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *TrainSpec) GetBaseModelOk() (*string, bool) {
|
|
if o == nil || IsNil(o.BaseModel) {
|
|
return nil, false
|
|
}
|
|
return o.BaseModel, true
|
|
}
|
|
|
|
// HasBaseModel returns a boolean if a field has been set.
|
|
func (o *TrainSpec) HasBaseModel() bool {
|
|
if o != nil && !IsNil(o.BaseModel) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetBaseModel gets a reference to the given string and assigns it to the BaseModel field.
|
|
func (o *TrainSpec) SetBaseModel(v string) {
|
|
o.BaseModel = &v
|
|
}
|
|
|
|
// GetDataset returns the Dataset field value if set, zero value otherwise.
|
|
func (o *TrainSpec) GetDataset() TrainDataset {
|
|
if o == nil || IsNil(o.Dataset) {
|
|
var ret TrainDataset
|
|
return ret
|
|
}
|
|
return *o.Dataset
|
|
}
|
|
|
|
// GetDatasetOk returns a tuple with the Dataset field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *TrainSpec) GetDatasetOk() (*TrainDataset, bool) {
|
|
if o == nil || IsNil(o.Dataset) {
|
|
return nil, false
|
|
}
|
|
return o.Dataset, true
|
|
}
|
|
|
|
// HasDataset returns a boolean if a field has been set.
|
|
func (o *TrainSpec) HasDataset() bool {
|
|
if o != nil && !IsNil(o.Dataset) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetDataset gets a reference to the given TrainDataset and assigns it to the Dataset field.
|
|
func (o *TrainSpec) SetDataset(v TrainDataset) {
|
|
o.Dataset = &v
|
|
}
|
|
|
|
// GetEvaluation returns the Evaluation field value if set, zero value otherwise.
|
|
func (o *TrainSpec) GetEvaluation() TrainEvaluation {
|
|
if o == nil || IsNil(o.Evaluation) {
|
|
var ret TrainEvaluation
|
|
return ret
|
|
}
|
|
return *o.Evaluation
|
|
}
|
|
|
|
// GetEvaluationOk returns a tuple with the Evaluation field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *TrainSpec) GetEvaluationOk() (*TrainEvaluation, bool) {
|
|
if o == nil || IsNil(o.Evaluation) {
|
|
return nil, false
|
|
}
|
|
return o.Evaluation, true
|
|
}
|
|
|
|
// HasEvaluation returns a boolean if a field has been set.
|
|
func (o *TrainSpec) HasEvaluation() bool {
|
|
if o != nil && !IsNil(o.Evaluation) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetEvaluation gets a reference to the given TrainEvaluation and assigns it to the Evaluation field.
|
|
func (o *TrainSpec) SetEvaluation(v TrainEvaluation) {
|
|
o.Evaluation = &v
|
|
}
|
|
|
|
// GetFrom returns the From field value if set, zero value otherwise.
|
|
func (o *TrainSpec) GetFrom() string {
|
|
if o == nil || IsNil(o.From) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.From
|
|
}
|
|
|
|
// GetFromOk returns a tuple with the From field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *TrainSpec) GetFromOk() (*string, bool) {
|
|
if o == nil || IsNil(o.From) {
|
|
return nil, false
|
|
}
|
|
return o.From, true
|
|
}
|
|
|
|
// HasFrom returns a boolean if a field has been set.
|
|
func (o *TrainSpec) HasFrom() bool {
|
|
if o != nil && !IsNil(o.From) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetFrom gets a reference to the given string and assigns it to the From field.
|
|
func (o *TrainSpec) SetFrom(v string) {
|
|
o.From = &v
|
|
}
|
|
|
|
// GetObjective returns the Objective field value if set, zero value otherwise.
|
|
func (o *TrainSpec) GetObjective() TrainObjective {
|
|
if o == nil || IsNil(o.Objective) {
|
|
var ret TrainObjective
|
|
return ret
|
|
}
|
|
return *o.Objective
|
|
}
|
|
|
|
// GetObjectiveOk returns a tuple with the Objective field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *TrainSpec) GetObjectiveOk() (*TrainObjective, bool) {
|
|
if o == nil || IsNil(o.Objective) {
|
|
return nil, false
|
|
}
|
|
return o.Objective, true
|
|
}
|
|
|
|
// HasObjective returns a boolean if a field has been set.
|
|
func (o *TrainSpec) HasObjective() bool {
|
|
if o != nil && !IsNil(o.Objective) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetObjective gets a reference to the given TrainObjective and assigns it to the Objective field.
|
|
func (o *TrainSpec) SetObjective(v TrainObjective) {
|
|
o.Objective = &v
|
|
}
|
|
|
|
// GetOutput returns the Output field value if set, zero value otherwise.
|
|
func (o *TrainSpec) GetOutput() TrainOutput {
|
|
if o == nil || IsNil(o.Output) {
|
|
var ret TrainOutput
|
|
return ret
|
|
}
|
|
return *o.Output
|
|
}
|
|
|
|
// GetOutputOk returns a tuple with the Output field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *TrainSpec) GetOutputOk() (*TrainOutput, bool) {
|
|
if o == nil || IsNil(o.Output) {
|
|
return nil, false
|
|
}
|
|
return o.Output, true
|
|
}
|
|
|
|
// HasOutput returns a boolean if a field has been set.
|
|
func (o *TrainSpec) HasOutput() bool {
|
|
if o != nil && !IsNil(o.Output) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetOutput gets a reference to the given TrainOutput and assigns it to the Output field.
|
|
func (o *TrainSpec) SetOutput(v TrainOutput) {
|
|
o.Output = &v
|
|
}
|
|
|
|
// GetProtect returns the Protect field value if set, zero value otherwise.
|
|
func (o *TrainSpec) GetProtect() TrainProtect {
|
|
if o == nil || IsNil(o.Protect) {
|
|
var ret TrainProtect
|
|
return ret
|
|
}
|
|
return *o.Protect
|
|
}
|
|
|
|
// GetProtectOk returns a tuple with the Protect field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *TrainSpec) GetProtectOk() (*TrainProtect, bool) {
|
|
if o == nil || IsNil(o.Protect) {
|
|
return nil, false
|
|
}
|
|
return o.Protect, true
|
|
}
|
|
|
|
// HasProtect returns a boolean if a field has been set.
|
|
func (o *TrainSpec) HasProtect() bool {
|
|
if o != nil && !IsNil(o.Protect) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetProtect gets a reference to the given TrainProtect and assigns it to the Protect field.
|
|
func (o *TrainSpec) SetProtect(v TrainProtect) {
|
|
o.Protect = &v
|
|
}
|
|
|
|
// GetResources returns the Resources field value if set, zero value otherwise.
|
|
func (o *TrainSpec) GetResources() TrainResources {
|
|
if o == nil || IsNil(o.Resources) {
|
|
var ret TrainResources
|
|
return ret
|
|
}
|
|
return *o.Resources
|
|
}
|
|
|
|
// GetResourcesOk returns a tuple with the Resources field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *TrainSpec) GetResourcesOk() (*TrainResources, bool) {
|
|
if o == nil || IsNil(o.Resources) {
|
|
return nil, false
|
|
}
|
|
return o.Resources, true
|
|
}
|
|
|
|
// HasResources returns a boolean if a field has been set.
|
|
func (o *TrainSpec) HasResources() bool {
|
|
if o != nil && !IsNil(o.Resources) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetResources gets a reference to the given TrainResources and assigns it to the Resources field.
|
|
func (o *TrainSpec) SetResources(v TrainResources) {
|
|
o.Resources = &v
|
|
}
|
|
|
|
// GetRevision returns the Revision field value if set, zero value otherwise.
|
|
func (o *TrainSpec) GetRevision() string {
|
|
if o == nil || IsNil(o.Revision) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Revision
|
|
}
|
|
|
|
// GetRevisionOk returns a tuple with the Revision field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *TrainSpec) GetRevisionOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Revision) {
|
|
return nil, false
|
|
}
|
|
return o.Revision, true
|
|
}
|
|
|
|
// HasRevision returns a boolean if a field has been set.
|
|
func (o *TrainSpec) HasRevision() bool {
|
|
if o != nil && !IsNil(o.Revision) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetRevision gets a reference to the given string and assigns it to the Revision field.
|
|
func (o *TrainSpec) SetRevision(v string) {
|
|
o.Revision = &v
|
|
}
|
|
|
|
func (o TrainSpec) MarshalJSON() ([]byte, error) {
|
|
toSerialize, err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o TrainSpec) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if !IsNil(o.Adaptation) {
|
|
toSerialize["adaptation"] = o.Adaptation
|
|
}
|
|
if !IsNil(o.BaseModel) {
|
|
toSerialize["base_model"] = o.BaseModel
|
|
}
|
|
if !IsNil(o.Dataset) {
|
|
toSerialize["dataset"] = o.Dataset
|
|
}
|
|
if !IsNil(o.Evaluation) {
|
|
toSerialize["evaluation"] = o.Evaluation
|
|
}
|
|
if !IsNil(o.From) {
|
|
toSerialize["from"] = o.From
|
|
}
|
|
if !IsNil(o.Objective) {
|
|
toSerialize["objective"] = o.Objective
|
|
}
|
|
if !IsNil(o.Output) {
|
|
toSerialize["output"] = o.Output
|
|
}
|
|
if !IsNil(o.Protect) {
|
|
toSerialize["protect"] = o.Protect
|
|
}
|
|
if !IsNil(o.Resources) {
|
|
toSerialize["resources"] = o.Resources
|
|
}
|
|
if !IsNil(o.Revision) {
|
|
toSerialize["revision"] = o.Revision
|
|
}
|
|
|
|
for key, value := range o.AdditionalProperties {
|
|
toSerialize[key] = value
|
|
}
|
|
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *TrainSpec) UnmarshalJSON(data []byte) (err error) {
|
|
varTrainSpec := _TrainSpec{}
|
|
|
|
err = json.Unmarshal(data, &varTrainSpec)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = TrainSpec(varTrainSpec)
|
|
|
|
additionalProperties := make(map[string]interface{})
|
|
|
|
if err = json.Unmarshal(data, &additionalProperties); err == nil {
|
|
delete(additionalProperties, "adaptation")
|
|
delete(additionalProperties, "base_model")
|
|
delete(additionalProperties, "dataset")
|
|
delete(additionalProperties, "evaluation")
|
|
delete(additionalProperties, "from")
|
|
delete(additionalProperties, "objective")
|
|
delete(additionalProperties, "output")
|
|
delete(additionalProperties, "protect")
|
|
delete(additionalProperties, "resources")
|
|
delete(additionalProperties, "revision")
|
|
o.AdditionalProperties = additionalProperties
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableTrainSpec struct {
|
|
value *TrainSpec
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableTrainSpec) Get() *TrainSpec {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableTrainSpec) Set(val *TrainSpec) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableTrainSpec) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableTrainSpec) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableTrainSpec(val *TrainSpec) *NullableTrainSpec {
|
|
return &NullableTrainSpec{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableTrainSpec) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableTrainSpec) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|