Skip to content

Commit

Permalink
add hyperparameterconfigurations
Browse files Browse the repository at this point in the history
  • Loading branch information
justadogistaken committed Apr 22, 2024
1 parent 9edab1e commit f5b0269
Show file tree
Hide file tree
Showing 6 changed files with 385 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.0
creationTimestamp: null
name: hyperparameterconfigurations.config.katalyst.kubewharf.io
spec:
group: config.katalyst.kubewharf.io
names:
kind: HyperParameterConfiguration
listKind: HyperParameterConfigurationList
plural: hyperparameterconfigurations
shortNames:
- hpc
singular: hyperparameterconfiguration
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .metadata.creationTimestamp
name: AGE
type: date
- jsonPath: .spec.nodeLabelSelector
name: SELECTOR
type: string
- jsonPath: .spec.priority
name: PRIORITY
type: string
- jsonPath: .spec.ephemeralSelector.nodeNames
name: NODES
type: string
- jsonPath: .spec.ephemeralSelector.lastDuration
name: DURATION
type: string
- jsonPath: .status.conditions[?(@.type=="Valid")].status
name: VALID
type: string
- jsonPath: .status.conditions[?(@.type=="Valid")].reason
name: REASON
type: string
- jsonPath: .status.conditions[?(@.type=="Valid")].message
name: MESSAGE
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: HyperParameterConfiguration is the Schema for the hyperparameterconfigurations
API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: HyperParameterConfigurationSpec defines the desired state
of HyperParameterConfiguration
properties:
config:
properties:
borweinProvisionConfig:
description: BorweinProvisionConfig is configuration related to
Borwein provision policy
properties:
borweinProvisionParams:
description: BorweinProvisionParams is the list of parameter
set for Borwein provision policy
items:
properties:
indicatorTargetOffsetMax:
type: number
indicatorTargetOffsetMin:
type: number
indicatorTargetRampDownStep:
type: number
indicatorTargetRampUpStep:
type: number
modelAbnormalRatioThreshold:
type: number
paramID:
type: integer
paramVersion:
type: integer
type: object
type: array
type: object
type: object
type: object
status:
properties:
collisionCount:
description: Count of hash collisions for this cr. The kcc controller
uses this field as a collision avoidance mechanism when it needs
to create the name for the newest ControllerRevision.
format: int32
type: integer
conditions:
description: Represents the latest available observations of a config's
current state.
items:
properties:
lastTransitionTime:
description: Last time the condition transit from one status
to another.
format: date-time
type: string
message:
description: message is a human-readable explanation containing
details about the transition
type: string
reason:
description: reason is the reason for the condition's last transition.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
type: string
type:
description: Type of config condition
type: string
required:
- status
- type
type: object
type: array
observedGeneration:
description: The most recent generation observed by the kcc controller.
format: int64
type: integer
type: object
type: object
served: true
storage: true
subresources:
status: {}
91 changes: 91 additions & 0 deletions pkg/apis/config/v1alpha1/hpc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
Copyright 2022 The Katalyst Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:resource:path=hyperparameterconfigurations,shortName=hpc
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=.metadata.creationTimestamp
// +kubebuilder:printcolumn:name="SELECTOR",type=string,JSONPath=".spec.nodeLabelSelector"
// +kubebuilder:printcolumn:name="PRIORITY",type=string,JSONPath=".spec.priority"
// +kubebuilder:printcolumn:name="NODES",type=string,JSONPath=".spec.ephemeralSelector.nodeNames"
// +kubebuilder:printcolumn:name="DURATION",type=string,JSONPath=".spec.ephemeralSelector.lastDuration"
// +kubebuilder:printcolumn:name="VALID",type=string,JSONPath=".status.conditions[?(@.type==\"Valid\")].status"
// +kubebuilder:printcolumn:name="REASON",type=string,JSONPath=".status.conditions[?(@.type==\"Valid\")].reason"
// +kubebuilder:printcolumn:name="MESSAGE",type=string,JSONPath=".status.conditions[?(@.type==\"Valid\")].message"

// HyperParameterConfiguration is the Schema for the hyperparameterconfigurations API
type HyperParameterConfiguration struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec HyperParameterConfigurationSpec `json:"spec,omitempty"`
Status GenericConfigStatus `json:"status,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true

// HyperParameterConfigurationList contains a list of HyperParameterConfiguration
type HyperParameterConfigurationList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`

Items []HyperParameterConfiguration `json:"items"`
}

// HyperParameterConfigurationSpec defines the desired state of HyperParameterConfiguration
type HyperParameterConfigurationSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

Config HyperParameterConfig `json:"config,omitempty"`
}

type BorweinProvisionParam struct {
// +optional
ModelAbnormalRatioThreshold float64 `json:"modelAbnormalRatioThreshold,omitempty"`
// +optional
IndicatorTargetOffsetMax float64 `json:"indicatorTargetOffsetMax,omitempty"`
// +optional
IndicatorTargetOffsetMin float64 `json:"indicatorTargetOffsetMin,omitempty"`
// +optional
IndicatorTargetRampUpStep float64 `json:"indicatorTargetRampUpStep,omitempty"`
// +optional
IndicatorTargetRampDownStep float64 `json:"indicatorTargetRampDownStep,omitempty"`
// +optional
ParamVersion int `json:"paramVersion,omitempty"`
// +optional
ParamID int `json:"paramID,omitempty"`
}

type BorweinProvisionConfig struct {
// BorweinProvisionParams is the list of parameter set for Borwein provision policy
// +optional
BorweinProvisionParams []BorweinProvisionParam `json:"borweinProvisionParams,omitempty"`
}

type HyperParameterConfig struct {
// BorweinProvisionConfig is configuration related to Borwein provision policy
// +optional
BorweinProvisionConfig *BorweinProvisionConfig `json:"borweinProvisionConfig,omitempty"`
}
2 changes: 2 additions & 0 deletions pkg/apis/config/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&AuthConfigurationList{},
&TransparentMemoryOffloadingConfiguration{},
&TransparentMemoryOffloadingConfigurationList{},
&HyperParameterConfiguration{},
&HyperParameterConfigurationList{},
)

metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
Expand Down
136 changes: 136 additions & 0 deletions pkg/apis/config/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f5b0269

Please sign in to comment.