Skip to content

Commit

Permalink
fix mudler#1746 merge stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-gray101 committed Mar 7, 2024
1 parent 570d9ee commit fdbc871
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions core/backend/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,13 @@ func (igbs *ImageGenerationBackendService) GenerateImage(request *schema.OpenAIR

func imageGeneration(height, width, mode, step, seed int, positive_prompt, negative_prompt, src, dst string, loader *model.ModelLoader, backendConfig *config.BackendConfig, appConfig *config.ApplicationConfig) (func() error, error) {

threads := backendConfig.Threads
if threads == 0 && appConfig.Threads != 0 {
threads = appConfig.Threads
}

gRPCOpts := gRPCModelOpts(backendConfig)

opts := modelOpts(backendConfig, appConfig, []model.Option{
model.WithBackendString(backendConfig.Backend),
model.WithAssetDir(appConfig.AssetsDestination),
Expand Down
7 changes: 6 additions & 1 deletion core/backend/llm.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,18 @@ func NewLLMBackendService(ml *model.ModelLoader, bcl *config.BackendConfigLoader
func (llmbs *LLMBackendService) Inference(ctx context.Context, req *LLMRequest, bc *config.BackendConfig, enableTokenChannel bool) (
resultChannel <-chan utils.ErrorOr[*LLMResponse], tokenChannel <-chan utils.ErrorOr[*LLMResponse], err error) {

threads := bc.Threads
if threads == 0 && llmbs.appConfig.Threads != 0 {
threads = llmbs.appConfig.Threads
}

grpcOpts := gRPCModelOpts(bc)

var inferenceModel grpc.Backend

opts := modelOpts(bc, llmbs.appConfig, []model.Option{
model.WithLoadGRPCLoadModelOpts(grpcOpts),
model.WithThreads(uint32(bc.Threads)), // some models uses this to allocate threads during startup
model.WithThreads(uint32(threads)), // some models uses this to allocate threads during startup
model.WithAssetDir(llmbs.appConfig.AssetsDestination),
model.WithModel(bc.Model),
model.WithContext(llmbs.appConfig.Context),
Expand Down

0 comments on commit fdbc871

Please sign in to comment.