Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/core/v1alpha1/model_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type ModelHub struct {
// in the near future.
Filename *string `json:"filename,omitempty"`
// Revision refers to a Git revision id which can be a branch name, a tag, or a commit hash.
// Most of the time, you don't need to specify it.
// +kubebuilder:default=main
// +optional
Revision *string `json:"revision,omitempty"`
}
Expand Down
6 changes: 3 additions & 3 deletions config/crd/bases/llmaz.io_openmodels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ spec:
- ModelScope
type: string
revision:
description: |-
Revision refers to a Git revision id which can be a branch name, a tag, or a commit hash.
Most of the time, you don't need to specify it.
default: main
description: Revision refers to a Git revision id which can
be a branch name, a tag, or a commit hash.
type: string
type: object
uri:
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller_helper/model_source/modelsource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func Test_ModelSourceProvider(t *testing.T) {
},
{
name: "modelhub with GGUF file",
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(),
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(),
wantModelName: "test-7b",
wantModelPath: "/workspace/models/qwen2-0_5b-instruct-q5_k_m.gguf",
},
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/playground_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var _ = ginkgo.Describe("playground e2e tests", func() {
})

ginkgo.It("Deploy a huggingface model with llama.cpp", func() {
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()
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()
gomega.Expect(k8sClient.Create(ctx, model)).To(gomega.Succeed())
defer func() {
gomega.Expect(k8sClient.Delete(ctx, model)).To(gomega.Succeed())
Expand All @@ -73,7 +73,7 @@ var _ = ginkgo.Describe("playground e2e tests", func() {
Request("cpu", "2").Request("memory", "4Gi").Limit("cpu", "4").Limit("memory", "4Gi").Obj()
gomega.Expect(k8sClient.Create(ctx, backendRuntime)).To(gomega.Succeed())

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()
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()
gomega.Expect(k8sClient.Create(ctx, model)).To(gomega.Succeed())
defer func() {
gomega.Expect(k8sClient.Delete(ctx, model)).To(gomega.Succeed())
Expand All @@ -92,12 +92,12 @@ var _ = ginkgo.Describe("playground e2e tests", func() {
})
// TODO: add e2e tests.
// ginkgo.It("SpeculativeDecoding with llama.cpp", func() {
// targetModel := wrapper.MakeModel("llama2-7b-q8-gguf").FamilyName("llama2").ModelSourceWithModelHub("Huggingface").ModelSourceWithModelID("TheBloke/Llama-2-7B-GGUF", "llama-2-7b.Q8_0.gguf").Obj()
// targetModel := wrapper.MakeModel("llama2-7b-q8-gguf").FamilyName("llama2").ModelSourceWithModelHub("Huggingface").ModelSourceWithModelID("TheBloke/Llama-2-7B-GGUF", "llama-2-7b.Q8_0.gguf", "").Obj()
// gomega.Expect(k8sClient.Create(ctx, targetModel)).To(gomega.Succeed())
// defer func() {
// gomega.Expect(k8sClient.Delete(ctx, targetModel)).To(gomega.Succeed())
// }()
// 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()
// 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()
// gomega.Expect(k8sClient.Create(ctx, draftModel)).To(gomega.Succeed())
// defer func() {
// gomega.Expect(k8sClient.Delete(ctx, draftModel)).To(gomega.Succeed())
Expand Down
2 changes: 1 addition & 1 deletion test/integration/controller/inference/playground_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var _ = ginkgo.Describe("playground controller test", func() {
gomega.Expect(k8sClient.Create(ctx, ns)).To(gomega.Succeed())
model = util.MockASampleModel()
gomega.Expect(k8sClient.Create(ctx, model)).To(gomega.Succeed())
draftModel = wrapper.MakeModel("llama3-2b").FamilyName("llama3").ModelSourceWithModelHub("Huggingface").ModelSourceWithModelID("meta-llama/Meta-Llama-3-2B", "").Obj()
draftModel = wrapper.MakeModel("llama3-2b").FamilyName("llama3").ModelSourceWithModelHub("Huggingface").ModelSourceWithModelID("meta-llama/Meta-Llama-3-2B", "", "").Obj()
gomega.Expect(k8sClient.Create(ctx, draftModel)).To(gomega.Succeed())
})
ginkgo.AfterEach(func() {
Expand Down
18 changes: 9 additions & 9 deletions test/integration/webhook/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ var _ = ginkgo.Describe("model default and validation", func() {
},
ginkgo.Entry("apply model family name", &testDefaultingCase{
model: func() *coreapi.OpenModel {
return wrapper.MakeModel("llama3-8b").ModelSourceWithModelID("meta-llama/Meta-Llama-3-8B", "").FamilyName("llama3").Obj()
return wrapper.MakeModel("llama3-8b").ModelSourceWithModelID("meta-llama/Meta-Llama-3-8B", "", "").FamilyName("llama3").Obj()
},
wantModel: func() *coreapi.OpenModel {
return wrapper.MakeModel("llama3-8b").ModelSourceWithModelID("meta-llama/Meta-Llama-3-8B", "").ModelSourceWithModelHub("Huggingface").FamilyName("llama3").Label(coreapi.ModelFamilyNameLabelKey, "llama3").Obj()
return wrapper.MakeModel("llama3-8b").ModelSourceWithModelID("meta-llama/Meta-Llama-3-8B", "", "main").ModelSourceWithModelHub("Huggingface").FamilyName("llama3").Label(coreapi.ModelFamilyNameLabelKey, "llama3").Obj()
},
}),
ginkgo.Entry("apply modelscope model hub name", &testDefaultingCase{
model: func() *coreapi.OpenModel {
return wrapper.MakeModel("llama3-8b").FamilyName("llama3").ModelSourceWithModelHub("ModelScope").ModelSourceWithModelID("LLM-Research/Meta-Llama-3-8B", "").Obj()
return wrapper.MakeModel("llama3-8b").FamilyName("llama3").ModelSourceWithModelHub("ModelScope").ModelSourceWithModelID("LLM-Research/Meta-Llama-3-8B", "", "").Obj()
},
wantModel: func() *coreapi.OpenModel {
return wrapper.MakeModel("llama3-8b").ModelSourceWithModelID("LLM-Research/Meta-Llama-3-8B", "").ModelSourceWithModelHub("ModelScope").FamilyName("llama3").Label(coreapi.ModelFamilyNameLabelKey, "llama3").Obj()
return wrapper.MakeModel("llama3-8b").ModelSourceWithModelID("LLM-Research/Meta-Llama-3-8B", "", "main").ModelSourceWithModelHub("ModelScope").FamilyName("llama3").Label(coreapi.ModelFamilyNameLabelKey, "llama3").Obj()
},
}),
)
Expand All @@ -83,19 +83,19 @@ var _ = ginkgo.Describe("model default and validation", func() {
},
ginkgo.Entry("default normal huggingface model creation", &testValidatingCase{
model: func() *coreapi.OpenModel {
return wrapper.MakeModel("llama3-8b").FamilyName("llama3").ModelSourceWithModelID("meta-llama/Meta-Llama-3-8B", "").Obj()
return wrapper.MakeModel("llama3-8b").FamilyName("llama3").ModelSourceWithModelID("meta-llama/Meta-Llama-3-8B", "", "").Obj()
},
failed: false,
}),
ginkgo.Entry("normal modelScope model creation", &testValidatingCase{
model: func() *coreapi.OpenModel {
return wrapper.MakeModel("llama3-8b").FamilyName("llama3").ModelSourceWithModelHub("ModelScope").ModelSourceWithModelID("LLM-Research/Meta-Llama-3-8B", "").Obj()
return wrapper.MakeModel("llama3-8b").FamilyName("llama3").ModelSourceWithModelHub("ModelScope").ModelSourceWithModelID("LLM-Research/Meta-Llama-3-8B", "", "").Obj()
},
failed: false,
}),
ginkgo.Entry("invalid model name", &testValidatingCase{
model: func() *coreapi.OpenModel {
return wrapper.MakeModel("qwen-2-0.5b").FamilyName("qwen2").ModelSourceWithModelID("Qwen/Qwen2-0.5B-Instruct", "").Obj()
return wrapper.MakeModel("qwen-2-0.5b").FamilyName("qwen2").ModelSourceWithModelID("Qwen/Qwen2-0.5B-Instruct", "", "").Obj()
},
failed: true,
}),
Expand Down Expand Up @@ -131,13 +131,13 @@ var _ = ginkgo.Describe("model default and validation", func() {
}),
ginkgo.Entry("set filename when modelHub is Huggingface", &testValidatingCase{
model: func() *coreapi.OpenModel {
return wrapper.MakeModel("llama3-8b").ModelSourceWithModelID("Qwen/Qwen2-0.5B-Instruct-GGUF", "qwen2-0_5b-instruct-q5_k_m.gguf").FamilyName("llama3").Obj()
return wrapper.MakeModel("llama3-8b").ModelSourceWithModelID("Qwen/Qwen2-0.5B-Instruct-GGUF", "qwen2-0_5b-instruct-q5_k_m.gguf", "").FamilyName("llama3").Obj()
},
failed: false,
}),
ginkgo.Entry("set filename when modelHub is ModelScope", &testValidatingCase{
model: func() *coreapi.OpenModel {
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()
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()
},
failed: true,
}),
Expand Down
2 changes: 1 addition & 1 deletion test/util/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const (
)

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

func MockASamplePlayground(ns string) *inferenceapi.Playground {
Expand Down
6 changes: 5 additions & 1 deletion test/util/wrapper/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (w *ModelWrapper) FamilyName(name string) *ModelWrapper {
return w
}

func (w *ModelWrapper) ModelSourceWithModelID(modelID string, filename string) *ModelWrapper {
func (w *ModelWrapper) ModelSourceWithModelID(modelID string, filename string, revision string) *ModelWrapper {
if modelID != "" {
if w.Spec.Source.ModelHub == nil {
w.Spec.Source.ModelHub = &coreapi.ModelHub{}
Expand All @@ -57,6 +57,10 @@ func (w *ModelWrapper) ModelSourceWithModelID(modelID string, filename string) *
if filename != "" {
w.Spec.Source.ModelHub.Filename = &filename
}

if revision != "" {
w.Spec.Source.ModelHub.Revision = &revision
}
}
return w
}
Expand Down