| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | package mllama | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							|  |  |  | 	"math" | 
					
						
							|  |  |  | 	"slices" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 11:59:41 +08:00
										 |  |  | 	"github.com/ollama/ollama/kvcache" | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 	"github.com/ollama/ollama/ml" | 
					
						
							|  |  |  | 	"github.com/ollama/ollama/ml/nn" | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type TextSelfAttention struct { | 
					
						
							| 
									
										
										
										
											2025-03-08 03:19:03 +08:00
										 |  |  | 	Query       *nn.Linear `gguf:"attn_q"` | 
					
						
							|  |  |  | 	Key         *nn.Linear `gguf:"attn_k"` | 
					
						
							|  |  |  | 	Value       *nn.Linear `gguf:"attn_v"` | 
					
						
							|  |  |  | 	Output      *nn.Linear `gguf:"attn_output"` | 
					
						
							|  |  |  | 	RopeFactors ml.Tensor  `gguf:"rope_freqs.weight"` | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 11:59:41 +08:00
										 |  |  | func (sa *TextSelfAttention) Forward(ctx ml.Context, hiddenState, positions, _ ml.Tensor, cache *kvcache.WrapperCache, opts *TextModelOptions) ml.Tensor { | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 	batchSize := hiddenState.Dim(1) | 
					
						
							|  |  |  | 	headDim := opts.hiddenSize / opts.numHeads | 
					
						
							| 
									
										
										
										
											2025-02-08 07:58:15 +08:00
										 |  |  | 	ropeType := uint32(0) | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	query := sa.Query.Forward(ctx, hiddenState) | 
					
						
							|  |  |  | 	query = query.Reshape(ctx, headDim, opts.numHeads, batchSize) | 
					
						
							| 
									
										
										
										
											2025-02-08 07:58:15 +08:00
										 |  |  | 	query = query.RoPE(ctx, positions, sa.RopeFactors, opts.ropeDim, ropeType, opts.ropeBase, opts.ropeScale) | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	key := sa.Key.Forward(ctx, hiddenState) | 
					
						
							|  |  |  | 	key = key.Reshape(ctx, headDim, opts.numKVHeads, batchSize) | 
					
						
							| 
									
										
										
										
											2025-03-08 08:05:56 +08:00
										 |  |  | 	key = key.RoPE(ctx, positions, sa.RopeFactors, opts.ropeDim, ropeType, opts.ropeBase, opts.ropeScale) | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	value := sa.Value.Forward(ctx, hiddenState) | 
					
						
							|  |  |  | 	value = value.Reshape(ctx, headDim, opts.numKVHeads, batchSize) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-15 12:51:44 +08:00
										 |  |  | 	scaleFactor := 1.0 / math.Sqrt(float64(headDim)) | 
					
						
							| 
									
										
										
										
											2025-02-23 13:34:10 +08:00
										 |  |  | 	attention := nn.Attention(ctx, query, key, value, scaleFactor, cache) | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 	attention = attention.Reshape(ctx, opts.hiddenSize, batchSize) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return sa.Output.Forward(ctx, attention) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 11:59:41 +08:00
										 |  |  | func (m *TextModel) Shift(ctx ml.Context, layer int, key, shift ml.Tensor) (ml.Tensor, error) { | 
					
						
							| 
									
										
										
										
											2025-02-08 07:58:15 +08:00
										 |  |  | 	// This will only get called for layers in the cache, which are just the self attention layers
 | 
					
						
							| 
									
										
										
										
											2025-03-08 03:19:03 +08:00
										 |  |  | 	if sa, ok := m.Transformer.Layers[layer].(*TextSelfAttentionDecoderLayer); ok { | 
					
						
							| 
									
										
										
										
											2025-02-08 07:58:15 +08:00
										 |  |  | 		return key.RoPE(ctx, shift, sa.SelfAttention.RopeFactors, m.ropeDim, uint32(0), m.ropeBase, m.ropeScale), nil | 
					
						
							| 
									
										
										
										
											2025-03-08 03:19:03 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return key, nil | 
					
						
							| 
									
										
										
										
											2024-12-18 11:59:41 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | type TextMLP struct { | 
					
						
							|  |  |  | 	Up   *nn.Linear `gguf:"ffn_up"` | 
					
						
							|  |  |  | 	Down *nn.Linear `gguf:"ffn_down"` | 
					
						
							|  |  |  | 	Gate *nn.Linear `gguf:"ffn_gate"` | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func (mlp *TextMLP) Forward(ctx ml.Context, hiddenState ml.Tensor, opts *TextModelOptions) ml.Tensor { | 
					
						
							|  |  |  | 	hiddenState = mlp.Gate.Forward(ctx, hiddenState).SILU(ctx).Mul(ctx, mlp.Up.Forward(ctx, hiddenState)) | 
					
						
							|  |  |  | 	return mlp.Down.Forward(ctx, hiddenState) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type TextSelfAttentionDecoderLayer struct { | 
					
						
							|  |  |  | 	AttentionNorm *nn.RMSNorm `gguf:"attn_norm"` | 
					
						
							|  |  |  | 	SelfAttention *TextSelfAttention | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	MLPNorm *nn.RMSNorm `gguf:"ffn_norm"` | 
					
						
							|  |  |  | 	MLP     *TextMLP | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-19 09:16:57 +08:00
										 |  |  | func (d *TextSelfAttentionDecoderLayer) Forward(ctx ml.Context, hiddenState, positions, outputs, mask, _, _ ml.Tensor, cache *kvcache.WrapperCache, opts *TextModelOptions) ml.Tensor { | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 	residual := hiddenState | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	hiddenState = d.AttentionNorm.Forward(ctx, hiddenState, opts.eps) | 
					
						
							|  |  |  | 	hiddenState = d.SelfAttention.Forward(ctx, hiddenState, positions, mask, cache, opts) | 
					
						
							| 
									
										
										
										
											2025-02-19 09:16:57 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// In the final layer (outputs != nil), optimize by pruning to just the token positions
 | 
					
						
							|  |  |  | 	// we need logits for.
 | 
					
						
							|  |  |  | 	if outputs != nil { | 
					
						
							|  |  |  | 		hiddenState = hiddenState.Rows(ctx, outputs) | 
					
						
							|  |  |  | 		residual = residual.Rows(ctx, outputs) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 	hiddenState = hiddenState.Add(ctx, residual) | 
					
						
							|  |  |  | 	residual = hiddenState | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	hiddenState = d.MLPNorm.Forward(ctx, hiddenState, opts.eps) | 
					
						
							|  |  |  | 	hiddenState = d.MLP.Forward(ctx, hiddenState, opts) | 
					
						
							|  |  |  | 	return hiddenState.Add(ctx, residual) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type TextCrossAttention struct { | 
					
						
							|  |  |  | 	QueryNorm *nn.RMSNorm `gguf:"cross_attn_q_norm"` | 
					
						
							|  |  |  | 	Query     *nn.Linear  `gguf:"cross_attn_q_proj"` | 
					
						
							|  |  |  | 	KeyNorm   *nn.RMSNorm `gguf:"cross_attn_k_norm"` | 
					
						
							|  |  |  | 	Key       *nn.Linear  `gguf:"cross_attn_k_proj"` | 
					
						
							|  |  |  | 	Value     *nn.Linear  `gguf:"cross_attn_v_proj"` | 
					
						
							|  |  |  | 	Output    *nn.Linear  `gguf:"cross_attn_o_proj"` | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 11:59:41 +08:00
										 |  |  | func (ca *TextCrossAttention) Forward(ctx ml.Context, hiddenState, crossAttentionStates ml.Tensor, cache *kvcache.WrapperCache, opts *TextModelOptions) ml.Tensor { | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 	batchSize := hiddenState.Dim(1) | 
					
						
							|  |  |  | 	headDim := opts.hiddenSize / opts.numHeads | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	query := ca.Query.Forward(ctx, hiddenState) | 
					
						
							|  |  |  | 	query = query.Reshape(ctx, headDim, opts.numHeads, batchSize) | 
					
						
							|  |  |  | 	query = ca.QueryNorm.Forward(ctx, query, opts.eps) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-23 13:34:10 +08:00
										 |  |  | 	var key, value ml.Tensor | 
					
						
							| 
									
										
										
										
											2024-12-18 11:59:41 +08:00
										 |  |  | 	if crossAttentionStates != nil { | 
					
						
							|  |  |  | 		numVisionTokens, numTiles := crossAttentionStates.Dim(1), crossAttentionStates.Dim(2) | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 11:59:41 +08:00
										 |  |  | 		key = ca.Key.Forward(ctx, crossAttentionStates) | 
					
						
							|  |  |  | 		key = key.Reshape(ctx, headDim, opts.numKVHeads, numVisionTokens*numTiles) | 
					
						
							|  |  |  | 		key = ca.KeyNorm.Forward(ctx, key, opts.eps) | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 11:59:41 +08:00
										 |  |  | 		value = ca.Value.Forward(ctx, crossAttentionStates) | 
					
						
							|  |  |  | 		value = value.Reshape(ctx, headDim, opts.numKVHeads, numVisionTokens*numTiles) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		cache.Put(ctx, key, value) | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-23 13:34:10 +08:00
										 |  |  | 	key, value, _ = cache.Get(ctx) | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-15 12:51:44 +08:00
										 |  |  | 	scaleFactor := 1.0 / math.Sqrt(float64(headDim)) | 
					
						
							| 
									
										
										
										
											2025-02-23 13:34:10 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	query = query.Permute(ctx, 0, 2, 1, 3) | 
					
						
							|  |  |  | 	key = key.Permute(ctx, 0, 2, 1, 3) | 
					
						
							|  |  |  | 	value = value.Permute(ctx, 1, 2, 0, 3).Contiguous(ctx) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	kq := key.MulmatFullPrec(ctx, query) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	kq = kq.Scale(ctx, scaleFactor) | 
					
						
							|  |  |  | 	kq = kq.Softmax(ctx) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	kqv := value.Mulmat(ctx, kq) | 
					
						
							|  |  |  | 	attention := kqv.Permute(ctx, 0, 2, 1, 3).Contiguous(ctx) | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 	attention = attention.Reshape(ctx, opts.hiddenSize, batchSize) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return ca.Output.Forward(ctx, attention) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type TextCrossAttentionDecoderLayer struct { | 
					
						
							|  |  |  | 	AttentionNorm  *nn.RMSNorm `gguf:"attn_norm"` | 
					
						
							|  |  |  | 	CrossAttention *TextCrossAttention | 
					
						
							|  |  |  | 	AttentionGate  ml.Tensor `gguf:"cross_attn_attn_gate"` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	MLPNorm *nn.RMSNorm `gguf:"ffn_norm"` | 
					
						
							|  |  |  | 	MLP     *TextMLP | 
					
						
							|  |  |  | 	MLPGate ml.Tensor `gguf:"cross_attn_mlp_gate"` | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-19 09:16:57 +08:00
										 |  |  | func (d *TextCrossAttentionDecoderLayer) Forward(ctx ml.Context, hiddenState, _, _, _, crossAttentionStates, crossAttentionMask ml.Tensor, cache *kvcache.WrapperCache, opts *TextModelOptions) ml.Tensor { | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 	residual := hiddenState | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	hiddenState = d.AttentionNorm.Forward(ctx, hiddenState, opts.eps) | 
					
						
							|  |  |  | 	hiddenState = d.CrossAttention.Forward(ctx, hiddenState, crossAttentionStates, cache, opts) | 
					
						
							|  |  |  | 	hiddenState = hiddenState.Mul(ctx, d.AttentionGate.Tanh(ctx)) | 
					
						
							|  |  |  | 	hiddenState = hiddenState.Add(ctx, residual) | 
					
						
							|  |  |  | 	residual = hiddenState | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	hiddenState = d.MLPNorm.Forward(ctx, hiddenState, opts.eps) | 
					
						
							|  |  |  | 	hiddenState = d.MLP.Forward(ctx, hiddenState, opts) | 
					
						
							|  |  |  | 	hiddenState = hiddenState.Mul(ctx, d.MLPGate.Tanh(ctx)) | 
					
						
							|  |  |  | 	return hiddenState.Add(ctx, residual) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type TextDecoderLayer interface { | 
					
						
							| 
									
										
										
										
											2025-02-19 09:16:57 +08:00
										 |  |  | 	Forward(ctx ml.Context, hiddenState, positionIDs, outputs, mask, crossAttentionStates, crossAttentionMask ml.Tensor, cache *kvcache.WrapperCache, opts *TextModelOptions) ml.Tensor | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type TextDecoder struct { | 
					
						
							|  |  |  | 	Layers []TextDecoderLayer | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-19 09:16:57 +08:00
										 |  |  | func (d *TextDecoder) Forward(ctx ml.Context, hiddenState, positionIDs, outputs, mask, crossAttentionStates, crossAttentionMask ml.Tensor, cache *kvcache.WrapperCache, opts *TextModelOptions) ml.Tensor { | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 	for i, layer := range d.Layers { | 
					
						
							| 
									
										
										
										
											2024-12-18 11:59:41 +08:00
										 |  |  | 		layerType := selfAttentionLayer | 
					
						
							|  |  |  | 		if slices.Contains(opts.crossAttentionLayers, uint32(i)) { | 
					
						
							|  |  |  | 			layerType = crossAttentionLayer | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		cache.SetLayer(i) | 
					
						
							|  |  |  | 		cache.SetLayerType(layerType) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if layerType == selfAttentionLayer || crossAttentionStates != nil || cache.UnderlyingCache().(*kvcache.EncoderCache).EncoderCached() { | 
					
						
							| 
									
										
										
										
											2025-02-19 09:16:57 +08:00
										 |  |  | 			var lastLayerOutputs ml.Tensor | 
					
						
							|  |  |  | 			if i == len(d.Layers)-1 { | 
					
						
							|  |  |  | 				lastLayerOutputs = outputs | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			hiddenState = layer.Forward(ctx, hiddenState, positionIDs, lastLayerOutputs, mask, crossAttentionStates, crossAttentionMask, cache, opts) | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return hiddenState | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type TextModelOptions struct { | 
					
						
							| 
									
										
										
										
											2025-02-04 09:21:57 +08:00
										 |  |  | 	hiddenSize, numHeads, numKVHeads int | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 	eps, ropeBase, ropeScale         float32 | 
					
						
							|  |  |  | 	ropeDim                          uint32 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	crossAttentionLayers []uint32 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type TextModel struct { | 
					
						
							|  |  |  | 	TokenEmbedding *nn.Embedding `gguf:"token_embd"` | 
					
						
							|  |  |  | 	Transformer    *TextDecoder  `gguf:"blk"` | 
					
						
							|  |  |  | 	OutputNorm     *nn.RMSNorm   `gguf:"output_norm"` | 
					
						
							|  |  |  | 	Output         *nn.Linear    `gguf:"output"` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	*TextModelOptions | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-19 09:16:57 +08:00
										 |  |  | func (m *TextModel) Forward(ctx ml.Context, inputIDs, positionIDs, outputs, mask, crossAttentionStates, crossAttentionMask ml.Tensor, cache *kvcache.WrapperCache) ml.Tensor { | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 	hiddenState := m.TokenEmbedding.Forward(ctx, inputIDs) | 
					
						
							| 
									
										
										
										
											2025-02-19 09:16:57 +08:00
										 |  |  | 	hiddenState = m.Transformer.Forward(ctx, hiddenState, positionIDs, outputs, mask, crossAttentionStates, crossAttentionMask, cache, m.TextModelOptions) | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 	hiddenState = m.OutputNorm.Forward(ctx, hiddenState, m.eps) | 
					
						
							|  |  |  | 	return m.Output.Forward(ctx, hiddenState) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func newTextModel(c ml.Config) *TextModel { | 
					
						
							|  |  |  | 	var decoderLayers []TextDecoderLayer | 
					
						
							|  |  |  | 	for i := range c.Uint("block_count") { | 
					
						
							|  |  |  | 		var textDecoderLayer TextDecoderLayer | 
					
						
							|  |  |  | 		if slices.Contains(c.Uints("attention.cross_attention_layers"), i) { | 
					
						
							|  |  |  | 			textDecoderLayer = &TextCrossAttentionDecoderLayer{} | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			textDecoderLayer = &TextSelfAttentionDecoderLayer{} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		decoderLayers = append(decoderLayers, textDecoderLayer) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return &TextModel{ | 
					
						
							|  |  |  | 		Transformer: &TextDecoder{Layers: decoderLayers}, | 
					
						
							|  |  |  | 		TextModelOptions: &TextModelOptions{ | 
					
						
							| 
									
										
										
										
											2025-02-04 09:21:57 +08:00
										 |  |  | 			hiddenSize:           int(c.Uint("embedding_length")), | 
					
						
							|  |  |  | 			numHeads:             int(c.Uint("attention.head_count")), | 
					
						
							|  |  |  | 			numKVHeads:           int(c.Uint("attention.head_count_kv")), | 
					
						
							| 
									
										
										
										
											2025-02-14 08:31:21 +08:00
										 |  |  | 			eps:                  c.Float("attention.layer_norm_rms_epsilon"), | 
					
						
							|  |  |  | 			ropeBase:             c.Float("rope.freq_base"), | 
					
						
							|  |  |  | 			ropeScale:            c.Float("rope.freq_scale", 1), | 
					
						
							|  |  |  | 			ropeDim:              c.Uint("rope.dimension_count"), | 
					
						
							|  |  |  | 			crossAttentionLayers: c.Uints("attention.cross_attention_layers"), | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } |