forked from beehive-lab/GPULlama3.java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDevstralConfiguration.java
More file actions
56 lines (47 loc) · 1.72 KB
/
DevstralConfiguration.java
File metadata and controls
56 lines (47 loc) · 1.72 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package org.beehive.gpullama3.model.devstral;
import org.beehive.gpullama3.model.Configuration;
/**
* Configuration for Devstral 2 models (Mistral 3 architecture).
* Unlike standard Mistral, Devstral 2 has an independent head dimension
* (head_dim != dim / num_heads), requiring explicit key_length/value_length.
*/
// @formatter:off
public record DevstralConfiguration(String quantization,
int dim,
int hiddenDim,
int numberOfLayers,
int numberOfHeads,
int numberOfKeyValueHeads,
int headDim,
int vocabularySize,
int contextLength,
float rmsNormEps,
float ropeTheta) implements Configuration {
@Override public String quantization() {
return quantization;
}
/**
* Q projection output dimension = numberOfHeads * headDim.
* This differs from dim when headDim != dim/numberOfHeads.
*/
public int qDim() {
return numberOfHeads * headDim;
}
public int kvDim() {
return numberOfKeyValueHeads * headDim;
}
public int kvMul() {
return numberOfHeads / numberOfKeyValueHeads;
}
@Override
public int numberOfHeadsKey() {
throw new UnsupportedOperationException("Not supported for Devstral.");
}
@Override
public int contextLengthModel() {
throw new UnsupportedOperationException("Not supported for Devstral.");
}
public int headSize() {
return headDim;
}
}