MCPcopy
hub / github.com/mudler/LocalAI / NewModelLoader

Function NewModelLoader

pkg/model/loader.go:89–101  ·  view source on GitHub ↗

NewModelLoader creates a new ModelLoader instance. LRU eviction is now managed through the WatchDog component.

(system *system.SystemState)

Source from the content-addressed store, hash-verified

87// NewModelLoader creates a new ModelLoader instance.
88// LRU eviction is now managed through the WatchDog component.
89func NewModelLoader(system *system.SystemState) *ModelLoader {
90 nml := &ModelLoader{
91 ModelPath: system.Model.ModelsPath,
92 store: NewInMemoryModelStore(),
93 loading: make(map[string]chan struct{}),
94 externalBackends: make(map[string]string),
95 lruEvictionMaxRetries: 30, // Default: 30 retries
96 lruEvictionRetryInterval: 1 * time.Second, // Default: 1 second
97 backendLogs: NewBackendLogStore(1000),
98 }
99
100 return nml
101}
102
103// GetLoadingCount returns the number of models currently being loaded
104func (ml *ModelLoader) GetLoadingCount() int {

Callers 15

request_test.goFile · 0.92
edit_model_test.goFile · 0.92
newCapturingLoaderFunction · 0.92
stores_test.goFile · 0.92
RunMethod · 0.92
RunMethod · 0.92
RunMethod · 0.92

Calls 2

NewInMemoryModelStoreFunction · 0.85
NewBackendLogStoreFunction · 0.85

Tested by 1

newCapturingLoaderFunction · 0.74