| 18 | /// Qwen3 transformer block for encoder mode (bidirectional attention, no KV cache). |
| 19 | #[derive(Debug, Clone)] |
| 20 | struct EncoderBlock { |
| 21 | rms_1_weight: Tensor, |
| 22 | rms_2_weight: Tensor, |
| 23 | rms_eps: f32, |
| 24 | // Attention |
| 25 | q_proj_weight: Tensor, |
| 26 | k_proj_weight: Tensor, |
| 27 | v_proj_weight: Tensor, |
| 28 | o_proj_weight: Tensor, |
| 29 | q_norm_weight: Tensor, |
| 30 | k_norm_weight: Tensor, |
| 31 | qk_norm_eps: f32, |
| 32 | num_heads: usize, |
| 33 | num_kv_heads: usize, |
| 34 | head_dim: usize, |
| 35 | // MLP |
| 36 | gate_proj_weight: Tensor, |
| 37 | up_proj_weight: Tensor, |
| 38 | down_proj_weight: Tensor, |
| 39 | backend: Arc<dyn ComputeBackend>, |
| 40 | } |
| 41 | |
| 42 | impl EncoderBlock { |
| 43 | fn load(vb: VarBuilder, cfg: &EncoderConfig, backend: Arc<dyn ComputeBackend>) -> Result<Self> { |
nothing calls this directly
no outgoing calls
no test coverage detected