Skip to content

Fix the enums PoolingType and RopeScalingType values and their calls in ModelParameters #105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/main/java/de/kherud/llama/ModelParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -459,15 +459,15 @@ public ModelParameters setJsonSchema(String schema) {
* Set pooling type for embeddings (default: model default if unspecified).
*/
public ModelParameters setPoolingType(PoolingType type) {
parameters.put("--pooling", String.valueOf(type.getId()));
parameters.put("--pooling", type.getArgValue());
return this;
}

/**
* Set RoPE frequency scaling method (default: linear unless specified by the model).
*/
public ModelParameters setRopeScaling(RopeScalingType type) {
parameters.put("--rope-scaling", String.valueOf(type.getId()));
parameters.put("--rope-scaling", type.getArgValue());
return this;
}

Expand Down Expand Up @@ -960,3 +960,5 @@ public ModelParameters enableJinja() {
}

}


24 changes: 12 additions & 12 deletions src/main/java/de/kherud/llama/args/PoolingType.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

public enum PoolingType {

UNSPECIFIED(-1),
NONE(0),
MEAN(1),
CLS(2),
LAST(3),
RANK(4);
UNSPECIFIED("unspecified"),
NONE("none"),
MEAN("mean"),
CLS("cls"),
LAST("last"),
RANK("rank");

private final int id;
private final String argValue;

PoolingType(int value) {
this.id = value;
PoolingType(String value) {
this.argValue = value;
}

public int getId() {
return id;
public String getArgValue() {
return argValue;
}
}
}
24 changes: 12 additions & 12 deletions src/main/java/de/kherud/llama/args/RopeScalingType.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

public enum RopeScalingType {

UNSPECIFIED(-1),
NONE(0),
LINEAR(1),
YARN2(2),
LONGROPE(3),
MAX_VALUE(3);
UNSPECIFIED("unspecified"),
NONE("none"),
LINEAR("linear"),
YARN2("yarn"),
LONGROPE("longrope"),
MAX_VALUE("maxvalue");

private final int id;
private final String argValue;

RopeScalingType(int value) {
this.id = value;
RopeScalingType(String value) {
this.argValue = value;
}

public int getId() {
return id;
public String getArgValue() {
return argValue;
}
}
}