Skip to content

Commit

Permalink
Merge pull request #101 from kerthcet/feat/support-llamacpp
Browse files Browse the repository at this point in the history
Prepare for v0.0.4
  • Loading branch information
InftyAI-Agent authored Aug 19, 2024
2 parents 5efc2b1 + e93689c commit e9795ff
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ LWS_VERSION=v0.3.0
kubectl apply --server-side -f https://github.com/kubernetes-sigs/lws/releases/download/$LWS_VERSION/manifests.yaml
# llmaz runs in llmaz-system
LLMAZ_VERSION=v0.0.3
LLMAZ_VERSION=v0.0.4
kubectl apply --server-side -f https://github.com/inftyai/llmaz/releases/download/$LLMAZ_VERSION/manifests.yaml
```

Expand All @@ -24,7 +24,7 @@ kubectl apply --server-side -f https://github.com/inftyai/llmaz/releases/downloa
LWS_VERSION=v0.3.0
kubectl delete -f https://github.com/kubernetes-sigs/lws/releases/download/$LWS_VERSION/manifests.yaml
LLMAZ_VERSION=v0.0.3
LLMAZ_VERSION=v0.0.4
kubectl delete -f https://github.com/inftyai/llmaz/releases/download/$LLMAZ_VERSION/manifests.yaml
```

Expand Down
2 changes: 1 addition & 1 deletion pkg/controller_helper/model_source/modelhub.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (p *ModelHubProvider) InjectModelLoader(template *corev1.PodTemplateSpec) {
Name: MODEL_VOLUME_NAME,
VolumeSource: corev1.VolumeSource{
HostPath: &corev1.HostPathVolumeSource{
Path: HOST_MODEL_PATH,
Path: HOST_CLUSTER_MODEL_PATH,
Type: &hostType,
},
},
Expand Down
4 changes: 3 additions & 1 deletion pkg/controller_helper/model_source/modelsource.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ import (
const (
// model path
CONTAINER_MODEL_PATH = "/workspace/models/"
HOST_MODEL_PATH = "/cache/models/"
HOST_MODEL_BASE_PATH = "/mnt/models/"
// TODO: we may need /mnt/models/namespace1/ path in the future for isolations.
HOST_CLUSTER_MODEL_PATH = HOST_MODEL_BASE_PATH + "cluster/"

// container & volume configs
DEFAULT_BACKEND_PORT = 8080
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller_helper/model_source/uri.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (p *URIProvider) InjectModelLoader(template *corev1.PodTemplateSpec) {
Name: MODEL_VOLUME_NAME,
VolumeSource: corev1.VolumeSource{
HostPath: &corev1.HostPathVolumeSource{
Path: HOST_MODEL_PATH,
Path: HOST_CLUSTER_MODEL_PATH,
Type: &hostType,
},
},
Expand Down
2 changes: 2 additions & 0 deletions pkg/webhook/openmodel_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ func (w *OpenModelWebhook) ValidateDelete(ctx context.Context, obj runtime.Objec
return nil, nil
}

// TODO: once namespaced models enabled, we should validate that only such volume path
// /mnt/models/<model-namespace>/ is allowed.
func (w *OpenModelWebhook) generateValidate(obj runtime.Object) field.ErrorList {
model := obj.(*coreapi.OpenModel)
dataSourcePath := field.NewPath("spec", "dataSource")
Expand Down
2 changes: 1 addition & 1 deletion test/util/validation/validate_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func ValidateModelLoader(model *coreapi.OpenModel, workload *lws.LeaderWorkerSet

for _, v := range service.Spec.WorkloadTemplate.LeaderWorkerTemplate.WorkerTemplate.Spec.Volumes {
if v.Name == modelSource.MODEL_VOLUME_NAME {
if v.HostPath == nil || v.HostPath.Path != modelSource.HOST_MODEL_PATH || *v.HostPath.Type != corev1.HostPathDirectoryOrCreate {
if v.HostPath == nil || v.HostPath.Path != modelSource.HOST_CLUSTER_MODEL_PATH || *v.HostPath.Type != corev1.HostPathDirectoryOrCreate {
return errors.New("when using modelHub modelSource, the hostPath shouldn't be nil")
}
}
Expand Down

0 comments on commit e9795ff

Please sign in to comment.