diff --git a/pkg/controller/modeladapter/modeladapter_controller.go b/pkg/controller/modeladapter/modeladapter_controller.go index fe4407ef..7f1303fb 100644 --- a/pkg/controller/modeladapter/modeladapter_controller.go +++ b/pkg/controller/modeladapter/modeladapter_controller.go @@ -24,6 +24,7 @@ import ( "fmt" "io" "net/http" + "strings" "time" modelv1alpha1 "github.com/aibrix/aibrix/api/model/v1alpha1" @@ -588,12 +589,16 @@ func (r *ModelAdapterReconciler) modelAdapterExists(host, modelName string) (boo // Separate method to load the LoRA adapter func (r *ModelAdapterReconciler) loadModelAdapter(host string, instance *modelv1alpha1.ModelAdapter) error { - artifactURL, err := extractHuggingFacePath(instance.Spec.ArtifactURL) - if err != nil { - // Handle error, e.g., log it and return - klog.ErrorS(err, "Invalid artifact URL", "artifactURL", artifactURL) - return err + artifactURL := instance.Spec.ArtifactURL + if strings.HasPrefix(instance.Spec.ArtifactURL, "huggingface://") { + artifactURL, err := extractHuggingFacePath(instance.Spec.ArtifactURL) + if err != nil { + // Handle error, e.g., log it and return + klog.ErrorS(err, "Invalid artifact URL", "artifactURL", artifactURL) + return err + } } + // TODO: extend to other artifacts payload := map[string]string{ "lora_name": instance.Name, diff --git a/pkg/controller/modeladapter/utils.go b/pkg/controller/modeladapter/utils.go index 41fd195a..36877158 100644 --- a/pkg/controller/modeladapter/utils.go +++ b/pkg/controller/modeladapter/utils.go @@ -51,9 +51,9 @@ func validateModelAdapter(instance *modelv1alpha1.ModelAdapter) error { return nil } -// validateArtifactURL checks if the ArtifactURL has a valid schema (s3://, gcs://, huggingface://, https://) +// validateArtifactURL checks if the ArtifactURL has a valid schema (s3://, gcs://, huggingface://, https://, /) func validateArtifactURL(artifactURL string) error { - allowedSchemes := []string{"s3://", "gcs://", "huggingface://", "hf://"} + allowedSchemes := []string{"s3://", "gcs://", "huggingface://", "hf://", "/"} for _, scheme := range allowedSchemes { if strings.HasPrefix(artifactURL, scheme) { return nil