Documentation ¶
Index ¶
- func Install()
- func InstallCuda()
- func LlaMA_allocate_params(version string, input string, seed int, threads int, tokens int, topK int, ...) easycgo.ValueInf
- func LlaMA_free_model(version string, p easycgo.ValueInf)
- func LlaMA_free_params(version string, p easycgo.ValueInf)
- func LlaMA_load_model(version string, modelPath string, contextSize int, parts int, seed int, ...) easycgo.ValueInf
- func LlaMA_predict(version string, p easycgo.ValueInf, model easycgo.ValueInf) int
- func LoadDll(dllFile string, version string)
- type LLama
- type ModelOption
- type ModelOptions
- type PredictOption
- func SetBatchSize(batchSize int) PredictOption
- func SetPenalty(penalty float64) PredictOption
- func SetRepeat(repeat int) PredictOption
- func SetSeed(seed int) PredictOption
- func SetStreamFn(stream func(outputText string) (stop bool)) PredictOption
- func SetTemperature(temp float64) PredictOption
- func SetThreads(threads int) PredictOption
- func SetTokens(tokens int) PredictOption
- func SetTopK(topk int) PredictOption
- func SetTopP(topp float64) PredictOption
- type PredictOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstallCuda ¶
func InstallCuda()
func LlaMA_allocate_params ¶
func LlaMA_free_model ¶
func LlaMA_free_params ¶
func LlaMA_load_model ¶
func LlaMA_predict ¶
Types ¶
type ModelOption ¶
type ModelOption func(p *ModelOptions)
var EnableF16Memory ModelOption = func(p *ModelOptions) { p.F16Memory = true }
var EnableMLock ModelOption = func(p *ModelOptions) { p.MLock = true }
func SetModelSeed ¶
func SetModelSeed(c int) ModelOption
func SetNGPULayers ¶
func SetNGPULayers(c int) ModelOption
func SetParts ¶
func SetParts(c int) ModelOption
type ModelOptions ¶
type ModelOptions struct { ContextSize int Parts int Seed int F16Memory bool MLock bool NGPULayers int }
var DefaultModelOptions ModelOptions = ModelOptions{ ContextSize: 512, Seed: 0, F16Memory: false, MLock: false, NGPULayers: 0, }
func NewModelOptions ¶
func NewModelOptions(opts ...ModelOption) ModelOptions
Create a new PredictOptions object with the given options.
type PredictOption ¶
type PredictOption func(p *PredictOptions)
var EnableF16KV PredictOption = func(p *PredictOptions) { p.F16KV = true }
var IgnoreEOS PredictOption = func(p *PredictOptions) { p.IgnoreEOS = true }
func SetBatchSize ¶
func SetBatchSize(batchSize int) PredictOption
func SetPenalty ¶
func SetPenalty(penalty float64) PredictOption
SetPenalty sets the repetition penalty for text generation.
func SetRepeat ¶
func SetRepeat(repeat int) PredictOption
SetRepeat sets the number of times to repeat text generation.
func SetSeed ¶
func SetSeed(seed int) PredictOption
SetSeed sets the random seed for sampling text generation.
func SetStreamFn ¶
func SetStreamFn(stream func(outputText string) (stop bool)) PredictOption
SetStreamFn sets the stream callback for text generation.
func SetTemperature ¶
func SetTemperature(temp float64) PredictOption
SetTemperature sets the temperature value for text generation.
func SetThreads ¶
func SetThreads(threads int) PredictOption
SetThreads sets the number of threads to use for text generation.
func SetTokens ¶
func SetTokens(tokens int) PredictOption
SetTokens sets the number of tokens to generate.
func SetTopP ¶
func SetTopP(topp float64) PredictOption
SetTopP sets the value for nucleus sampling.
type PredictOptions ¶
type PredictOptions struct {
Seed, Threads, Tokens, TopK, Repeat int
TopP, Temperature, Penalty float64
F16KV bool
BatchSize int
IgnoreEOS bool
Stream func(outputText string) (stop bool)
}
var DefaultOptions PredictOptions = PredictOptions{
Seed: -1,
Threads: defaultThreadNum,
Tokens: 128,
TopK: 10000,
TopP: 0.7,
Temperature: 0.7,
Penalty: 1,
Repeat: 64 * 4,
}
func NewPredictOptions ¶
func NewPredictOptions(opts ...PredictOption) PredictOptions
Create a new PredictOptions object with the given options.
Click to show internal directories.
Click to hide internal directories.