mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-20 02:24:59 +00:00
feat(default): use number of physical cores as default (#2483)
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
1ffee9989f
commit
bdd6769b2d
3 changed files with 12 additions and 2 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/go-skynet/LocalAI/pkg/gallery"
|
||||
"github.com/go-skynet/LocalAI/pkg/xsysinfo"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
|
@ -59,7 +60,6 @@ func NewApplicationConfig(o ...AppOption) *ApplicationConfig {
|
|||
opt := &ApplicationConfig{
|
||||
Context: context.Background(),
|
||||
UploadLimitMB: 15,
|
||||
Threads: 1,
|
||||
ContextSize: 512,
|
||||
Debug: true,
|
||||
}
|
||||
|
@ -213,6 +213,9 @@ func WithUploadLimitMB(limit int) AppOption {
|
|||
|
||||
func WithThreads(threads int) AppOption {
|
||||
return func(o *ApplicationConfig) {
|
||||
if threads == 0 { // 0 is not allowed
|
||||
threads = xsysinfo.CPUPhysicalCores()
|
||||
}
|
||||
o.Threads = threads
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue