mirror of
https://github.com/ollama/ollama.git
synced 2025-05-10 09:56:28 +02:00
api: remove unused sampling parameters (#10581)
This commit is contained in:
parent
3d9498a425
commit
fa9973cd7f
9 changed files with 3 additions and 30 deletions
|
@ -271,9 +271,6 @@ type Options struct {
|
|||
RepeatPenalty float32 `json:"repeat_penalty,omitempty"`
|
||||
PresencePenalty float32 `json:"presence_penalty,omitempty"`
|
||||
FrequencyPenalty float32 `json:"frequency_penalty,omitempty"`
|
||||
Mirostat int `json:"mirostat,omitempty"`
|
||||
MirostatTau float32 `json:"mirostat_tau,omitempty"`
|
||||
MirostatEta float32 `json:"mirostat_eta,omitempty"`
|
||||
Stop []string `json:"stop,omitempty"`
|
||||
}
|
||||
|
||||
|
@ -648,9 +645,6 @@ func DefaultOptions() Options {
|
|||
RepeatPenalty: 1.1,
|
||||
PresencePenalty: 0.0,
|
||||
FrequencyPenalty: 0.0,
|
||||
Mirostat: 0,
|
||||
MirostatTau: 5.0,
|
||||
MirostatEta: 0.1,
|
||||
Seed: -1,
|
||||
|
||||
Runner: Runner{
|
||||
|
|
|
@ -394,9 +394,6 @@ curl http://localhost:11434/api/generate -d '{
|
|||
"repeat_penalty": 1.2,
|
||||
"presence_penalty": 1.5,
|
||||
"frequency_penalty": 1.0,
|
||||
"mirostat": 1,
|
||||
"mirostat_tau": 0.8,
|
||||
"mirostat_eta": 0.6,
|
||||
"penalize_newline": true,
|
||||
"stop": ["\n", "user:"],
|
||||
"numa": false,
|
||||
|
|
|
@ -150,9 +150,6 @@ PARAMETER <parameter> <parametervalue>
|
|||
|
||||
| Parameter | Description | Value Type | Example Usage |
|
||||
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | -------------------- |
|
||||
| mirostat | Enable Mirostat sampling for controlling perplexity. (default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0) | int | mirostat 0 |
|
||||
| mirostat_eta | Influences how quickly the algorithm responds to feedback from the generated text. A lower learning rate will result in slower adjustments, while a higher learning rate will make the algorithm more responsive. (Default: 0.1) | float | mirostat_eta 0.1 |
|
||||
| mirostat_tau | Controls the balance between coherence and diversity of the output. A lower value will result in more focused and coherent text. (Default: 5.0) | float | mirostat_tau 5.0 |
|
||||
| num_ctx | Sets the size of the context window used to generate the next token. (Default: 2048) | int | num_ctx 4096 |
|
||||
| repeat_last_n | Sets how far back for the model to look back to prevent repetition. (Default: 64, 0 = disabled, -1 = num_ctx) | int | repeat_last_n 64 |
|
||||
| repeat_penalty | Sets how strongly to penalize repetitions. A higher value (e.g., 1.5) will penalize repetitions more strongly, while a lower value (e.g., 0.9) will be more lenient. (Default: 1.1) | float | repeat_penalty 1.1 |
|
||||
|
|
|
@ -587,9 +587,6 @@ type SamplingParams struct {
|
|||
PenaltyRepeat float32
|
||||
PenaltyFreq float32
|
||||
PenaltyPresent float32
|
||||
Mirostat int
|
||||
MirostatTau float32
|
||||
MirostatEta float32
|
||||
PenalizeNl bool
|
||||
Seed uint32
|
||||
Grammar string
|
||||
|
@ -606,9 +603,6 @@ func NewSamplingContext(model *Model, params SamplingParams) (*SamplingContext,
|
|||
cparams.penalty_repeat = C.float(params.PenaltyRepeat)
|
||||
cparams.penalty_freq = C.float(params.PenaltyFreq)
|
||||
cparams.penalty_present = C.float(params.PenaltyFreq)
|
||||
cparams.mirostat = C.int32_t(params.Mirostat)
|
||||
cparams.mirostat_tau = C.float(params.MirostatTau)
|
||||
cparams.mirostat_eta = C.float(params.MirostatEta)
|
||||
cparams.seed = C.uint32_t(params.Seed)
|
||||
|
||||
grammar := C.CString(params.Grammar)
|
||||
|
|
3
llama/sampling_ext.cpp
vendored
3
llama/sampling_ext.cpp
vendored
|
@ -19,9 +19,6 @@ struct common_sampler *common_sampler_cinit(const struct llama_model *model, str
|
|||
sparams.penalty_repeat = params->penalty_repeat;
|
||||
sparams.penalty_freq = params->penalty_freq;
|
||||
sparams.penalty_present = params->penalty_present;
|
||||
sparams.mirostat = params->mirostat;
|
||||
sparams.mirostat_tau = params->mirostat_tau;
|
||||
sparams.mirostat_eta = params->mirostat_eta;
|
||||
sparams.seed = params->seed;
|
||||
sparams.grammar = params->grammar;
|
||||
sparams.xtc_probability = 0.0;
|
||||
|
|
3
llama/sampling_ext.h
vendored
3
llama/sampling_ext.h
vendored
|
@ -20,9 +20,6 @@ extern "C"
|
|||
float penalty_repeat;
|
||||
float penalty_freq;
|
||||
float penalty_present;
|
||||
int32_t mirostat;
|
||||
float mirostat_tau;
|
||||
float mirostat_eta;
|
||||
uint32_t seed;
|
||||
char *grammar;
|
||||
};
|
||||
|
|
|
@ -46,6 +46,9 @@ var deprecatedParameters = []string{
|
|||
"logits_all",
|
||||
"vocab_only",
|
||||
"use_mlock",
|
||||
"mirostat",
|
||||
"mirostat_tau",
|
||||
"mirostat_eta",
|
||||
}
|
||||
|
||||
// CreateRequest creates a new *api.CreateRequest from an existing Modelfile
|
||||
|
|
|
@ -492,9 +492,6 @@ func TestParseFileParameters(t *testing.T) {
|
|||
"repeat_penalty 1.0": {"repeat_penalty", "1.0"},
|
||||
"presence_penalty 1.0": {"presence_penalty", "1.0"},
|
||||
"frequency_penalty 1.0": {"frequency_penalty", "1.0"},
|
||||
"mirostat 1": {"mirostat", "1"},
|
||||
"mirostat_tau 1.0": {"mirostat_tau", "1.0"},
|
||||
"mirostat_eta 1.0": {"mirostat_eta", "1.0"},
|
||||
"penalize_newline true": {"penalize_newline", "true"},
|
||||
"stop ### User:": {"stop", "### User:"},
|
||||
"stop ### User: ": {"stop", "### User:"},
|
||||
|
|
|
@ -583,9 +583,6 @@ func (s *Server) completion(w http.ResponseWriter, r *http.Request) {
|
|||
PenaltyRepeat: req.Options.RepeatPenalty,
|
||||
PenaltyFreq: req.Options.FrequencyPenalty,
|
||||
PenaltyPresent: req.Options.PresencePenalty,
|
||||
Mirostat: req.Options.Mirostat,
|
||||
MirostatTau: req.Options.MirostatTau,
|
||||
MirostatEta: req.Options.MirostatEta,
|
||||
Seed: uint32(req.Options.Seed),
|
||||
Grammar: req.Grammar,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue