Skip to content

Commit f8b1f7c

Browse files
Merge pull request #176 from kerthcet/cleanup/update-installation
Update Revision default to main
2 parents ed1556f + 6cb79c9 commit f8b1f7c

File tree

8 files changed

+25
-21
lines changed

8 files changed

+25
-21
lines changed

api/core/v1alpha1/model_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type ModelHub struct {
4646
// in the near future.
4747
Filename *string `json:"filename,omitempty"`
4848
// Revision refers to a Git revision id which can be a branch name, a tag, or a commit hash.
49-
// Most of the time, you don't need to specify it.
49+
// +kubebuilder:default=main
5050
// +optional
5151
Revision *string `json:"revision,omitempty"`
5252
}

config/crd/bases/llmaz.io_openmodels.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ spec:
130130
- ModelScope
131131
type: string
132132
revision:
133-
description: |-
134-
Revision refers to a Git revision id which can be a branch name, a tag, or a commit hash.
135-
Most of the time, you don't need to specify it.
133+
default: main
134+
description: Revision refers to a Git revision id which can
135+
be a branch name, a tag, or a commit hash.
136136
type: string
137137
type: object
138138
uri:

pkg/controller_helper/model_source/modelsource_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func Test_ModelSourceProvider(t *testing.T) {
3939
},
4040
{
4141
name: "modelhub with GGUF file",
42-
model: wrapper.MakeModel("test-7b").FamilyName("test").ModelSourceWithModelHub("Huggingface").ModelSourceWithModelID("Qwen/Qwen2-0.5B-Instruct-GGUF", "qwen2-0_5b-instruct-q5_k_m.gguf").Obj(),
42+
model: wrapper.MakeModel("test-7b").FamilyName("test").ModelSourceWithModelHub("Huggingface").ModelSourceWithModelID("Qwen/Qwen2-0.5B-Instruct-GGUF", "qwen2-0_5b-instruct-q5_k_m.gguf", "").Obj(),
4343
wantModelName: "test-7b",
4444
wantModelPath: "/workspace/models/qwen2-0_5b-instruct-q5_k_m.gguf",
4545
},

test/e2e/playground_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var _ = ginkgo.Describe("playground e2e tests", func() {
4848
})
4949

