Class QwenWeightShard
java.lang.Object
smile.llm.model.qwen.QwenWeightShard
Applies TP weight slices for Qwen module parameter names.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Tensorshard(String smileName, Tensor src, QwenModelArgs args, TensorShardSpec shard) Returns a tensor suitable forloadStateDict/ FP8 install on one TP rank.static TensorshardScaleInv(String smileWeightName, Tensor src, QwenModelArgs args, TensorShardSpec shard) Shards a block-scale inverse tensor[ceil(N/128), ceil(K/128)]using the same TP rules asshard(String, Tensor, QwenModelArgs, TensorShardSpec)for the matching weight name.
-
Method Details
-
shard
Returns a tensor suitable forloadStateDict/ FP8 install on one TP rank. Caller owns any newly created view; may returnsrcunchanged.- Parameters:
smileName- Smile weight name.src- full-rank source tensor.args- model hyperparameters.shard- TP shard spec, ornullfor no sharding.- Returns:
- sharded or original tensor.
-
shardScaleInv
public static Tensor shardScaleInv(String smileWeightName, Tensor src, QwenModelArgs args, TensorShardSpec shard) Shards a block-scale inverse tensor[ceil(N/128), ceil(K/128)]using the same TP rules asshard(String, Tensor, QwenModelArgs, TensorShardSpec)for the matching weight name.- Parameters:
smileWeightName- Smile weight name for the matching linear.src- full-rank scale-inv tensor.args- model hyperparameters.shard- TP shard spec, ornullfor no sharding.- Returns:
- sharded or original tensor.
-