@@ -81,10 +81,10 @@ func readMultipleBackendConfigsFromFile(file string, opts ...ConfigLoaderOption)
81
81
c := & []* BackendConfig {}
82
82
f , err := os .ReadFile (file )
83
83
if err != nil {
84
- return nil , fmt .Errorf ("cannot read config file: %w" , err )
84
+ return nil , fmt .Errorf ("readMultipleBackendConfigsFromFile cannot read config file %q : %w" , file , err )
85
85
}
86
86
if err := yaml .Unmarshal (f , c ); err != nil {
87
- return nil , fmt .Errorf ("cannot unmarshal config file: %w" , err )
87
+ return nil , fmt .Errorf ("readMultipleBackendConfigsFromFile cannot unmarshal config file %q : %w" , file , err )
88
88
}
89
89
90
90
for _ , cc := range * c {
@@ -101,10 +101,10 @@ func readBackendConfigFromFile(file string, opts ...ConfigLoaderOption) (*Backen
101
101
c := & BackendConfig {}
102
102
f , err := os .ReadFile (file )
103
103
if err != nil {
104
- return nil , fmt .Errorf ("cannot read config file: %w" , err )
104
+ return nil , fmt .Errorf ("readBackendConfigFromFile cannot read config file %q : %w" , file , err )
105
105
}
106
106
if err := yaml .Unmarshal (f , c ); err != nil {
107
- return nil , fmt .Errorf ("cannot unmarshal config file: %w" , err )
107
+ return nil , fmt .Errorf ("readBackendConfigFromFile cannot unmarshal config file %q : %w" , file , err )
108
108
}
109
109
110
110
c .SetDefaults (opts ... )
@@ -117,7 +117,9 @@ func (bcl *BackendConfigLoader) LoadBackendConfigFileByName(modelName, modelPath
117
117
// Load a config file if present after the model name
118
118
cfg := & BackendConfig {
119
119
PredictionOptions : schema.PredictionOptions {
120
- Model : modelName ,
120
+ BasicModelRequest : schema.BasicModelRequest {
121
+ Model : modelName ,
122
+ },
121
123
},
122
124
}
123
125
@@ -145,6 +147,15 @@ func (bcl *BackendConfigLoader) LoadBackendConfigFileByName(modelName, modelPath
145
147
return cfg , nil
146
148
}
147
149
150
+ func (bcl * BackendConfigLoader ) LoadBackendConfigFileByNameDefaultOptions (modelName string , appConfig * ApplicationConfig ) (* BackendConfig , error ) {
151
+ return bcl .LoadBackendConfigFileByName (modelName , appConfig .ModelPath ,
152
+ LoadOptionDebug (appConfig .Debug ),
153
+ LoadOptionThreads (appConfig .Threads ),
154
+ LoadOptionContextSize (appConfig .ContextSize ),
155
+ LoadOptionF16 (appConfig .F16 ),
156
+ ModelPath (appConfig .ModelPath ))
157
+ }
158
+
148
159
// This format is currently only used when reading a single file at startup, passed in via ApplicationConfig.ConfigFile
149
160
func (bcl * BackendConfigLoader ) LoadMultipleBackendConfigsSingleFile (file string , opts ... ConfigLoaderOption ) error {
150
161
bcl .Lock ()
@@ -167,7 +178,7 @@ func (bcl *BackendConfigLoader) LoadBackendConfig(file string, opts ...ConfigLoa
167
178
defer bcl .Unlock ()
168
179
c , err := readBackendConfigFromFile (file , opts ... )
169
180
if err != nil {
170
- return fmt .Errorf ("cannot read config file: %w" , err )
181
+ return fmt .Errorf ("LoadBackendConfig cannot read config file %q : %w" , file , err )
171
182
}
172
183
173
184
if c .Validate () {
@@ -324,9 +335,10 @@ func (bcl *BackendConfigLoader) Preload(modelPath string) error {
324
335
func (bcl * BackendConfigLoader ) LoadBackendConfigsFromPath (path string , opts ... ConfigLoaderOption ) error {
325
336
bcl .Lock ()
326
337
defer bcl .Unlock ()
338
+
327
339
entries , err := os .ReadDir (path )
328
340
if err != nil {
329
- return fmt .Errorf ("cannot read directory '%s': %w" , path , err )
341
+ return fmt .Errorf ("LoadBackendConfigsFromPath cannot read directory '%s': %w" , path , err )
330
342
}
331
343
files := make ([]fs.FileInfo , 0 , len (entries ))
332
344
for _ , entry := range entries {
@@ -344,13 +356,13 @@ func (bcl *BackendConfigLoader) LoadBackendConfigsFromPath(path string, opts ...
344
356
}
345
357
c , err := readBackendConfigFromFile (filepath .Join (path , file .Name ()), opts ... )
346
358
if err != nil {
347
- log .Error ().Err (err ).Msgf ( "cannot read config file: %s " , file .Name ())
359
+ log .Error ().Err (err ).Str ( "File Name " , file .Name ()). Msgf ( "LoadBackendConfigsFromPath cannot read config file" )
348
360
continue
349
361
}
350
362
if c .Validate () {
351
363
bcl .configs [c .Name ] = * c
352
364
} else {
353
- log .Error ().Err (err ).Msgf ("config is not valid" )
365
+ log .Error ().Err (err ).Str ( "Name" , c . Name ). Msgf ("config is not valid" )
354
366
}
355
367
}
356
368
0 commit comments