configurable rope frequency parameters

This commit is contained in:
Michael Yang 2023-08-03 22:10:49 -07:00
parent e3fb1fd3f1
commit b9f4d67554
2 changed files with 27 additions and 21 deletions

View file

@ -160,6 +160,8 @@ type Options struct {
UseMMap bool `json:"use_mmap,omitempty"` UseMMap bool `json:"use_mmap,omitempty"`
UseMLock bool `json:"use_mlock,omitempty"` UseMLock bool `json:"use_mlock,omitempty"`
EmbeddingOnly bool `json:"embedding_only,omitempty"` EmbeddingOnly bool `json:"embedding_only,omitempty"`
RopeFrequencyBase float32 `json:"rope_frequency_base,omitempty"`
RopeFrequencyScale float32 `json:"rope_frequency_scale,omitempty"`
// Predict options // Predict options
RepeatLastN int `json:"repeat_last_n,omitempty"` RepeatLastN int `json:"repeat_last_n,omitempty"`
@ -269,6 +271,8 @@ func DefaultOptions() Options {
F16KV: true, F16KV: true,
UseMMap: true, UseMMap: true,
UseMLock: false, UseMLock: false,
RopeFrequencyBase: 10000.0,
RopeFrequencyScale: 1.0,
RepeatLastN: 64, RepeatLastN: 64,
RepeatPenalty: 1.1, RepeatPenalty: 1.1,

View file

@ -142,6 +142,8 @@ func New(model string, opts api.Options) (*LLM, error) {
params.use_mmap = C.bool(llm.UseMMap) params.use_mmap = C.bool(llm.UseMMap)
params.use_mlock = C.bool(llm.UseMLock) params.use_mlock = C.bool(llm.UseMLock)
params.embedding = C.bool(llm.EmbeddingOnly) params.embedding = C.bool(llm.EmbeddingOnly)
params.rope_freq_base = C.float(llm.RopeFrequencyBase)
params.rope_freq_scale = C.float(llm.RopeFrequencyScale)
llm.params = &params llm.params = &params
cModel := C.CString(model) cModel := C.CString(model)