Skip to content

Commit 82833b7

Browse files
Merge pull request #255 from kerthcet/cleanup/update-flavor-field
Rename inferenceFlavorClaims to inferenceFlavors
2 parents e452f84 + da1eaf3 commit 82833b7

File tree

14 files changed

+44
-44
lines changed

14 files changed

+44
-44
lines changed

api/core/v1alpha1/model_types.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,12 @@ type ModelName string
139139
type ModelClaim struct {
140140
// ModelName represents the name of the Model.
141141
ModelName ModelName `json:"modelName,omitempty"`
142-
// InferenceFlavorClaims represents a list of flavors with fungibility support
142+
// InferenceFlavors represents a list of flavors with fungibility support
143143
// to serve the model.
144144
// If set, The flavor names should be a subset of the model configured flavors.
145145
// If not set, Model configured flavors will be used by default.
146146
// +optional
147-
InferenceFlavorClaims []FlavorName `json:"inferenceFlavorClaims,omitempty"`
147+
InferenceFlavors []FlavorName `json:"inferenceFlavors,omitempty"`
148148
}
149149

150150
type ModelRole string
@@ -182,12 +182,12 @@ type ModelClaims struct {
182182
// is draft model.
183183
// +kubebuilder:validation:MinItems=1
184184
Models []ModelRef `json:"models,omitempty"`
185-
// InferenceFlavorClaims represents a list of flavors with fungibility supported
185+
// InferenceFlavors represents a list of flavor names with fungibility supported
186186
// to serve the model.
187187
// - If not set, always apply with the 0-index model by default.
188188
// - If set, will lookup the flavor names following the model orders.
189189
// +optional
190-
InferenceFlavorClaims []FlavorName `json:"inferenceFlavorClaims,omitempty"`
190+
InferenceFlavors []FlavorName `json:"inferenceFlavors,omitempty"`
191191
}
192192

193193
// ModelSpec defines the desired state of Model

api/core/v1alpha1/zz_generated.deepcopy.go

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/applyconfiguration/core/v1alpha1/modelclaim.go

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/applyconfiguration/core/v1alpha1/modelclaims.go

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/inference.llmaz.io_playgrounds.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -880,9 +880,9 @@ spec:
880880
of modelClaims. Most of the time, modelClaim is enough.
881881
ModelClaim and modelClaims are exclusive configured.
882882
properties:
883-
inferenceFlavorClaims:
883+
inferenceFlavors:
884884
description: |-
885-
InferenceFlavorClaims represents a list of flavors with fungibility support
885+
InferenceFlavors represents a list of flavors with fungibility support
886886
to serve the model.
887887
If set, The flavor names should be a subset of the model configured flavors.
888888
If not set, Model configured flavors will be used by default.
@@ -899,9 +899,9 @@ spec:
899899
use cases like speculative-decoding.
900900
ModelClaims and modelClaim are exclusive configured.
901901
properties:
902-
inferenceFlavorClaims:
902+
inferenceFlavors:
903903
description: |-
904-
InferenceFlavorClaims represents a list of flavors with fungibility supported
904+
InferenceFlavors represents a list of flavor names with fungibility supported
905905
to serve the model.
906906
- If not set, always apply with the 0-index model by default.
907907
- If set, will lookup the flavor names following the model orders.

config/crd/bases/inference.llmaz.io_services.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ spec:
4848
description: ModelClaims represents multiple claims for different
4949
models.
5050
properties:
51-
inferenceFlavorClaims:
51+
inferenceFlavors:
5252
description: |-
53-
InferenceFlavorClaims represents a list of flavors with fungibility supported
53+
InferenceFlavors represents a list of flavor names with fungibility supported
5454
to serve the model.
5555
- If not set, always apply with the 0-index model by default.
5656
- If set, will lookup the flavor names following the model orders.

docs/examples/multi-nodes/playground.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ spec:
66
replicas: 1
77
modelClaim:
88
modelName: llama3-405b-instruct
9-
inferenceFlavorClaims:
9+
inferenceFlavors:
1010
- a100-80gb # actually no need to specify this since we have only one flavor
1111
backendRuntimeConfig:
1212
resources:

