forked from kherud/java-llama.cpp
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSampler.java
More file actions
37 lines (32 loc) · 1.15 KB
/
Copy pathSampler.java
File metadata and controls
37 lines (32 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package net.ladenthin.llama.args;
/**
* Sampling algorithm for {@code --samplers} (CLI) and the {@code "samplers"} JSON field.
*/
public enum Sampler implements CliArg {
/** DRY (Don't Repeat Yourself) repetition penalty sampler. */
DRY("dry"),
/** Top-K sampling: keep only the K most likely tokens. */
TOP_K("top_k"),
/** Top-P (nucleus) sampling: keep tokens whose cumulative probability exceeds P. */
TOP_P("top_p"),
/** Typical-P sampling: keep tokens whose local typicality exceeds P. */
TYP_P("typ_p"),
/** Min-P sampling: remove tokens below a minimum probability threshold. */
MIN_P("min_p"),
/** Temperature scaling applied to logits before sampling. */
TEMPERATURE("temperature"),
/** XTC (eXclude Top Choices) sampler. */
XTC("xtc"),
/** Infill-specific sampler for fill-in-the-middle tasks. */
INFILL("infill"),
/** Repetition, frequency, and presence penalties sampler. */
PENALTIES("penalties");
private final String argValue;
Sampler(String argValue) {
this.argValue = argValue;
}
@Override
public String getArgValue() {
return argValue;
}
}