5050
ginkgo.It("Deploy a huggingface model with llama.cpp", func() {
51-
model := wrapper.MakeModel("qwen2-0-5b-gguf").FamilyName("qwen2").ModelSourceWithModelHub("Huggingface").ModelSourceWithModelID("Qwen/Qwen2-0.5B-Instruct-GGUF", "qwen2-0_5b-instruct-q5_k_m.gguf").Obj()
51+
model := wrapper.MakeModel("qwen2-0-5b-gguf").FamilyName("qwen2").ModelSourceWithModelHub("Huggingface").ModelSourceWithModelID("Qwen/Qwen2-0.5B-Instruct-GGUF", "qwen2-0_5b-instruct-q5_k_m.gguf", "").Obj()
5252
gomega.Expect(k8sClient.Create(ctx, model)).To(gomega.Succeed())
5353
defer func() {
5454
gomega.Expect(k8sClient.Delete(ctx, model)).To(gomega.Succeed())
@@ -73,7 +73,7 @@ var _ = ginkgo.Describe("playground e2e tests", func() {
7373
Request("cpu", "2").Request("memory", "4Gi").Limit("cpu", "4").Limit("memory", "4Gi").Obj()
7474
gomega.Expect(k8sClient.Create(ctx, backendRuntime)).To(gomega.Succeed())
7575

76-
model := wrapper.MakeModel("qwen2-0-5b-gguf").FamilyName("qwen2").ModelSourceWithModelHub("Huggingface").ModelSourceWithModelID("Qwen/Qwen2-0.5B-Instruct-GGUF", "qwen2-0_5b-instruct-q5_k_m.gguf").Obj()
76+
model := wrapper.MakeModel("qwen2-0-5b-gguf").FamilyName("qwen2").ModelSourceWithModelHub("Huggingface").ModelSourceWithModelID("Qwen/Qwen2-0.5B-Instruct-GGUF", "qwen2-0_5b-instruct-q5_k_m.gguf", "").Obj()
7777
gomega.Expect(k8sClient.Create(ctx, model)).To(gomega.Succeed())
7878
defer func() {
7979
gomega.Expect(k8sClient.Delete(ctx, model)).To(gomega.Succeed())
@@ -92,12 +92,12 @@ var _ = ginkgo.Describe("playground e2e tests", func() {
9292
})
9393
// TODO: add e2e tests.
9494
// ginkgo.It("SpeculativeDecoding with llama.cpp", func() {
95-
// targetModel := wrapper.MakeModel("llama2-7b-q8-gguf").FamilyName("llama2").ModelSourceWithModelHub("Huggingface").ModelSourceWithModelID("TheBloke/Llama-2-7B-GGUF", "llama-2-7b.Q8_0.gguf").Obj()
95+
// targetModel := wrapper.MakeModel("llama2-7b-q8-gguf").FamilyName("llama2").ModelSourceWithModelHub("Huggingface").ModelSourceWithModelID("TheBloke/Llama-2-7B-GGUF", "llama-2-7b.Q8_0.gguf", "").Obj()
9696
// gomega.Expect(k8sClient.Create(ctx, targetModel)).To(gomega.Succeed())
9797
// defer func() {
9898
// gomega.Expect(k8sClient.Delete(ctx, targetModel)).To(gomega.Succeed())
9999
// }()
100-
// draftModel := wrapper.MakeModel("llama2-7b-q2-k-gguf").FamilyName("llama2").ModelSourceWithModelHub("Huggingface").ModelSourceWithModelID("TheBloke/Llama-2-7B-GGUF", "llama-2-7b.Q2_K.gguf").Obj()
100+
// draftModel := wrapper.MakeModel("llama2-7b-q2-k-gguf").FamilyName("llama2").ModelSourceWithModelHub("Huggingface").ModelSourceWithModelID("TheBloke/Llama-2-7B-GGUF", "llama-2-7b.Q2_K.gguf", "").Obj()
101101
// gomega.Expect(k8sClient.Create(ctx, draftModel)).To(gomega.Succeed())
102102
// defer func() {
103103
// gomega.Expect(k8sClient.Delete(ctx, draftModel)).To(gomega.Succeed())

test/integration/controller/inference/playground_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ var _ = ginkgo.Describe("playground controller test", func() {
5757
gomega.Expect(k8sClient.Create(ctx, ns)).To(gomega.Succeed())
5858
model = util.MockASampleModel()
5959
gomega.Expect(k8sClient.Create(ctx, model)).To(gomega.Succeed())
60-
draftModel = wrapper.MakeModel("llama3-2b").FamilyName("llama3").ModelSourceWithModelHub("Huggingface").ModelSourceWithModelID("meta-llama/Meta-Llama-3-2B", "").Obj()
60+
draftModel = wrapper.MakeModel("llama3-2b").FamilyName("llama3").ModelSourceWithModelHub("Huggingface").ModelSourceWithModelID("meta-llama/Meta-Llama-3-2B", "", "").Obj()
6161
gomega.Expect(k8sClient.Create(ctx, draftModel)).To(gomega.Succeed())
6262
})
6363
ginkgo.AfterEach(func() {

test/integration/webhook/model_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,18 @@ var _ = ginkgo.Describe("model default and validation", func() {
5252
},
5353
ginkgo.Entry("apply model family name", &testDefaultingCase{
5454
model: func() *coreapi.OpenModel {
55-
return wrapper.MakeModel("llama3-8b").ModelSourceWithModelID("meta-llama/Meta-Llama-3-8B", "").FamilyName("llama3").Obj()
55+
return wrapper.MakeModel("llama3-8b").ModelSourceWithModelID("meta-llama/Meta-Llama-3-8B", "", "").FamilyName("llama3").Obj()
5656
},
5757
wantModel: func() *coreapi.OpenModel {
58-
return wrapper.MakeModel("llama3-8b").ModelSourceWithModelID("meta-llama/Meta-Llama-3-8B", "").ModelSourceWithModelHub("Huggingface").FamilyName("llama3").Label(coreapi.ModelFamilyNameLabelKey, "llama3").Obj()
58+
return wrapper.MakeModel("llama3-8b").ModelSourceWithModelID("meta-llama/Meta-Llama-3-8B", "", "main").ModelSourceWithModelHub("Huggingface").FamilyName("llama3").Label(coreapi.ModelFamilyNameLabelKey, "llama3").Obj()
5959
},
6060
}),
6161
ginkgo.Entry("apply modelscope model hub name", &testDefaultingCase{
6262
model: func() *coreapi.OpenModel {
63-
return wrapper.MakeModel("llama3-8b").FamilyName("llama3").ModelSourceWithModelHub("ModelScope").ModelSourceWithModelID("LLM-Research/Meta-Llama-3-8B", "").Obj()
63+
return wrapper.MakeModel("llama3-8b").FamilyName("llama3").ModelSourceWithModelHub("ModelScope").ModelSourceWithModelID("LLM-Research/Meta-Llama-3-8B", "", "").Obj()
6464
},
6565
wantModel: func() *coreapi.OpenModel {
66-
return wrapper.MakeModel("llama3-8b").ModelSourceWithModelID("LLM-Research/Meta-Llama-3-8B", "").ModelSourceWithModelHub("ModelScope").FamilyName("llama3").Label(coreapi.ModelFamilyNameLabelKey, "llama3").Obj()
66+
return wrapper.MakeModel("llama3-8b").ModelSourceWithModelID("LLM-Research/Meta-Llama-3-8B", "", "main").ModelSourceWithModelHub("ModelScope").FamilyName("llama3").Label(coreapi.ModelFamilyNameLabelKey, "llama3").Obj()
6767
},
6868
}),
6969
)
@@ -83,19 +83,19 @@ var _ = ginkgo.Describe("model default and validation", func() {
8383
},
8484
ginkgo.Entry("default normal huggingface model creation", &testValidatingCase{
8585
model: func() *coreapi.OpenModel {
86-
return wrapper.MakeModel("llama3-8b").FamilyName("llama3").ModelSourceWithModelID("meta-llama/Meta-Llama-3-8B", "").Obj()
86+
return wrapper.MakeModel("llama3-8b").FamilyName("llama3").ModelSourceWithModelID("meta-llama/Meta-Llama-3-8B", "", "").Obj()
8787
},
8888
failed: false,
8989
}),
9090
ginkgo.Entry("normal modelScope model creation", &testValidatingCase{
9191
model: func() *coreapi.OpenModel {
92-
return wrapper.MakeModel("llama3-8b").FamilyName("llama3").ModelSourceWithModelHub("ModelScope").ModelSourceWithModelID("LLM-Research/Meta-Llama-3-8B", "").Obj()
92+
return wrapper.MakeModel("llama3-8b").FamilyName("llama3").ModelSourceWithModelHub("ModelScope").ModelSourceWithModelID("LLM-Research/Meta-Llama-3-8B", "", "").Obj()
9393
},
9494
failed: false,
9595
}),
9696
ginkgo.Entry("invalid model name", &testValidatingCase{
9797
model: func() *coreapi.OpenModel {
98-
return wrapper.MakeModel("qwen-2-0.5b").FamilyName("qwen2").ModelSourceWithModelID("Qwen/Qwen2-0.5B-Instruct", "").Obj()
98+
return wrapper.MakeModel("qwen-2-0.5b").FamilyName("qwen2").ModelSourceWithModelID("Qwen/Qwen2-0.5B-Instruct", "", "").Obj()
9999
},
100100
failed: true,
101101
}),
@@ -131,13 +131,13 @@ var _ = ginkgo.Describe("model default and validation", func() {
131131
}),
132132
ginkgo.Entry("set filename when modelHub is Huggingface", &testValidatingCase{
133133
model: func() *coreapi.OpenModel {
134-
return wrapper.MakeModel("llama3-8b").ModelSourceWithModelID("Qwen/Qwen2-0.5B-Instruct-GGUF", "qwen2-0_5b-instruct-q5_k_m.gguf").FamilyName("llama3").Obj()
134+
return wrapper.MakeModel("llama3-8b").ModelSourceWithModelID("Qwen/Qwen2-0.5B-Instruct-GGUF", "qwen2-0_5b-instruct-q5_k_m.gguf", "").FamilyName("llama3").Obj()
135135
},
136136
failed: false,
137137
}),
138138
ginkgo.Entry("set filename when modelHub is ModelScope", &testValidatingCase{
139139
model: func() *coreapi.OpenModel {
140-
return wrapper.MakeModel("llama3-8b").ModelSourceWithModelHub("ModelScope").ModelSourceWithModelID("Qwen/Qwen2-0.5B-Instruct-GGUF", "qwen2-0_5b-instruct-q5_k_m.gguf").FamilyName("llama3").Obj()
140+
return wrapper.MakeModel("llama3-8b").ModelSourceWithModelHub("ModelScope").ModelSourceWithModelID("Qwen/Qwen2-0.5B-Instruct-GGUF", "qwen2-0_5b-instruct-q5_k_m.gguf", "").FamilyName("llama3").Obj()
141141
},
142142
failed: true,
143143
}),

test/util/mock.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const (
2626
)
2727

2828
func MockASampleModel() *coreapi.OpenModel {
29-
return wrapper.MakeModel(sampleModelName).FamilyName("llama3").ModelSourceWithModelHub("Huggingface").ModelSourceWithModelID("meta-llama/Meta-Llama-3-8B", "").Obj()
29+
return wrapper.MakeModel(sampleModelName).FamilyName("llama3").ModelSourceWithModelHub("Huggingface").ModelSourceWithModelID("meta-llama/Meta-Llama-3-8B", "", "").Obj()
3030
}
3131

3232
func MockASamplePlayground(ns string) *inferenceapi.Playground {

test/util/wrapper/model.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (w *ModelWrapper) FamilyName(name string) *ModelWrapper {
4747
return w
4848
}
4949

50-
func (w *ModelWrapper) ModelSourceWithModelID(modelID string, filename string) *ModelWrapper {
50+
func (w *ModelWrapper) ModelSourceWithModelID(modelID string, filename string, revision string) *ModelWrapper {
5151
if modelID != "" {
5252
if w.Spec.Source.ModelHub == nil {
5353
w.Spec.Source.ModelHub = &coreapi.ModelHub{}
@@ -57,6 +57,10 @@ func (w *ModelWrapper) ModelSourceWithModelID(modelID string, filename string) *
5757
if filename != "" {
5858
w.Spec.Source.ModelHub.Filename = &filename
5959
}
60+
61+
if revision != "" {
62+
w.Spec.Source.ModelHub.Revision = &revision
63+
}
6064
}
6165
return w
6266
}

0 commit comments

Comments
 (0)