pkg/controller/inference/playground_controller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func buildServiceApplyConfiguration(models []*coreapi.OpenModel, playground *inf
207207
if playground.Spec.ModelClaim != nil {
208208
claim = coreclientgo.ModelClaims().
209209
WithModels(coreclientgo.ModelRef().WithName(playground.Spec.ModelClaim.ModelName).WithRole(coreapi.MainRole)).
210-
WithInferenceFlavorClaims(playground.Spec.ModelClaim.InferenceFlavorClaims...)
210+
WithInferenceFlavors(playground.Spec.ModelClaim.InferenceFlavors...)
211211
} else {
212212
mrs := []*coreclientgo.ModelRefApplyConfiguration{}
213213
for _, model := range playground.Spec.ModelClaims.Models {
@@ -221,7 +221,7 @@ func buildServiceApplyConfiguration(models []*coreapi.OpenModel, playground *inf
221221

222222
claim = coreclientgo.ModelClaims().
223223
WithModels(mrs...).
224-
WithInferenceFlavorClaims(playground.Spec.ModelClaims.InferenceFlavorClaims...)
224+
WithInferenceFlavors(playground.Spec.ModelClaims.InferenceFlavors...)
225225
}
226226

227227
spec.WithModelClaims(claim)

pkg/controller/inference/service_controller.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ func injectModelFlavor(template *corev1.PodTemplateSpec, model *coreapi.OpenMode
187187
}
188188

189189
flavorName := model.Spec.InferenceConfig.Flavors[0].Name
190-
if len(service.Spec.ModelClaims.InferenceFlavorClaims) > 0 {
190+
if len(service.Spec.ModelClaims.InferenceFlavors) > 0 {
191191
// We only support the same resource request right now, so 0-index flavor is enough.
192-
flavorName = service.Spec.ModelClaims.InferenceFlavorClaims[0]
192+
flavorName = service.Spec.ModelClaims.InferenceFlavors[0]
193193
}
194194

195195
for i, flavor := range model.Spec.InferenceConfig.Flavors {
@@ -222,8 +222,8 @@ func modelLabels(model *coreapi.OpenModel) map[string]string {
222222

223223
func modelAnnotations(service *inferenceapi.Service) map[string]string {
224224
var values string
225-
for i, value := range service.Spec.ModelClaims.InferenceFlavorClaims {
226-
if i == len(service.Spec.ModelClaims.InferenceFlavorClaims)-1 {
225+
for i, value := range service.Spec.ModelClaims.InferenceFlavors {
226+
if i == len(service.Spec.ModelClaims.InferenceFlavors)-1 {
227227
values += string(value)
228228
} else {
229229
values += string(value) + ","

pkg/controller_helper/helper.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ func fetchModels(ctx context.Context, k8sClient client.Client, mrs []coreapi.Mod
9595
func FirstAssignedFlavor(model *coreapi.OpenModel, playground *inferenceapi.Playground) []coreapi.Flavor {
9696
var flavors []coreapi.FlavorName
9797
if playground.Spec.ModelClaim != nil {
98-
flavors = playground.Spec.ModelClaim.InferenceFlavorClaims
98+
flavors = playground.Spec.ModelClaim.InferenceFlavors
9999
} else {
100-
flavors = playground.Spec.ModelClaims.InferenceFlavorClaims
100+
flavors = playground.Spec.ModelClaims.InferenceFlavors
101101
}
102102

103103
if len(flavors) == 0 && (model.Spec.InferenceConfig == nil || len(model.Spec.InferenceConfig.Flavors) == 0) {

test/util/validation/validate_playground.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ func validateModelClaim(models []*coreapi.OpenModel, playground *inferenceapi.Pl
4545
if playground.Spec.ModelClaim.ModelName != service.Spec.ModelClaims.Models[0].Name {
4646
return fmt.Errorf("expected modelName %s, got %s", playground.Spec.ModelClaim.ModelName, service.Spec.ModelClaims.Models[0].Name)
4747
}
48-
if diff := cmp.Diff(playground.Spec.ModelClaim.InferenceFlavorClaims, service.Spec.ModelClaims.InferenceFlavorClaims); diff != "" {
49-
return fmt.Errorf("unexpected flavors, want %v, got %v", playground.Spec.ModelClaim.InferenceFlavorClaims, service.Spec.ModelClaims.InferenceFlavorClaims)
48+
if diff := cmp.Diff(playground.Spec.ModelClaim.InferenceFlavors, service.Spec.ModelClaims.InferenceFlavors); diff != "" {
49+
return fmt.Errorf("unexpected flavors, want %v, got %v", playground.Spec.ModelClaim.InferenceFlavors, service.Spec.ModelClaims.InferenceFlavors)
5050
}
5151
} else if playground.Spec.ModelClaims != nil {
5252
if diff := cmp.Diff(*playground.Spec.ModelClaims, service.Spec.ModelClaims); diff != "" {
5353
return fmt.Errorf("expected modelClaims, want %v, got %v", *playground.Spec.ModelClaims, service.Spec.ModelClaims)
5454
}
55-
if diff := cmp.Diff(playground.Spec.ModelClaims.InferenceFlavorClaims, service.Spec.ModelClaims.InferenceFlavorClaims); diff != "" {
56-
return fmt.Errorf("unexpected flavors, want %v, got %v", playground.Spec.ModelClaim.InferenceFlavorClaims, service.Spec.ModelClaims.InferenceFlavorClaims)
55+
if diff := cmp.Diff(playground.Spec.ModelClaims.InferenceFlavors, service.Spec.ModelClaims.InferenceFlavors); diff != "" {
56+
return fmt.Errorf("unexpected flavors, want %v, got %v", playground.Spec.ModelClaim.InferenceFlavors, service.Spec.ModelClaims.InferenceFlavors)
5757
}
5858
}
5959

test/util/validation/validate_service.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ func ValidateModelLoader(model *coreapi.OpenModel, index int, template corev1.Po
164164

165165
func ValidateModelFlavor(service *inferenceapi.Service, model *coreapi.OpenModel, workload *lws.LeaderWorkerSet) error {
166166
flavorName := model.Spec.InferenceConfig.Flavors[0].Name
167-
if len(service.Spec.ModelClaims.InferenceFlavorClaims) > 0 {
168-
flavorName = service.Spec.ModelClaims.InferenceFlavorClaims[0]
167+
if len(service.Spec.ModelClaims.InferenceFlavors) > 0 {
168+
flavorName = service.Spec.ModelClaims.InferenceFlavors[0]
169169
}
170170

171171
for _, flavor := range model.Spec.InferenceConfig.Flavors {

test/util/wrapper/playground.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func (w *PlaygroundWrapper) ModelClaim(modelName string, flavorNames ...string)
6767
}
6868

6969
if len(names) > 0 {
70-
w.Spec.ModelClaim.InferenceFlavorClaims = names
70+
w.Spec.ModelClaim.InferenceFlavors = names
7171
}
7272
return w
7373
}
@@ -87,7 +87,7 @@ func (w *PlaygroundWrapper) ModelClaims(modelNames []string, roles []string, fla
8787
}
8888

8989
if len(fNames) > 0 {
90-
w.Spec.ModelClaims.InferenceFlavorClaims = fNames
90+
w.Spec.ModelClaims.InferenceFlavors = fNames
9191
}
9292
return w
9393
}

test/util/wrapper/service.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func (w *ServiceWrapper) ModelClaims(modelNames []string, roles []string, flavor
5959
}
6060

6161
if len(fNames) > 0 {
62-
w.Spec.ModelClaims.InferenceFlavorClaims = fNames
62+
w.Spec.ModelClaims.InferenceFlavors = fNames
6363
}
6464
return w
6565
}

0 commit comments

Comments
 (0)