mirror of
https://github.com/huggingface/candle.git
synced 2025-06-15 02:16:37 +00:00
ModernBERT model (#2713)
* layer_norm_no_bias * Modernbert model. * Format + cleanup error. --------- Co-authored-by: laurent <laurent.mazare@gmail.com>
This commit is contained in:
@ -155,6 +155,15 @@ pub fn layer_norm<C: Into<LayerNormConfig>>(
|
||||
})
|
||||
}
|
||||
|
||||
pub fn layer_norm_no_bias(size: usize, eps: f64, vb: crate::VarBuilder) -> Result<LayerNorm> {
|
||||
let config = LayerNormConfig {
|
||||
eps,
|
||||
remove_mean: true,
|
||||
affine: false,
|
||||
};
|
||||
layer_norm(size, config, vb)
|
||||
}
|
||||
|
||||
/// RmsNorm is a specialized version of the LayerNorm module.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct RmsNorm(LayerNorm);
|
||||
|
@ -46,7 +46,9 @@ pub use embedding::{embedding, Embedding};
|
||||
pub use func::{func, func_t, Func, FuncT};
|
||||
pub use group_norm::{group_norm, GroupNorm};
|
||||
pub use init::Init;
|
||||
pub use layer_norm::{layer_norm, rms_norm, LayerNorm, LayerNormConfig, RmsNorm};
|
||||
pub use layer_norm::{
|
||||
layer_norm, layer_norm_no_bias, rms_norm, LayerNorm, LayerNormConfig, RmsNorm,
|
||||
};
|
||||
pub use linear::{linear, linear_b, linear_no_bias, Linear};
|
||||
pub use ops::Dropout;
|
||||
pub use optim::{AdamW, Optimizer, ParamsAdamW, SGD};
|
||||
|
Reference in New Issue
Block a user