Skip to content

Commit

Permalink
Revert using RMSNorm.
Browse files Browse the repository at this point in the history
  • Loading branch information
cryscan committed May 4, 2024
1 parent a2a72fe commit 9f7296c
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions src/runtime/v6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,13 +593,6 @@ impl<F: Float> JobBuilder<InferJob<F>> for ModelRuntime<F> {
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)?,
]);

Expand Down Expand Up @@ -751,12 +744,6 @@ fn build_layer<F: Float>(
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(
Expand Down Expand Up @@ -909,12 +896,6 @@ fn build_layer<F: Float>(
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(
Expand Down Expand Up @@ -1012,12 +993,6 @@ fn build_header<F: Float>(
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(.., .., .., ..)?,
Expand Down Expand Up @@ -1084,7 +1059,6 @@ impl<R: Reader> Build<Model> for ModelBuilder<R> {
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
Expand Down

0 comments on commit 9f7296c

Please sign in to comment.