forked from mudler/LocalAI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(template): read jinja templates from gguf files (mudler#4332)
* Read jinja templates as fallback Signed-off-by: Ettore Di Giacinto <[email protected]> * Move templating out of model loader Signed-off-by: Ettore Di Giacinto <[email protected]> * Test TemplateMessages Signed-off-by: Ettore Di Giacinto <[email protected]> * Set role and content from transformers Signed-off-by: Ettore Di Giacinto <[email protected]> * Tests: be more flexible Signed-off-by: Ettore Di Giacinto <[email protected]> * More jinja Signed-off-by: Ettore Di Giacinto <[email protected]> * Small refactoring and adaptations Signed-off-by: Ettore Di Giacinto <[email protected]> --------- Signed-off-by: Ettore Di Giacinto <[email protected]>
- Loading branch information
Showing
23 changed files
with
967 additions
and
781 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package application | ||
|
||
import ( | ||
"github.com/mudler/LocalAI/core/config" | ||
"github.com/mudler/LocalAI/pkg/model" | ||
"github.com/mudler/LocalAI/pkg/templates" | ||
) | ||
|
||
type Application struct { | ||
backendLoader *config.BackendConfigLoader | ||
modelLoader *model.ModelLoader | ||
applicationConfig *config.ApplicationConfig | ||
templatesEvaluator *templates.Evaluator | ||
} | ||
|
||
func newApplication(appConfig *config.ApplicationConfig) *Application { | ||
return &Application{ | ||
backendLoader: config.NewBackendConfigLoader(appConfig.ModelPath), | ||
modelLoader: model.NewModelLoader(appConfig.ModelPath), | ||
applicationConfig: appConfig, | ||
templatesEvaluator: templates.NewEvaluator(appConfig.ModelPath), | ||
} | ||
} | ||
|
||
func (a *Application) BackendLoader() *config.BackendConfigLoader { | ||
return a.backendLoader | ||
} | ||
|
||
func (a *Application) ModelLoader() *model.ModelLoader { | ||
return a.modelLoader | ||
} | ||
|
||
func (a *Application) ApplicationConfig() *config.ApplicationConfig { | ||
return a.applicationConfig | ||
} | ||
|
||
func (a *Application) TemplatesEvaluator() *templates.Evaluator { | ||
return a.templatesEvaluator | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.