Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support absolute path as lora adapter artifact path #556

Merged
merged 1 commit into from
Jan 8, 2025
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
15 changes: 10 additions & 5 deletions pkg/controller/modeladapter/modeladapter_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"fmt"
"io"
"net/http"
"strings"
"time"

modelv1alpha1 "github.com/aibrix/aibrix/api/model/v1alpha1"
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/modeladapter/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down