Skip to content

Commit fdbc871

Browse files
committed
fix mudler#1746 merge stuff
1 parent 570d9ee commit fdbc871

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

core/backend/image.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,13 @@ func (igbs *ImageGenerationBackendService) GenerateImage(request *schema.OpenAIR
232232

233233
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) {
234234

235+
threads := backendConfig.Threads
236+
if threads == 0 && appConfig.Threads != 0 {
237+
threads = appConfig.Threads
238+
}
239+
240+
gRPCOpts := gRPCModelOpts(backendConfig)
241+
235242
opts := modelOpts(backendConfig, appConfig, []model.Option{
236243
model.WithBackendString(backendConfig.Backend),
237244
model.WithAssetDir(appConfig.AssetsDestination),

core/backend/llm.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,18 @@ func NewLLMBackendService(ml *model.ModelLoader, bcl *config.BackendConfigLoader
6464
func (llmbs *LLMBackendService) Inference(ctx context.Context, req *LLMRequest, bc *config.BackendConfig, enableTokenChannel bool) (
6565
resultChannel <-chan utils.ErrorOr[*LLMResponse], tokenChannel <-chan utils.ErrorOr[*LLMResponse], err error) {
6666

67+
threads := bc.Threads
68+
if threads == 0 && llmbs.appConfig.Threads != 0 {
69+
threads = llmbs.appConfig.Threads
70+
}
71+
6772
grpcOpts := gRPCModelOpts(bc)
6873

6974
var inferenceModel grpc.Backend
7075

7176
opts := modelOpts(bc, llmbs.appConfig, []model.Option{
7277
model.WithLoadGRPCLoadModelOpts(grpcOpts),
73-
model.WithThreads(uint32(bc.Threads)), // some models uses this to allocate threads during startup
78+
model.WithThreads(uint32(threads)), // some models uses this to allocate threads during startup
7479
model.WithAssetDir(llmbs.appConfig.AssetsDestination),
7580
model.WithModel(bc.Model),
7681
model.WithContext(llmbs.appConfig.Context),

0 commit comments

Comments
 (0)