Skip to content

Commit

Permalink
fix(pkg): fix isError and set maxBatchSize to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
heiruwu committed Feb 15, 2024
1 parent 17c5d68 commit 2adfe5b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions pkg/handler/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func createGitHubModel(s service.Service, ctx context.Context, model *modelPB.Mo
return &longrunningpb.Operation{}, status.Errorf(codes.InvalidArgument, "There is no tag in GitHub repository")
}
}

bModelConfig, _ := json.Marshal(datamodel.GitHubModelConfiguration{
Repository: modelConfig.Repository,
HTMLURL: "https://github.com/" + modelConfig.Repository,
Expand Down Expand Up @@ -126,6 +127,7 @@ func createGitHubModel(s service.Service, ctx context.Context, model *modelPB.Mo
return &longrunningpb.Operation{}, st.Err()
}
}

readmeFilePath, err := utils.UpdateModelPath(modelSrcDir, config.Config.RayServer.ModelStore, ns.String(), githubModel)

if err != nil {
Expand Down Expand Up @@ -192,7 +194,7 @@ func createGitHubModel(s service.Service, ctx context.Context, model *modelPB.Mo
}

// TODO: properly support batch inference
maxBatchSize := 1
maxBatchSize := 0
allowedMaxBatchSize := utils.GetSupportedBatchSize(githubModel.Task)

if maxBatchSize > allowedMaxBatchSize {
Expand Down Expand Up @@ -420,7 +422,7 @@ func createHuggingFaceModel(s service.Service, ctx context.Context, model *model
}

// TODO: properly support batch inference
maxBatchSize := 1
maxBatchSize := 0
allowedMaxBatchSize := utils.GetSupportedBatchSize(huggingfaceModel.Task)

if maxBatchSize > allowedMaxBatchSize {
Expand Down Expand Up @@ -614,7 +616,7 @@ func createArtiVCModel(s service.Service, ctx context.Context, model *modelPB.Mo
}

// TODO: properly support batch inference
maxBatchSize := 1
maxBatchSize := 0
allowedMaxBatchSize := utils.GetSupportedBatchSize(artivcModel.Task)

if maxBatchSize > allowedMaxBatchSize {
Expand Down
2 changes: 1 addition & 1 deletion pkg/handler/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ func (h *PublicHandler) createNamespaceModelBinaryFileUpload(ctx context.Context
}

// TODO: properly support batch inference
maxBatchSize := 1
maxBatchSize := 0
allowedMaxBatchSize := utils.GetSupportedBatchSize(uploadedModel.Task)

if maxBatchSize > allowedMaxBatchSize {
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func GitHubClone(dir string, instanceConfig datamodel.GitHubModelConfiguration,
// Check in the cache first.
if config.Config.Cache.Model.Enabled {
_ = os.MkdirAll(config.Config.Cache.Model.CacheDir, os.ModePerm)
if state, err := redisClient.Get(ctx, redisRepoKey).Result(); err != nil && errors.Is(err, redis.Nil) {
if state, err := redisClient.Get(ctx, redisRepoKey).Result(); err != nil && !errors.Is(err, redis.Nil) {
return err
} else if err == nil {
if state == "done" {
Expand Down

0 comments on commit 2adfe5b

Please sign in to comment.