From 9f7296cb39f73ef0cdf0c90e596b510240c38142 Mon Sep 17 00:00:00 2001 From: cryscan Date: Sat, 4 May 2024 18:48:22 +0800 Subject: [PATCH] Revert using RMSNorm. --- src/runtime/v6.rs | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/runtime/v6.rs b/src/runtime/v6.rs index ee88aee..26381a2 100644 --- a/src/runtime/v6.rs +++ b/src/runtime/v6.rs @@ -593,13 +593,6 @@ impl JobBuilder> for ModelRuntime { None, Model::LN_EPS, )?, - // TensorOp::recenter(&buffer.input)?, - // TensorOp::rms_norm( - // &tensor.embed.layer_norm.w, - // &tensor.embed.layer_norm.b, - // &buffer.input, - // Model::LN_EPS, - // )?, hook_op(Hook::PostEmbedLayerNorm)?, ]); @@ -751,12 +744,6 @@ fn build_layer( None, Model::LN_EPS, )?, - // TensorOp::rms_norm( - // &layer.att_layer_norm.w, - // &layer.att_layer_norm.b, - // &buffer.att_x, - // Model::LN_EPS, - // )?, hook_op(Hook::PostAttLayerNorm(index))?, hook_op(Hook::PreAttTokenShift(index))?, TensorOp::token_shift( @@ -909,12 +896,6 @@ fn build_layer( None, Model::LN_EPS, )?, - // TensorOp::rms_norm( - // &layer.ffn_layer_norm.w, - // &layer.ffn_layer_norm.b, - // &buffer.ffn_x, - // Model::LN_EPS, - // )?, hook_op(Hook::PostFfnLayerNorm(index))?, hook_op(Hook::PreFfnTokenShift(index))?, TensorOp::token_shift( @@ -1012,12 +993,6 @@ fn build_header( None, Model::LN_EPS, )?, - // TensorOp::rms_norm( - // &head.layer_norm.w, - // &head.layer_norm.b, - // &head_x, - // Model::LN_EPS, - // )?, hook_op(Hook::PostHeadLayerNorm)?, head.w.matmul_op( head_x.view(.., .., .., ..)?, @@ -1084,7 +1059,6 @@ impl Build for ModelBuilder { for layer in 0..info.num_layer { let quant = quant.get(&layer).copied().unwrap_or_default(); let discount = 2.0_f32.powi(-((layer / Model::RESCALE_LAYER) as i32)); - let discount = discount * (1.0 - 1.0 / info.num_emb as f32); let att_layer_norm = LayerNorm { w: loader