Adapt code

This commit is contained in:
mudler
2023-06-01 14:37:14 +02:00
committed by AT
parent fca2578a81
commit 79cef86bec
6 changed files with 24 additions and 90 deletions

View File

@@ -20,24 +20,14 @@ var DefaultOptions PredictOptions = PredictOptions{
}
var DefaultModelOptions ModelOptions = ModelOptions{
Threads: 4,
ModelType: GPTJType,
Threads: 4,
}
type ModelOptions struct {
Threads int
ModelType ModelType
Threads int
}
type ModelOption func(p *ModelOptions)
type ModelType int
const (
LLaMAType ModelType = 0
GPTJType ModelType = iota
MPTType ModelType = iota
)
// SetTokens sets the number of tokens to generate.
func SetTokens(tokens int) PredictOption {
return func(p *PredictOptions) {
@@ -110,13 +100,6 @@ func SetThreads(c int) ModelOption {
}
}
// SetModelType sets the model type.
func SetModelType(c ModelType) ModelOption {
return func(p *ModelOptions) {
p.ModelType = c
}
}
// Create a new PredictOptions object with the given options.
func NewModelOptions(opts ...ModelOption) ModelOptions {
p := DefaultModelOptions