pub fn new<'p, P>(p: P, config: &ElectraConfig) -> ElectraForMaskedLM
    where
        P: Borrow<nn::Path<'p>>,
    {
        let p = p.borrow();

        let electra = ElectraModel::new(p / "electra", config);
        let generator_head = ElectraGeneratorHead::new(p / "generator_predictions", config);
        let lm_head = nn::linear(
            p / "generator_lm_head",
            config.embedding_size,
            config.vocab_size,
            Default::default(),
        );

        ElectraForMaskedLM {
            electra,
            generator_head,
            lm_head,
        }
    }
/// Build a new `ElectraForMaskedLM`
///
/// # Arguments
///
/// * `p` - Variable store path for the root of the Electra model
/// * `config` - `ElectraConfig` object defining the model architecture
///
/// # Example
///
/// ```no_run
/// use rust_bert::electra::{ElectraConfig, ElectraForMaskedLM};
/// use rust_bert::Config;
/// use std::path::Path;
/// use tch::{nn, Device};
///
/// let config_path = Path::new("path/to/config.json");
/// let device = Device::Cpu;
/// let p = nn::VarStore::new(device);
/// let config = ElectraConfig::from_file(config_path);
/// let electra_model: ElectraForMaskedLM = ElectraForMaskedLM::new(&p.root(), &config);
/// ```
Build a new `ElectraForMaskedLM`
Build a new ` ElectraForMaskedLM `
pub fn new<'p, P>(p: P, config: &ElectraConfig) -> ElectraForMaskedLM
    where
        P: Borrow<nn::Path<'p>>,
    {
        let p = p.borrow();
        let electra = ElectraModel::new(p / "electra", config);
        let generator_head = ElectraGeneratorHead::new(p / "generator_predictions", config);
        let lm_head = nn::linear(
            p / "generator_lm_head",
            config.embedding_size,
            config.vocab_size,
            Default::default(),
        );
        ElectraForMaskedLM {
            electra,
            generator_head,
            lm_head,
        }
    }
pub fn new < ' p , P > ( p : P , config : & ElectraConfig ) -> ElectraForMaskedLM where P : Borrow < nn :: Path < ' p > > , { let p = p . borrow ( ) ; let electra = ElectraModel :: new ( p / " " , config ) ; let generator_head = ElectraGeneratorHead :: new ( p / " " , config ) ; let lm_head = nn :: linear ( p / " " , config . embedding_size , config . vocab_size , Default :: default ( ) , ) ; ElectraForMaskedLM { electra , generator_head , lm_head , } }
Build a new `ElectraForMaskedLM`
Build a new ` ElectraForMaskedLM `
p
P
config
&ElectraConfig
p
P
config
&ElectraConfig
example
```no_run
use rust_bert::electra::{ElectraConfig, ElectraForMaskedLM};
use rust_bert::Config;
use std::path::Path;
use tch::{nn, Device}.

let config_path = Path::new("path/to/config.json");
let device = Device::Cpu;
let p = nn::VarStore::new(device);
let config = ElectraConfig::from_file(config_path);
let electra_model: ElectraForMaskedLM = ElectraForMaskedLM::new(&p.root(), &config);
```
` ` ` no_run use rust_bert :: electra :: { ElectraConfig ElectraForMaskedLM } ; use rust_bert :: Config ; use std :: path :: Path ; use tch :: { nn Device } . let config_path = Path :: new ( " path / to / config . json " ) ; let device = Device :: Cpu ; let p = nn :: VarStore :: new ( device ) ; let config = ElectraConfig :: from_file ( config_path ) ; let electra_model : ElectraForMaskedLM = ElectraForMaskedLM :: new ( &p . root () &config ) ; ` ` `