Skip to content

Commit

Permalink
remove repeat from falcon
Browse files Browse the repository at this point in the history
  • Loading branch information
LLukas22 committed Aug 3, 2023
1 parent 5969638 commit 95abbc9
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions crates/models/falcon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,8 @@ impl KnownModel for Falcon {
// self-attention
layernorm_output = ctx0.op_norm(&input_layer);
layernorm_output = ctx0.op_add(
&ctx0.op_mul(
&ctx0.op_repeat(&self.layers[il].input_layernorm, &layernorm_output),
&layernorm_output,
),
&ctx0.op_repeat(&self.layers[il].input_layernorm_b, &layernorm_output),
&ctx0.op_mul(&layernorm_output, &self.layers[il].input_layernorm),
&self.layers[il].input_layernorm_b,
);

if n_head_kv == 1 {
Expand All @@ -185,17 +182,8 @@ impl KnownModel for Falcon {
// Falcon-40B only
current = ctx0.op_norm(&input_layer);
current = ctx0.op_add(
&ctx0.op_mul(
&ctx0.op_repeat(
self.layers[il].attention_norm.as_ref().unwrap(),
&current,
),
&current,
),
&ctx0.op_repeat(
self.layers[il].attention_norm_b.as_ref().unwrap(),
&current,
),
&ctx0.op_mul(&current, self.layers[il].attention_norm.as_ref().unwrap()),
self.layers[il].attention_norm_b.as_ref().unwrap(),
);
}

Expand Down Expand Up @@ -327,11 +315,8 @@ impl KnownModel for Falcon {
input_layer = ctx0.op_norm(&input_layer);

input_layer = ctx0.op_add(
&ctx0.op_mul(
&ctx0.op_repeat(&self.output_norm, &input_layer),
&input_layer,
),
&ctx0.op_repeat(&self.output_norm_b, &input_layer),
&ctx0.op_mul(&input_layer, &self.output_norm),
&self.output_norm_b,
);

let embeddings_tensor: ggml::Tensor = input_layer.share();
Expand Down

0 comments on commit 95abbc9

Please sign in to comment.