Files
sdk/model_train_adaptation.go

421 lines
11 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 TrainAdaptation type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TrainAdaptation{}
// TrainAdaptation struct for TrainAdaptation
type TrainAdaptation struct {
// Alpha is an adapter's scale.
Alpha *float64 `json:"alpha,omitempty"`
// Basis is a basis artifact, by sha256 or `basis://<base>/<name>`.
Basis *string `json:"basis,omitempty"`
// Chose is what auto resolved to and why; absent unless auto was asked.
Chose *TrainChose `json:"chose,omitempty"`
// Mode is full, readout (the head alone, over the frozen base), lora, qlora, basis or auto.
Mode *string `json:"mode,omitempty"`
// Rank is an adapter's rank, or how many of a basis's directions are used.
Rank *int64 `json:"rank,omitempty"`
// ResidualRank is the rank of an orthonormal residual learned beside a basis's coefficients; 0 trains the coefficients alone.
ResidualRank *int64 `json:"residual_rank,omitempty"`
// Sources are lora artifacts (sha256) a basis is built from, in place of Basis.
Sources []string `json:"sources,omitempty"`
// Targets are the modules an adapter or a basis attaches to.
Targets []string `json:"targets,omitempty"`
AdditionalProperties map[string]interface{}
}
type _TrainAdaptation TrainAdaptation
// NewTrainAdaptation instantiates a new TrainAdaptation 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 NewTrainAdaptation() *TrainAdaptation {
this := TrainAdaptation{}
return &this
}
// NewTrainAdaptationWithDefaults instantiates a new TrainAdaptation 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 NewTrainAdaptationWithDefaults() *TrainAdaptation {
this := TrainAdaptation{}
return &this
}
// GetAlpha returns the Alpha field value if set, zero value otherwise.
func (o *TrainAdaptation) GetAlpha() float64 {
if o == nil || IsNil(o.Alpha) {
var ret float64
return ret
}
return *o.Alpha
}
// GetAlphaOk returns a tuple with the Alpha field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainAdaptation) GetAlphaOk() (*float64, bool) {
if o == nil || IsNil(o.Alpha) {
return nil, false
}
return o.Alpha, true
}
// HasAlpha returns a boolean if a field has been set.
func (o *TrainAdaptation) HasAlpha() bool {
if o != nil && !IsNil(o.Alpha) {
return true
}
return false
}
// SetAlpha gets a reference to the given float64 and assigns it to the Alpha field.
func (o *TrainAdaptation) SetAlpha(v float64) {
o.Alpha = &v
}
// GetBasis returns the Basis field value if set, zero value otherwise.
func (o *TrainAdaptation) GetBasis() string {
if o == nil || IsNil(o.Basis) {
var ret string
return ret
}
return *o.Basis
}
// GetBasisOk returns a tuple with the Basis field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainAdaptation) GetBasisOk() (*string, bool) {
if o == nil || IsNil(o.Basis) {
return nil, false
}
return o.Basis, true
}
// HasBasis returns a boolean if a field has been set.
func (o *TrainAdaptation) HasBasis() bool {
if o != nil && !IsNil(o.Basis) {
return true
}
return false
}
// SetBasis gets a reference to the given string and assigns it to the Basis field.
func (o *TrainAdaptation) SetBasis(v string) {
o.Basis = &v
}
// GetChose returns the Chose field value if set, zero value otherwise.
func (o *TrainAdaptation) GetChose() TrainChose {
if o == nil || IsNil(o.Chose) {
var ret TrainChose
return ret
}
return *o.Chose
}
// GetChoseOk returns a tuple with the Chose field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainAdaptation) GetChoseOk() (*TrainChose, bool) {
if o == nil || IsNil(o.Chose) {
return nil, false
}
return o.Chose, true
}
// HasChose returns a boolean if a field has been set.
func (o *TrainAdaptation) HasChose() bool {
if o != nil && !IsNil(o.Chose) {
return true
}
return false
}
// SetChose gets a reference to the given TrainChose and assigns it to the Chose field.
func (o *TrainAdaptation) SetChose(v TrainChose) {
o.Chose = &v
}
// GetMode returns the Mode field value if set, zero value otherwise.
func (o *TrainAdaptation) GetMode() string {
if o == nil || IsNil(o.Mode) {
var ret string
return ret
}
return *o.Mode
}
// GetModeOk returns a tuple with the Mode field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainAdaptation) GetModeOk() (*string, bool) {
if o == nil || IsNil(o.Mode) {
return nil, false
}
return o.Mode, true
}
// HasMode returns a boolean if a field has been set.
func (o *TrainAdaptation) HasMode() bool {
if o != nil && !IsNil(o.Mode) {
return true
}
return false
}
// SetMode gets a reference to the given string and assigns it to the Mode field.
func (o *TrainAdaptation) SetMode(v string) {
o.Mode = &v
}
// GetRank returns the Rank field value if set, zero value otherwise.
func (o *TrainAdaptation) GetRank() int64 {
if o == nil || IsNil(o.Rank) {
var ret int64
return ret
}
return *o.Rank
}
// GetRankOk returns a tuple with the Rank field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainAdaptation) GetRankOk() (*int64, bool) {
if o == nil || IsNil(o.Rank) {
return nil, false
}
return o.Rank, true
}
// HasRank returns a boolean if a field has been set.
func (o *TrainAdaptation) HasRank() bool {
if o != nil && !IsNil(o.Rank) {
return true
}
return false
}
// SetRank gets a reference to the given int64 and assigns it to the Rank field.
func (o *TrainAdaptation) SetRank(v int64) {
o.Rank = &v
}
// GetResidualRank returns the ResidualRank field value if set, zero value otherwise.
func (o *TrainAdaptation) GetResidualRank() int64 {
if o == nil || IsNil(o.ResidualRank) {
var ret int64
return ret
}
return *o.ResidualRank
}
// GetResidualRankOk returns a tuple with the ResidualRank field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainAdaptation) GetResidualRankOk() (*int64, bool) {
if o == nil || IsNil(o.ResidualRank) {
return nil, false
}
return o.ResidualRank, true
}
// HasResidualRank returns a boolean if a field has been set.
func (o *TrainAdaptation) HasResidualRank() bool {
if o != nil && !IsNil(o.ResidualRank) {
return true
}
return false
}
// SetResidualRank gets a reference to the given int64 and assigns it to the ResidualRank field.
func (o *TrainAdaptation) SetResidualRank(v int64) {
o.ResidualRank = &v
}
// GetSources returns the Sources field value if set, zero value otherwise.
func (o *TrainAdaptation) GetSources() []string {
if o == nil || IsNil(o.Sources) {
var ret []string
return ret
}
return o.Sources
}
// GetSourcesOk returns a tuple with the Sources field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainAdaptation) GetSourcesOk() ([]string, bool) {
if o == nil || IsNil(o.Sources) {
return nil, false
}
return o.Sources, true
}
// HasSources returns a boolean if a field has been set.
func (o *TrainAdaptation) HasSources() bool {
if o != nil && !IsNil(o.Sources) {
return true
}
return false
}
// SetSources gets a reference to the given []string and assigns it to the Sources field.
func (o *TrainAdaptation) SetSources(v []string) {
o.Sources = v
}
// GetTargets returns the Targets field value if set, zero value otherwise.
func (o *TrainAdaptation) GetTargets() []string {
if o == nil || IsNil(o.Targets) {
var ret []string
return ret
}
return o.Targets
}
// GetTargetsOk returns a tuple with the Targets field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainAdaptation) GetTargetsOk() ([]string, bool) {
if o == nil || IsNil(o.Targets) {
return nil, false
}
return o.Targets, true
}
// HasTargets returns a boolean if a field has been set.
func (o *TrainAdaptation) HasTargets() bool {
if o != nil && !IsNil(o.Targets) {
return true
}
return false
}
// SetTargets gets a reference to the given []string and assigns it to the Targets field.
func (o *TrainAdaptation) SetTargets(v []string) {
o.Targets = v
}
func (o TrainAdaptation) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o TrainAdaptation) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Alpha) {
toSerialize["alpha"] = o.Alpha
}
if !IsNil(o.Basis) {
toSerialize["basis"] = o.Basis
}
if !IsNil(o.Chose) {
toSerialize["chose"] = o.Chose
}
if !IsNil(o.Mode) {
toSerialize["mode"] = o.Mode
}
if !IsNil(o.Rank) {
toSerialize["rank"] = o.Rank
}
if !IsNil(o.ResidualRank) {
toSerialize["residual_rank"] = o.ResidualRank
}
if !IsNil(o.Sources) {
toSerialize["sources"] = o.Sources
}
if !IsNil(o.Targets) {
toSerialize["targets"] = o.Targets
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *TrainAdaptation) UnmarshalJSON(data []byte) (err error) {
varTrainAdaptation := _TrainAdaptation{}
err = json.Unmarshal(data, &varTrainAdaptation)
if err != nil {
return err
}
*o = TrainAdaptation(varTrainAdaptation)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "alpha")
delete(additionalProperties, "basis")
delete(additionalProperties, "chose")
delete(additionalProperties, "mode")
delete(additionalProperties, "rank")
delete(additionalProperties, "residual_rank")
delete(additionalProperties, "sources")
delete(additionalProperties, "targets")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableTrainAdaptation struct {
value *TrainAdaptation
isSet bool
}
func (v NullableTrainAdaptation) Get() *TrainAdaptation {
return v.value
}
func (v *NullableTrainAdaptation) Set(val *TrainAdaptation) {
v.value = val
v.isSet = true
}
func (v NullableTrainAdaptation) IsSet() bool {
return v.isSet
}
func (v *NullableTrainAdaptation) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTrainAdaptation(val *TrainAdaptation) *NullableTrainAdaptation {
return &NullableTrainAdaptation{value: val, isSet: true}
}
func (v NullableTrainAdaptation) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTrainAdaptation) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}