Record Class MiniMaxShard
java.lang.Object
java.lang.Record
smile.llm.model.minimax.MiniMaxShard
- Record Components:
rank- this rank, in[0, size).size- number of ranks.device- the rank's device; expert weights are allocated here.
One rank of expert parallelism: this rank owns a contiguous range of the routed experts of
every MoE layer and allocates their weights directly on
device. Attention, dense FFNs,
the router and the shared expert are replicated on every rank.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondevice()Returns the value of thedevicerecord component.final booleanIndicates whether some other object is "equal to" this one.intexpertStart(int numExperts) Returns the first expert owned by this rank.final inthashCode()Returns a hash code value for this object.intlocalExperts(int numExperts) Returns the number of experts owned by this rank.intrank()Returns the value of therankrecord component.static MiniMaxShardsingle()Returns the unsharded layout.intsize()Returns the value of thesizerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
MiniMaxShard
Validates the rank.
-
-
Method Details
-
single
Returns the unsharded layout.- Returns:
- a single rank on the CPU (the model is moved with
to(device)).
-
localExperts
public int localExperts(int numExperts) Returns the number of experts owned by this rank.- Parameters:
numExperts- total routed experts.- Returns:
- local expert count.
-
expertStart
public int expertStart(int numExperts) Returns the first expert owned by this rank.- Parameters:
numExperts- total routed experts.- Returns:
- global index of the first local expert.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
rank
-
size
-
device
-