Skip to content

Commit cc139bb

Browse files
authored
Merge pull request #105 from Pierrlf/fix_enums
Fix the enums PoolingType and RopeScalingType values and their calls in ModelParameters
2 parents 4817145 + d34c1a1 commit cc139bb

File tree

3 files changed

+28
-26
lines changed

3 files changed

+28
-26
lines changed

src/main/java/de/kherud/llama/ModelParameters.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,15 +459,15 @@ public ModelParameters setJsonSchema(String schema) {
459459
* Set pooling type for embeddings (default: model default if unspecified).
460460
*/
461461
public ModelParameters setPoolingType(PoolingType type) {
462-
parameters.put("--pooling", String.valueOf(type.getId()));
462+
parameters.put("--pooling", type.getArgValue());
463463
return this;
464464
}
465465

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

@@ -960,3 +960,5 @@ public ModelParameters enableJinja() {
960960
}
961961

962962
}
963+
964+

src/main/java/de/kherud/llama/args/PoolingType.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22

33
public enum PoolingType {
44

5-
UNSPECIFIED(-1),
6-
NONE(0),
7-
MEAN(1),
8-
CLS(2),
9-
LAST(3),
10-
RANK(4);
5+
UNSPECIFIED("unspecified"),
6+
NONE("none"),
7+
MEAN("mean"),
8+
CLS("cls"),
9+
LAST("last"),
10+
RANK("rank");
1111

12-
private final int id;
12+
private final String argValue;
1313

14-
PoolingType(int value) {
15-
this.id = value;
14+
PoolingType(String value) {
15+
this.argValue = value;
1616
}
1717

18-
public int getId() {
19-
return id;
18+
public String getArgValue() {
19+
return argValue;
2020
}
21-
}
21+
}

src/main/java/de/kherud/llama/args/RopeScalingType.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22

33
public enum RopeScalingType {
44

5-
UNSPECIFIED(-1),
6-
NONE(0),
7-
LINEAR(1),
8-
YARN2(2),
9-
LONGROPE(3),
10-
MAX_VALUE(3);
5+
UNSPECIFIED("unspecified"),
6+
NONE("none"),
7+
LINEAR("linear"),
8+
YARN2("yarn"),
9+
LONGROPE("longrope"),
10+
MAX_VALUE("maxvalue");
1111

12-
private final int id;
12+
private final String argValue;
1313

14-
RopeScalingType(int value) {
15-
this.id = value;
14+
RopeScalingType(String value) {
15+
this.argValue = value;
1616
}
1717

18-
public int getId() {
19-
return id;
18+
public String getArgValue() {
19+
return argValue;
2020
}
21-
}
21+
}

0 commit comments

Comments
 (0)